From 94a8f3ce28409c90ecedec853ebce09fd7bfec16 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Fri, 10 May 2019 14:11:26 +0530 Subject: [PATCH] gpu: nvgpu: consolidate the makefile config setup Since the safety build config options for qnx build are to be adhered by posix userspace build as well, let us create shared configs file. Add these config options to unit tests makefile as we would need to control the tests based on these options and tests also access the common nvgpu functions. JIRA NVGPU-3062 Change-Id: I292eca9ac3160eed93485afddf7c30e993e0461c Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/2116401 GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/Makefile.shared.configs | 41 +++++++++++++++++++++++ drivers/gpu/nvgpu/Makefile.tmk | 17 +--------- userspace/Makefile.tmk | 4 ++- userspace/units/Makefile.units.common.tmk | 4 +++ 4 files changed, 49 insertions(+), 17 deletions(-) create mode 100644 drivers/gpu/nvgpu/Makefile.shared.configs diff --git a/drivers/gpu/nvgpu/Makefile.shared.configs b/drivers/gpu/nvgpu/Makefile.shared.configs new file mode 100644 index 000000000..38ffe457e --- /dev/null +++ b/drivers/gpu/nvgpu/Makefile.shared.configs @@ -0,0 +1,41 @@ +# +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# + +ifeq ($(NVGPU_REDUCED), 0) +# Enable debugger APIs for normal builds +NVGPU_DEBUGGER := 1 +# Enable iGPU LS PMU for normal builds +NVGPU_LS_PMU := 1 +NV_COMPONENT_CFLAGS += -DNVGPU_DEBUGGER +NV_COMPONENT_CFLAGS += -DNVGPU_LS_PMU +NV_COMPONENT_CFLAGS += -DNVGPU_ENGINE +NV_COMPONENT_CFLAGS += -DNVGPU_USERD +# Support iGPU Virt for normal builds +IGPU_VIRT_SUPPORT := 1 +NV_COMPONENT_CFLAGS += -DIGPU_VIRT_SUPPORT +# Enable dgpu support for normal builds +NVGPU_DGPU_SUPPORT := 1 +NV_COMPONENT_CFLAGS += -DNVGPU_DGPU_SUPPORT +else +# Enable USERD until we switch to user mode submit only +NV_COMPONENT_CFLAGS += -DNVGPU_USERD +endif diff --git a/drivers/gpu/nvgpu/Makefile.tmk b/drivers/gpu/nvgpu/Makefile.tmk index 9000e0599..7d8d0b693 100644 --- a/drivers/gpu/nvgpu/Makefile.tmk +++ b/drivers/gpu/nvgpu/Makefile.tmk @@ -60,22 +60,7 @@ NV_COMPONENT_CFLAGS += \ -DCONFIG_PCI_MSI \ -DCONFIG_TEGRA_NVLINK -ifeq ($(NVGPU_REDUCED), 0) -# Enable debugger APIs for normal builds -NVGPU_DEBUGGER := 1 -# Enable iGPU LS PMU for normal builds -NVGPU_LS_PMU := 1 -NV_COMPONENT_CFLAGS += -DNVGPU_DEBUGGER -NV_COMPONENT_CFLAGS += -DNVGPU_LS_PMU -NV_COMPONENT_CFLAGS += -DNVGPU_ENGINE -NV_COMPONENT_CFLAGS += -DNVGPU_USERD -# Support iGPU Virt for normal builds -IGPU_VIRT_SUPPORT := 1 -NV_COMPONENT_CFLAGS += -DIGPU_VIRT_SUPPORT -else -# Enable USERD until we switch to user mode submit only -NV_COMPONENT_CFLAGS += -DNVGPU_USERD -endif +-include $(NV_COMPONENT_DIR)/Makefile.shared.configs NVGPU_FAULT_INJECTION_ENABLEMENT := 1 NV_COMPONENT_CFLAGS += -DNVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT diff --git a/userspace/Makefile.tmk b/userspace/Makefile.tmk index 2475e11ac..d3bb3c61e 100644 --- a/userspace/Makefile.tmk +++ b/userspace/Makefile.tmk @@ -56,7 +56,6 @@ NV_COMPONENT_SYSTEM_SHARED_LIBRARIES += dl NV_COMPONENT_SYSTEM_SHARED_LIBRARIES += gcov endif -NV_COMPONENT_CFLAGS += -D__NVGPU_POSIX__ _NV_TOOLCHAIN_CFLAGS += -rdynamic NV_UNIT_SH=unit.sh @@ -109,6 +108,7 @@ NV_COMPONENT_SYSTEM_SHARED_LIBRARIES += dl endif NV_COMPONENT_CFLAGS += -D__NVGPU_POSIX__ +NVGPU_REDUCED := 1 NV_COMPONENT_CFLAGS += \ -DCONFIG_TEGRA_19x_GPU \ @@ -128,6 +128,8 @@ NV_COMPONENT_CFLAGS += \ -DCONFIG_TEGRA_NVLINK \ -DNVGPU_UNITTEST_FAULT_INJECTION_ENABLEMENT +-include ../drivers/gpu/nvgpu/Makefile.shared.configs + NV_COMPONENT_SYSTEMIMAGE_DIR := $(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR)/nvgpu_unit/ systemimage:: $(NV_COMPONENT_SYSTEMIMAGE_DIR) $(NV_COMPONENT_SYSTEMIMAGE_DIR) : $(NV_SYSTEMIMAGE_TEST_EXECUTABLE_DIR) diff --git a/userspace/units/Makefile.units.common.tmk b/userspace/units/Makefile.units.common.tmk index 6052d9828..7534d7ba3 100644 --- a/userspace/units/Makefile.units.common.tmk +++ b/userspace/units/Makefile.units.common.tmk @@ -53,6 +53,8 @@ else NV_COMPONENT_CFLAGS += -D__NVGPU_POSIX__ endif +NVGPU_REDUCED := 1 + NV_COMPONENT_CFLAGS += \ -DCONFIG_TEGRA_19x_GPU \ -DCONFIG_TEGRA_GK20A_NVHOST \ @@ -70,6 +72,8 @@ NV_COMPONENT_CFLAGS += \ -DCONFIG_SUPPORT_PMU_PSTATE \ -DCONFIG_TEGRA_NVLINK +-include $(NV_SOURCE)/kernel/nvgpu/drivers/gpu/nvgpu/Makefile.shared.configs + NV_COMPONENT_NEEDED_INTERFACE_DIRS := \ $(NV_SOURCE)/kernel/nvgpu/userspace