nvidia-oot: Add options to disable drivers

In Linux v6.2, the Tegra IVC driver was updated to support iosys-map and
this breaks building some of the out-of-tree drivers for Linux v6.2+
kernels. In Linux v6.3, the GPIO OF APIs were removed and this breaks
building some of the out-of-tree drivers that use these legacy APIs. For
now the broken drivers are not built for these corresponding kernels.

Instead of checking the kernel version in the Makefile for the
corresponding broken driver, move the kernel version checking to the
top-level Makefile and add CONFIG definitions that can be used the
various Makefiles.

This is also needed for working with 3rd party Linux kernels that may
have upstream backports and need to set these CONFIG variables for their
Linux kernel.

Bug 4221847

Change-Id: I35ee59bccdcdb1be56e4680c453279b421692c6a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996215
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-10-11 13:45:05 +01:00
committed by mobile promotions
parent 4e8ed5f7b7
commit 7f53d7ba3e
7 changed files with 25 additions and 24 deletions

View File

@@ -6,6 +6,22 @@ LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
subdir-ccflags-y += -Werror subdir-ccflags-y += -Werror
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL))
LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2)
LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3)
# The Tegra IVC driver was updated to support iosys-map in Linux v6.2.
# For Linux v6.2 kernels, don't build any drivers that requires this.
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_2); echo $$?),0)
export CONFIG_TEGRA_IVC_LEGACY_DISABLE=y
subdir-ccflags-y += -DCONFIG_TEGRA_IVC_LEGACY_DISABLE
endif
# Legacy GPIO support is removed in Linux v6.3
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_3); echo $$?),0)
export CONFIG_TEGRA_GPIO_LEGACY_DISABLE=y
endif
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y) ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION
endif endif

View File

@@ -5,11 +5,8 @@
# Makefile for Extended IVC Driver and BPMP driver # Makefile for Extended IVC Driver and BPMP driver
# #
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL))
LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2)
obj-m += ivc_ext.o obj-m += ivc_ext.o
ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_2); echo $$?),0) ifneq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y)
tegra_bpmp-y += ../../clk/tegra/clk-bpmp.o tegra_bpmp-y += ../../clk/tegra/clk-bpmp.o
tegra_bpmp-y += ../../reset/tegra/reset-bpmp.o tegra_bpmp-y += ../../reset/tegra/reset-bpmp.o
tegra_bpmp-y += ../../soc/tegra/powergate-bpmp.o tegra_bpmp-y += ../../soc/tegra/powergate-bpmp.o
@@ -17,4 +14,3 @@ tegra_bpmp-$(CONFIG_DEBUG_FS) += bpmp-debugfs.o
tegra_bpmp-y += bpmp-tegra186-hv.o tegra_bpmp-y += bpmp-tegra186-hv.o
obj-m += tegra_bpmp.o obj-m += tegra_bpmp.o
endif endif

View File

@@ -1,11 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL)) ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3)
# cdi_gpio/mgr is currently broken for Linux v6.3 and so skip for Linux v6.3+
ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_3); echo $$?),0)
obj-m += cdi_gpio.o obj-m += cdi_gpio.o
obj-m += cdi_mgr.o obj-m += cdi_mgr.o
endif endif

View File

@@ -6,8 +6,7 @@ GCOV_PROFILE := y
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL)) LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL))
LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3) LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3)
# isc_gpio/mgr is currently broken for Linux v6.3 and so skip for Linux v6.3+ ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_3); echo $$?),0)
obj-m += isc_gpio.o obj-m += isc_gpio.o
obj-m += isc_mgr.o obj-m += isc_mgr.o
endif endif

View File

@@ -1,18 +1,16 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. # Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL))
LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3)
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),) ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)
ifneq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y)
obj-m += mods/ obj-m += mods/
endif endif
endif
obj-m += nvsciipc/ obj-m += nvsciipc/
ifdef CONFIG_PCI ifdef CONFIG_PCI
obj-m += tegra-pcie-dma-test.o obj-m += tegra-pcie-dma-test.o
endif endif
# bluedroid_pm is currently broken for Linux v6.3 and so skip for Linux v6.3+ ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_3); echo $$?),0)
obj-m += bluedroid_pm.o obj-m += bluedroid_pm.o
endif endif
obj-m += nvscic2c-pcie/ obj-m += nvscic2c-pcie/

View File

@@ -1,13 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL))
LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2)
ccflags-y += -Wframe-larger-than=2048 ccflags-y += -Wframe-larger-than=2048
# capture-ivc is currently broken for Linux v6.2 and so skip for Linux v6.2+ ifneq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y)
ifeq ($(shell test $(LINUX_VERSION) -lt $(LINUX_VERSION_6_2); echo $$?),0)
obj-m += capture-ivc.o obj-m += capture-ivc.o
endif endif
obj-m += ivc-bus.o obj-m += ivc-bus.o

View File

@@ -9,7 +9,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/version.h> #include <linux/version.h>
#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) #if !defined(CONFIG_TEGRA_IVC_LEGACY_DISABLE)
/** /**
* @brief Submit the control message binary blob to capture-IVC driver, * @brief Submit the control message binary blob to capture-IVC driver,
* which is to be transferred over control IVC channel to RTCPU. * which is to be transferred over control IVC channel to RTCPU.
@@ -187,6 +187,6 @@ static inline int tegra_capture_ivc_unregister_capture_cb(
{ {
return -ENOTSUPP; return -ENOTSUPP;
}; };
#endif /* (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) */ #endif /* !defined(CONFIG_TEGRA_IVC_LEGACY_DISABLE) */
#endif /* INCLUDE_CAPTURE_IVC_H */ #endif /* INCLUDE_CAPTURE_IVC_H */