From 7881a907e573a79cadc7c3e8445fc43e2e9f2dff Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 21 Feb 2023 15:11:49 +0000 Subject: [PATCH] drivers/misc/mods: Disable broken MODS drivers for Linux v6.2+ Upstream Linux commit 4c1e0a97351a ("firmware: tegra: bpmp: Use iosys-map helpers") updated the Tegra IVC driver to use the iosys-map helpers for Linux v6.2. This causes the MODS BPMPIPC driver build to fail. Upstream Linux commit 55bf84fd0a76 ("firmware: arm_ffa: Remove ffa_dev_ops_get()") removes the function ffa_dev_ops_get() and this causes the MODS FFA driver build to fail. Temporarily disable the building of these drivers while these build issues are fixed. Bug 3936429 Bug 3974855 Change-Id: I1b40bbb4b89fe0c8d4af7fc642664d29d6954ed2 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2861317 Tested-by: Rohit Khanna Reviewed-by: Rohit Khanna Reviewed-by: svc_kernel_abi Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert GVS: Gerrit_Virtual_Submit --- drivers/misc/mods/Makefile | 7 +++++++ drivers/misc/mods/mods_krnl.c | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/misc/mods/Makefile b/drivers/misc/mods/Makefile index 4d9132a0..12af1408 100644 --- a/drivers/misc/mods/Makefile +++ b/drivers/misc/mods/Makefile @@ -3,6 +3,9 @@ ccflags-y += -I$(srctree.nvidia)/include ccflags-y += -DMODS_HAS_TEGRA +LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL)) +LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2) + ifeq ($(CONFIG_TEGRA_OOT_MODULE),m) CONFIG_MODS := m endif @@ -15,8 +18,12 @@ mods-y += mods_mem.o mods-$(CONFIG_ACPI) += mods_acpi.o mods-$(CONFIG_TEGRA_NVADSP) += mods_adsp.o +# mods_arm_ffa and mods_bpmpipc are 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) mods-$(CONFIG_ARM_FFA_TRANSPORT) += mods_arm_ffa.o mods-$(CONFIG_TEGRA_IVC) += mods_bpmpipc.o +endif mods-$(CONFIG_COMMON_CLK) += mods_clock.o mods-$(CONFIG_DEBUG_FS) += mods_debugfs.o mods-$(CONFIG_DMA_ENGINE) += mods_dma.o diff --git a/drivers/misc/mods/mods_krnl.c b/drivers/misc/mods/mods_krnl.c index a6862152..975de0ff 100644 --- a/drivers/misc/mods/mods_krnl.c +++ b/drivers/misc/mods/mods_krnl.c @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef MODS_HAS_CONSOLE_LOCK # include # include @@ -488,9 +489,11 @@ static int __init mods_init_module(void) #endif #if defined(CONFIG_ARM_FFA_TRANSPORT) +#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) rc = mods_ffa_abi_register(); if (rc < 0) mods_warning_printk("error on mods_ffa_abi_register returned %d\n", rc); +#endif #endif mods_info_printk("*** WARNING: DIAGNOSTIC DRIVER LOADED ***\n"); @@ -534,7 +537,9 @@ static void __exit mods_exit_module(void) #endif #if defined(CONFIG_ARM_FFA_TRANSPORT) +#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) mods_ffa_abi_unregister(); +#endif #endif mods_info_printk("driver unloaded\n"); @@ -1035,7 +1040,9 @@ static int mods_krnl_close(struct inode *ip, struct file *fp) #endif #if defined(CONFIG_TEGRA_IVC) +#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) mods_bpmpipc_cleanup(); +#endif #endif mods_disable_all_devices(client); @@ -2660,9 +2667,11 @@ static long mods_krnl_ioctl(struct file *fp, #endif #if defined(CONFIG_ARM_FFA_TRANSPORT) +#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) case MODS_ESC_FFA_CMD: MODS_IOCTL(MODS_ESC_FFA_CMD, esc_mods_arm_ffa_cmd, MODS_FFA_PARAMS); break; +#endif #endif case MODS_ESC_ACQUIRE_ACCESS_TOKEN: @@ -2735,11 +2744,13 @@ static long mods_krnl_ioctl(struct file *fp, break; #ifdef CONFIG_TEGRA_IVC +#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) case MODS_ESC_BPMP_UPHY_LANE_EOM_SCAN: MODS_IOCTL(MODS_ESC_BPMP_UPHY_LANE_EOM_SCAN, esc_mods_bpmp_uphy_lane_eom_scan, MODS_BPMP_UPHY_LANE_EOM_SCAN_PARAMS); break; +#endif #endif default: