diff --git a/configs/Makefile.config.jammy-src b/configs/Makefile.config.jammy-src deleted file mode 100644 index 4ae92e39..00000000 --- a/configs/Makefile.config.jammy-src +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - -# Kernel jammy-src specific environment variables to configure the OOT modules - -export NV_OOT_PCIE_T264_SOC_SKIP_BUILD=y -subdir-ccflags-y += -DNV_CONFIG_PCIE_TEGRA_DMA_DISABLE diff --git a/configs/Makefile.config.rhivos-1 b/configs/Makefile.config.rhivos-1 index ee6f5972..cd053974 100644 --- a/configs/Makefile.config.rhivos-1 +++ b/configs/Makefile.config.rhivos-1 @@ -1,12 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only -# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # Kernel RHIVOS-1 specific environment variables to configure the OOT modules export NV_OOT_REALTEK_R8126_SKIP_BUILD=y export NV_OOT_REALTEK_R8168_SKIP_BUILD=y export NV_OOT_REALTEK_RTL8822CE_SKIP_BUILD=y -export NV_OOT_PCIE_T264_SOC_SKIP_BUILD=y export NV_OOT_REALTEK_RTL8852CE_SKIP_BUILD=y export NV_OOT_REALTEK_BTUSB_SKIP_BUILD=y -subdir-ccflags-y += -DNV_CONFIG_PCIE_TEGRA_DMA_DISABLE diff --git a/configs/Makefile.config.stable b/configs/Makefile.config.stable deleted file mode 100644 index e68a13a1..00000000 --- a/configs/Makefile.config.stable +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - -# Kernel stable specific environment variables to configure the OOT modules - -export NV_OOT_PCIE_T264_SOC_SKIP_BUILD=y -subdir-ccflags-y += -DNV_CONFIG_PCIE_TEGRA_DMA_DISABLE diff --git a/drivers/pci/controller/private-soc/Makefile b/drivers/pci/controller/private-soc/Makefile index ebbc9683..d20ebd06 100644 --- a/drivers/pci/controller/private-soc/Makefile +++ b/drivers/pci/controller/private-soc/Makefile @@ -1,23 +1,10 @@ -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: GPL-2.0-only +# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# Set config when build as OOT module. -ifneq ($(NV_OOT_PCIE_T264_SOC_SKIP_BUILD),y) -ifeq ($(CONFIG_TEGRA_OOT_MODULE),m) -CONFIG_PCIE_TEGRA264 := m -CONFIG_PCIE_TEGRA264_EP := m -endif - -obj-$(CONFIG_PCIE_TEGRA264) += pcie-tegra264.o -obj-$(CONFIG_PCIE_TEGRA264_EP) += pcie-tegra264-ep.o - -ifeq ($(CONFIG_TEGRA_OOT_MODULE),m) +obj-m += pcie-tegra264.o +obj-m += pcie-tegra264-ep.o obj-m += tegra-pcie-dma-lib.o tegra-pcie-dma-lib-objs:= tegra-pcie-dma.o \ tegra234-pcie-edma.o \ tegra264-pcie-xdma.o -endif -else -obj-m += pcie-tegra264.o -pcie-tegra264-objs := pcie-tegra-soc-dummy.o -endif diff --git a/drivers/pci/controller/private-soc/pcie-tegra-soc-dummy.c b/drivers/pci/controller/private-soc/pcie-tegra-soc-dummy.c deleted file mode 100644 index c9ebe960..00000000 --- a/drivers/pci/controller/private-soc/pcie-tegra-soc-dummy.c +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - -#include - -/* Dummy implementation for module */ -static int __init pcie_tegra_soc_dummy_init(void) -{ - return 0; -} -device_initcall(pcie_tegra_soc_dummy_init); - -MODULE_AUTHOR("Laxman Dewangan "); -MODULE_DESCRIPTION("PCIE tegra dummy driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/pci/controller/private-soc/pcie-tegra264-ep.c b/drivers/pci/controller/private-soc/pcie-tegra264-ep.c index 44cbb57c..4efa6409 100644 --- a/drivers/pci/controller/private-soc/pcie-tegra264-ep.c +++ b/drivers/pci/controller/private-soc/pcie-tegra264-ep.c @@ -138,6 +138,7 @@ struct tegra264_pcie_ep { static int tegra264_pcie_bpmp_set_ep_state(struct tegra264_pcie_ep *pcie, bool enable) { +#if defined(NV_MRQ_PCIE_REQUEST_STRUCT_PRESENT) struct tegra_bpmp_message msg; struct mrq_pcie_request req; int err; @@ -169,6 +170,9 @@ static int tegra264_pcie_bpmp_set_ep_state(struct tegra264_pcie_ep *pcie, bool e return -EINVAL; return 0; +#else + return -EOPNOTSUPP; +#endif } static void tegra264_pcie_ep_rst_assert(struct tegra264_pcie_ep *pcie) @@ -183,7 +187,11 @@ static void tegra264_pcie_ep_rst_assert(struct tegra264_pcie_ep *pcie) if (pcie->pex_prsnt_gpiod) gpiod_set_value_cansleep(pcie->pex_prsnt_gpiod, 0); +#if defined(NV_PCI_EPC_DEINIT_NOTIFY_PRESENT) /* Linux v6.11 */ pci_epc_deinit_notify(pcie->epc); +#else + dev_WARN(pcie->dev, "kernel does not support pci_epc_deinit_notify!\n"); +#endif ret = readl_poll_timeout(pcie->xal_base + XAL_RC_DEBUG_HB_REG_2, val, val & XAL_RC_DEBUG_HB_REG_2_HB_HIER_IDLE, diff --git a/drivers/pci/controller/private-soc/pcie-tegra264.c b/drivers/pci/controller/private-soc/pcie-tegra264.c index c4b08ebc..45068553 100644 --- a/drivers/pci/controller/private-soc/pcie-tegra264.c +++ b/drivers/pci/controller/private-soc/pcie-tegra264.c @@ -95,6 +95,7 @@ static int tegra264_pcie_parse_dt(struct tegra264_pcie *pcie) static void tegra264_pcie_bpmp_set_rp_state(struct tegra264_pcie *pcie) { +#if defined(NV_MRQ_PCIE_REQUEST_STRUCT_PRESENT) && defined(CMD_PCIE_RP_CONTROLLER_OFF) struct tegra_bpmp_message msg; struct mrq_pcie_request req; int err; @@ -117,6 +118,9 @@ static void tegra264_pcie_bpmp_set_rp_state(struct tegra264_pcie *pcie) if (msg.rx.ret) dev_info(pcie->dev, "PCIe Controller-%d failed to turn off via BPMP with error message %d\r\n", pcie->ctl_id, msg.rx.ret); +#else + dev_err(pcie->dev, "%s not supported!\n", __func__); +#endif } static void tegra264_pcie_init(struct tegra264_pcie *pcie) diff --git a/drivers/pci/controller/private-soc/tegra-pcie-dma.c b/drivers/pci/controller/private-soc/tegra-pcie-dma.c index c8e3c175..e990d001 100644 --- a/drivers/pci/controller/private-soc/tegra-pcie-dma.c +++ b/drivers/pci/controller/private-soc/tegra-pcie-dma.c @@ -19,7 +19,6 @@ struct tegra_pcie_dma_priv { nvpcie_dma_soc_t soc; }; -#ifdef CONFIG_PCIE_TEGRA_DMA irqreturn_t tegra_pcie_dma_irq(int irq, void *cookie) { struct tegra_pcie_dma_priv *prv = (struct tegra_pcie_dma_priv *)cookie; @@ -176,6 +175,5 @@ tegra_pcie_dma_status_t tegra_pcie_dma_deinit(void **cookie) } } EXPORT_SYMBOL_GPL(tegra_pcie_dma_deinit); -#endif MODULE_LICENSE("GPL v2"); diff --git a/include/linux/tegra-pcie-dma.h b/include/linux/tegra-pcie-dma.h index 4d91a9e0..10ebc36b 100644 --- a/include/linux/tegra-pcie-dma.h +++ b/include/linux/tegra-pcie-dma.h @@ -1,7 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - */ +/* SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved. */ #ifndef TEGRA_PCIE_DMA_H #define TEGRA_PCIE_DMA_H @@ -33,11 +31,6 @@ #define TEGRA264_PCIE_DMA_MSI_REMOTE_VEC 5 #endif -#ifndef NV_CONFIG_PCIE_TEGRA_DMA_DISABLE -/** Enable generic PCIe DMA driver */ -#define CONFIG_PCIE_TEGRA_DMA 1 -#endif - /** * @brief typedef to define various values for xfer status passed for dma_complete_t or * (tegra_pcie_dma_submit_xfer()) @@ -222,7 +215,6 @@ struct tegra_pcie_dma_xfer_info { void *priv; }; -#ifdef CONFIG_PCIE_TEGRA_DMA #ifdef DOXYGEN_ICD /** * @dir @@ -403,31 +395,5 @@ bool tegra_pcie_dma_stop(void *cookie); * - DMA HW is stopped. */ tegra_pcie_dma_status_t tegra_pcie_dma_deinit(void **cookie); -#else -static inline tegra_pcie_dma_status_t - tegra_pcie_dma_initialize(struct tegra_pcie_dma_init_info *info, void **cookie) { - return -EOPNOTSUPP; -} - -static inline tegra_pcie_dma_status_t tegra_pcie_dma_set_msi(void *cookie, u64 msi_addr, - u32 msi_data) { - return -EOPNOTSUPP; -} - -static inline tegra_pcie_dma_status_t - tegra_pcie_dma_submit_xfer(void *cookie, struct tegra_pcie_dma_xfer_info *tx_info) { - return -EOPNOTSUPP; -} - -static inline bool tegra_pcie_dma_stop(void *cookie) -{ - return -EOPNOTSUPP; -} - -static inline tegra_pcie_dma_status_t tegra_pcie_dma_deinit(void **cookie) -{ - return -EOPNOTSUPP; -} -#endif #endif //TEGRA_PCIE_DMA_H diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index bbede5b3..9da2d9e8 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -158,6 +158,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_read_c45 NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45 NV_CONFTEST_FUNCTION_COMPILE_TESTS += media_entity_remote_pad NV_CONFTEST_FUNCTION_COMPILE_TESTS += module_import_ns_calls_stringify +NV_CONFTEST_FUNCTION_COMPILE_TESTS += mrq_pcie_request_struct_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += msi_get_virq NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight @@ -174,6 +175,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_base_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_chip_struct_has_struct_device NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_config +NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_deinit_notify NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_epc_deinit NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_epc_init diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 7745ee0a..7b97c2b1 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7796,6 +7796,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_MODULE_IMPORT_NS_CALLS_STRINGIFY" "" "types" ;; + mrq_pcie_request_struct_present) + # + # Determine if the 'struct mrq_pcie_request_req' is present. This + # structure is not available in current upstream Linux kernels and + # so add a test to see if the necessary downstream change is + # present. + # + CODE=" + #include + #include + + static struct mrq_pcie_request req;" + + compile_check_conftest "$CODE" "NV_MRQ_PCIE_REQUEST_STRUCT_PRESENT" "" "symbols" + ;; + no_llseek) # # Determine if the function no_llseek() is present. @@ -7919,6 +7935,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_CONFIG" "" "types" ;; + pci_epc_deinit_notify) + # + # Determine if the function pci_epc_deinit_notify() is present. + # + # In Linux v6.11, commit 473b2cf9c4d1 ("PCI: endpoint: Introduce 'epc_deinit' + # event and notify the EPF drivers") added the function pci_epc_deinit_notify(). + # + CODE=" + #include + void conftest_pci_epc_deinit_notify(void) { + pci_epc_deinit_notify(); + }" + + compile_check_conftest "$CODE" "NV_PCI_EPC_DEINIT_NOTIFY_PRESENT" "" "functions" + ;; + pci_epc_event_ops_struct_has_core_deinit) # # Determine if the pci_epc_event_ops struct has the core_deinit function.