From bac60705093c41e66fbe533b9d813b6f6d4ab4e9 Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Wed, 14 Aug 2019 09:24:46 +0530 Subject: [PATCH] gpu: nvgpu: remove lockless_allocator from safe build Bracket the functionality of lockless_allocator under the CONFIG_NVGPU_FENCE to allow it to be compiled out for safety builds. Bug 200538092 Change-Id: If8a44a4d4aa03adbe5734db3e99c2e8cc27d7a37 Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/2174907 Reviewed-by: Deepak Nibade GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Makefile | 1 + drivers/gpu/nvgpu/Makefile.shared.configs | 1 + drivers/gpu/nvgpu/Makefile.sources | 4 ++-- drivers/gpu/nvgpu/include/nvgpu/allocator.h | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index e21653359..7b9b2a23b 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -53,6 +53,7 @@ ccflags-y += -DCONFIG_NVGPU_COMMON_NON_FUSA ccflags-y += -DCONFIG_NVGPU_INJECT_HWERR ccflags-y += -DCONFIG_NVGPU_GR_FALCON_NON_SECURE_BOOT ccflags-y += -DCONFIG_NVGPU_SW_SEMAPHORE +ccflags-y += -DCONFIG_NVGPU_FENCE ifeq ($(CONFIG_NVGPU_LOGGING),y) ccflags-y += -DCONFIG_NVGPU_LOGGING=1 diff --git a/drivers/gpu/nvgpu/Makefile.shared.configs b/drivers/gpu/nvgpu/Makefile.shared.configs index 5894bf097..c6b503693 100644 --- a/drivers/gpu/nvgpu/Makefile.shared.configs +++ b/drivers/gpu/nvgpu/Makefile.shared.configs @@ -79,6 +79,7 @@ NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_KERNEL_MODE_SUBMIT # Enable fences for safety build till until we switch to user mode submits only CONFIG_NVGPU_FENCE := 1 +NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_FENCE # Enable Channel/TSG Scheduling for safety build until devctl whitelisting is done CONFIG_NVGPU_CHANNEL_TSG_SCHEDULING := 1 diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index cc9a27df5..baf5d35f4 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -89,7 +89,6 @@ srcs += common/utils/assert.c \ common/mm/allocators/nvgpu_allocator.c \ common/mm/allocators/bitmap_allocator.c \ common/mm/allocators/buddy_allocator.c \ - common/mm/allocators/lockless_allocator.c \ common/mm/gmmu/page_table.c \ common/mm/gmmu/pd_cache.c \ common/mm/as.c \ @@ -397,7 +396,8 @@ endif endif ifeq ($(CONFIG_NVGPU_FENCE),1) -srcs += common/fence/fence.c +srcs += common/fence/fence.c \ + common/mm/allocators/lockless_allocator.c endif ifeq ($(CONFIG_NVGPU_FECS_TRACE),1) diff --git a/drivers/gpu/nvgpu/include/nvgpu/allocator.h b/drivers/gpu/nvgpu/include/nvgpu/allocator.h index 99998e215..937a28cd8 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/allocator.h @@ -259,6 +259,7 @@ int nvgpu_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, u64 base, u64 length, u64 blk_size, u64 max_order, u64 flags, enum nvgpu_allocator_type alloc_type); +#ifdef CONFIG_NVGPU_FENCE /* * Lockless allocatior initializers. * Note: This allocator can only allocate fixed-size structures of a @@ -267,6 +268,7 @@ int nvgpu_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, const char *name, u64 base, u64 length, u64 blk_size, u64 flags); +#endif #define GPU_BALLOC_MAX_ORDER 63U