From b04b8c841c8893adeeb661b4fccd1c86265898c6 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 21 Feb 2023 12:23:08 +0000 Subject: [PATCH] firmware: tegra: Disable IVC_EXT driver 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 Tegra IVC extended driver build to fail. Temporarily disable the building of this driver while this build issue is fixed. Stub functions are added to permit other drivers that use this driver to build. Bug 3936429 Bug 3974855 Change-Id: I300ed321afdd805838b51144fe98ba76b922493b Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2861309 Reviewed-by: Rohit Khanna Tested-by: Rohit Khanna GVS: Gerrit_Virtual_Submit --- drivers/firmware/tegra/Makefile | 8 ++++- include/soc/tegra/ivc_ext.h | 63 ++++++++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/tegra/Makefile b/drivers/firmware/tegra/Makefile index a9ce2ba0..cdf46dd2 100644 --- a/drivers/firmware/tegra/Makefile +++ b/drivers/firmware/tegra/Makefile @@ -1,11 +1,17 @@ # SPDX-License-Identifier: GPL-2.0 -# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Makefile for Extended IVC Driver and BPMP driver # +LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL)) +LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2) + +# ivc_ext 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) obj-m += ivc_ext.o +endif tegra_bpmp-y += ../../clk/tegra/clk-bpmp.o tegra_bpmp-y += ../../reset/tegra/reset-bpmp.o tegra_bpmp-y += ../../soc/tegra/powergate-bpmp.o diff --git a/include/soc/tegra/ivc_ext.h b/include/soc/tegra/ivc_ext.h index d005515b..91aac1d0 100644 --- a/include/soc/tegra/ivc_ext.h +++ b/include/soc/tegra/ivc_ext.h @@ -1,14 +1,16 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #ifndef __TEGRA_IVC_EXT_H #define __TEGRA_IVC_EXT_H #include +#include #include +#if (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) /** * tegra_ivc_channel_notified - notifies the peer device * @ivc pointer of the IVC channel @@ -116,5 +118,64 @@ int tegra_ivc_read_peek(struct tegra_ivc *ivc, void __user *usr_buf, void *buf, * Returns no. of bytes written to ivc channel else return error. */ int tegra_ivc_write(struct tegra_ivc *ivc, const void __user *usr_buf, const void *buf, size_t size); +#else +static inline int tegra_ivc_channel_notified(struct tegra_ivc *ivc) +{ + return -ENOTSUPP; +} + +static inline void tegra_ivc_channel_reset(struct tegra_ivc *ivc) +{ + return; +} + +static inline bool tegra_ivc_empty(struct tegra_ivc *ivc, + struct tegra_ivc_header *header) +{ + return true; +} + +static inline int tegra_ivc_channel_sync(struct tegra_ivc *ivc) +{ + return -ENOTSUPP; +} + +static inline uint32_t tegra_ivc_frames_available(struct tegra_ivc *ivc, + struct tegra_ivc_header *header) +{ + return 0; +} + +static inline int tegra_ivc_can_read(struct tegra_ivc *ivc) +{ + return -ENOTSUPP; +}; + +static inline int tegra_ivc_can_write(struct tegra_ivc *ivc) +{ + return -ENOTSUPP; +}; + +static inline int tegra_ivc_read(struct tegra_ivc *ivc, void __user *usr_buf, + void *buf, size_t max_read) +{ + return -ENOTSUPP; +} + +static inline int tegra_ivc_read_peek(struct tegra_ivc *ivc, + void __user *usr_buf, void *buf, + size_t offset, size_t size) +{ + return -ENOTSUPP; +}; + +static inline int tegra_ivc_write(struct tegra_ivc *ivc, + const void __user *usr_buf, + const void *buf, size_t size) +{ + return -ENOTSUPP; +}; + +#endif /* (KERNEL_VERSION(6, 2, 0) > LINUX_VERSION_CODE) */ #endif /* __TEGRA_IVC_EXT_H */