virt: tegra: Ensure functions stubs are defined

When building the out-of-tree drivers with virtualization support
disabled, symbols for some of the virtualization functions are not found
...

 nvgpu: Unknown symbol tegra_hv_mempool_unreserve (err -2)
 nvgpu: Unknown symbol is_tegra_hypervisor_mode (err -2)
 nvgpu: Unknown symbol tegra_hv_mempool_reserve (err -2)
 nvhost_pva: Unknown symbol is_tegra_hypervisor_mode (err -2)
 mc_utils: Unknown symbol is_tegra_hypervisor_mode (err -2)
 mc_utils: Unknown symbol is_tegra_hypervisor_mode (err -2)

Update the hv-ivc.h header to ensure that these function stubs are
defined when virtualization support is disabled and only build the
hv-ivc driver if virtualization is enabled.

Finally, move populating the ccflags to the top-level Makefile and use
the subdir-ccflags directive to ensure the ccflags are passed to all
sub-directories.

Bug 4159372
Bug 4170085

Change-Id: I35edb91007524c3143dff7564f9ad545bd34e969
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921199
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-06-14 11:59:42 +01:00
committed by mobile promotions
parent e3e15a3cb1
commit deffbf24ab
6 changed files with 13 additions and 13 deletions

View File

@@ -1,8 +1,12 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
LINUXINCLUDE += -I$(srctree.nvidia-oot)/include LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION
endif
obj-m += drivers/ obj-m += drivers/
ifdef CONFIG_SOUND ifdef CONFIG_SOUND

View File

@@ -7,8 +7,4 @@
ccflags-y += -I$(PWD) ccflags-y += -I$(PWD)
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION
endif
obj-m += nvsciipc.o obj-m += nvsciipc.o

View File

@@ -3,14 +3,10 @@
GCOV_PROFILE := y GCOV_PROFILE := y
subdir-ccflags-y := -Werror subdir-ccflags-y += -Werror
include $(srctree.nvidia-oot)/drivers/video/tegra/nvmap/Makefile.memory.configs include $(srctree.nvidia-oot)/drivers/video/tegra/nvmap/Makefile.memory.configs
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION
endif
ifeq ($(NVMAP_CONFIG), y) ifeq ($(NVMAP_CONFIG), y)
# Build NvMap only when NVMAP_CONFIG is set to y # Build NvMap only when NVMAP_CONFIG is set to y
nvmap-y := nvmap_core.o \ nvmap-y := nvmap_core.o \

View File

@@ -10,8 +10,10 @@ LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2)
# tegra_hv is currently broken for Linux v6.2 and so skip for Linux v6.2+ # tegra_hv is currently broken for Linux v6.2 and so skip for Linux v6.2+
ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_2); echo $$?),0) ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_2); echo $$?),0)
ifdef CONFIG_TEGRA_VIRTUALIZATION
obj-m += tegra_hv.o obj-m += tegra_hv.o
endif endif
endif
obj-m += tegra_hv_pm_ctl.o obj-m += tegra_hv_pm_ctl.o
obj-m += hvc_sysfs.o obj-m += hvc_sysfs.o
obj-m += ivc-cdev.o obj-m += ivc-cdev.o

View File

@@ -32,7 +32,7 @@ struct tegra_hv_ivm_cookie {
void *reserved; void *reserved;
}; };
#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) #if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) && defined(CONFIG_TEGRA_VIRTUALIZATION)
bool is_tegra_hypervisor_mode(void); bool is_tegra_hypervisor_mode(void);
/** /**
@@ -451,6 +451,8 @@ static inline struct tegra_ivc *tegra_hv_ivc_convert_cookie(
{ {
return ERR_PTR(-ENOTSUPP); return ERR_PTR(-ENOTSUPP);
}; };
#endif /* (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) */ #endif /* (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) &&
* defined(CONFIG_TEGRA_VIRTUALIZATION)
*/
#endif /* __TEGRA_HV_IVC_H */ #endif /* __TEGRA_HV_IVC_H */

View File

@@ -3,7 +3,7 @@
GCOV_PROFILE := y GCOV_PROFILE := y
subdir-ccflags-y := -Werror subdir-ccflags-y += -Werror
ccflags-y += -I$(overlay)/$(src)/../tegra-virt-alt/include/ ccflags-y += -I$(overlay)/$(src)/../tegra-virt-alt/include/
ccflags-y += -I$(overlay)/$(src)/../codecs ccflags-y += -I$(overlay)/$(src)/../codecs
ccflags-y += -I$(srctree.nvidia-oot)/sound/soc/tegra-virt-alt/nvaudio_ivc/ ccflags-y += -I$(srctree.nvidia-oot)/sound/soc/tegra-virt-alt/nvaudio_ivc/