From 9e3f0b22e9fff1d06811969ecb46e1ae1a73105e Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 29 May 2019 14:37:11 -0700 Subject: [PATCH] gpu: nvgpu: Move code to utils unit The utils unit contains utilities that are useful to everyone. Things like rbtree, enabled, string, etc go here. This helps prevent clutter in the top level common directory. Also by organizing source code into these top level units we reduce our SWUD burden: all utility code may be described by one SWUD instead of many tiny SWUDs. JIRA NVGPU-3544 Change-Id: Idc6169f375ba87b8a5d325712bf09aee8f27fb96 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/2127479 Reviewed-by: mobile promotions Tested-by: mobile promotions --- arch/nvgpu-common.yaml | 34 +++++-------------- arch/nvgpu-interface.yaml | 5 --- drivers/gpu/nvgpu/Makefile | 8 ++--- drivers/gpu/nvgpu/Makefile.sources | 10 +++--- .../gpu/nvgpu/common/{ => utils}/enabled.c | 0 drivers/gpu/nvgpu/common/{ => utils}/rbtree.c | 0 drivers/gpu/nvgpu/common/{ => utils}/string.c | 0 drivers/gpu/nvgpu/common/{ => utils}/worker.c | 0 8 files changed, 17 insertions(+), 40 deletions(-) rename drivers/gpu/nvgpu/common/{ => utils}/enabled.c (100%) rename drivers/gpu/nvgpu/common/{ => utils}/rbtree.c (100%) rename drivers/gpu/nvgpu/common/{ => utils}/string.c (100%) rename drivers/gpu/nvgpu/common/{ => utils}/worker.c (100%) diff --git a/arch/nvgpu-common.yaml b/arch/nvgpu-common.yaml index f30177513..11f9a6d65 100644 --- a/arch/nvgpu-common.yaml +++ b/arch/nvgpu-common.yaml @@ -61,14 +61,6 @@ ecc: include/nvgpu/ecc.h ] deps: -enabled: - safe: yes - owner: Alex W - sources: [ common/enabled.c, - include/nvgpu/enabled.h ] - deps: - tags: unit-testable - # Pretty sure this can be marked as not-safe since we plan to use # usermode submits in the safety build. fence: @@ -159,12 +151,6 @@ ptimer: include/nvgpu/ptimer.h ] deps: -rbtree: - safe: yes - owner: Deepak N - sources: [ common/rbtree.c ] - deps: - semaphore: safe: no owner: Alex W @@ -194,12 +180,6 @@ sim: include/nvgpu/hw_sim_pci.h, include/nvgpu/sim.h ] -string: - safe: yes - owner: Terje B - sources: [ common/string.c ] - deps: - unit: safe: yes owner: Terje B @@ -208,12 +188,14 @@ unit: utils: safe: yes owner: Terje B - sources: [ include/nvgpu/utils.h ] - -worker: - safe: yes - sources: [ common/worker.c, - include/nvgpu/worker.h ] + sources: [ include/nvgpu/utils.h, + include/nvgpu/worker.h, + include/nvgpu/rbtree.h, + include/nvgpu/enabled.h, + common/utils/string.c, + common/utils/worker.c, + common/utils/rbtree.c, + common/utils/enabled.c ] ## ## Common elements. diff --git a/arch/nvgpu-interface.yaml b/arch/nvgpu-interface.yaml index f81dbed2a..3ca4006eb 100644 --- a/arch/nvgpu-interface.yaml +++ b/arch/nvgpu-interface.yaml @@ -82,11 +82,6 @@ log2: safe: yes sources: [ include/nvgpu/log2.h ] -rbtree: - safe: yes - sources: [ include/nvgpu/rbtree.h ] - tags: unit-testable - rwsem: safe: yes sources: [ include/nvgpu/rwsem.h ] diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 8a4d56397..5e8e9269f 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -38,12 +38,15 @@ obj-$(CONFIG_GK20A) := nvgpu.o # is in progress. nvgpu-y += \ + common/utils/enabled.o \ + common/utils/rbtree.o \ + common/utils/string.o \ + common/utils/worker.o \ common/ptimer/ptimer.o \ common/perf/perfbuf.o \ common/xve/xve_gp106.o \ common/therm/therm.o \ common/mc/mc.o \ - common/worker.o \ common/sync/channel_sync.o \ common/sync/channel_sync_semaphore.o \ common/semaphore/semaphore_sea.o \ @@ -520,10 +523,7 @@ nvgpu-y += \ common/mm/comptags.o \ common/mm/mm.o \ common/mm/dma.o \ - common/enabled.o \ - common/string.o \ common/pramin.o \ - common/rbtree.o \ common/vbios/bios.o \ common/vbios/nvlink_bios.o \ common/vbios/bios_sw_gv100.o \ diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index 8d5103f13..a60bf9387 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -62,7 +62,11 @@ srcs += os/posix/bug.c \ os/posix/bitmap.c \ os/posix/kmem.c -srcs += common/sim/sim.c \ +srcs += common/utils/enabled.c \ + common/utils/rbtree.c \ + common/utils/string.c \ + common/utils/worker.c \ + common/sim/sim.c \ common/sim/sim_pci.c \ common/sim/sim_netlist.c \ common/init/nvgpu_init.c \ @@ -85,10 +89,7 @@ srcs += common/sim/sim.c \ common/xve/xve_gp106.c \ common/therm/therm.c \ common/perf/perfbuf.c \ - common/enabled.c \ common/pramin.c \ - common/string.c \ - common/rbtree.c \ common/ltc/ltc.c \ common/cbc/cbc.c \ common/fbp/fbp.c \ @@ -123,7 +124,6 @@ srcs += common/sim/sim.c \ common/acr/acr_bootstrap.c \ common/acr/acr_sw_gv11b.c \ common/ptimer/ptimer.c \ - common/worker.c \ common/sync/channel_sync.c \ common/sync/channel_sync_syncpt.c \ common/sync/channel_sync_semaphore.c \ diff --git a/drivers/gpu/nvgpu/common/enabled.c b/drivers/gpu/nvgpu/common/utils/enabled.c similarity index 100% rename from drivers/gpu/nvgpu/common/enabled.c rename to drivers/gpu/nvgpu/common/utils/enabled.c diff --git a/drivers/gpu/nvgpu/common/rbtree.c b/drivers/gpu/nvgpu/common/utils/rbtree.c similarity index 100% rename from drivers/gpu/nvgpu/common/rbtree.c rename to drivers/gpu/nvgpu/common/utils/rbtree.c diff --git a/drivers/gpu/nvgpu/common/string.c b/drivers/gpu/nvgpu/common/utils/string.c similarity index 100% rename from drivers/gpu/nvgpu/common/string.c rename to drivers/gpu/nvgpu/common/utils/string.c diff --git a/drivers/gpu/nvgpu/common/worker.c b/drivers/gpu/nvgpu/common/utils/worker.c similarity index 100% rename from drivers/gpu/nvgpu/common/worker.c rename to drivers/gpu/nvgpu/common/utils/worker.c