diff --git a/Makefile b/Makefile index 3905a5e5..de4f6b10 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,6 @@ LINUXINCLUDE += -I$(srctree.nvidia-oot)/include subdir-ccflags-y += -Werror subdir-ccflags-y += -Wmissing-prototypes -# PCIE DMA EPF core deinit not implemented in core kernel -subdir-ccflags-y += -DNV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE - ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y) subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION endif diff --git a/drivers/misc/nvscic2c-pcie/epf/module.c b/drivers/misc/nvscic2c-pcie/epf/module.c index ca3e4cd0..afd0eecc 100644 --- a/drivers/misc/nvscic2c-pcie/epf/module.c +++ b/drivers/misc/nvscic2c-pcie/epf/module.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only // SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +#include + #define pr_fmt(fmt) "nvscic2c-pcie: epf: " fmt #include @@ -169,7 +171,7 @@ allocate_outbound_area(struct pci_epf *epf, size_t win_size, return ret; } -#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE) +#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */ static void clear_inbound_translation(struct pci_epf *epf) { @@ -492,7 +494,7 @@ deinit_work(struct work_struct *work) * @DRV_MODE_EPC would have already gone then by the time * struct pci_epc_event_ops.core_deinit is called. */ -#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE) +#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */ static int nvscic2c_pcie_epf_core_deinit(struct pci_epf *epf) { @@ -733,7 +735,7 @@ get_driverdata(const struct pci_epf_device_id *id, static const struct pci_epc_event_ops nvscic2c_event_ops = { .core_init = nvscic2c_pcie_epf_core_init, -#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE) +#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */ .core_deinit = nvscic2c_pcie_epf_core_deinit, #endif }; diff --git a/drivers/pci/endpoint/functions/pci-epf-dma-test.c b/drivers/pci/endpoint/functions/pci-epf-dma-test.c index 8a7bb58a..477ace80 100644 --- a/drivers/pci/endpoint/functions/pci-epf-dma-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-dma-test.c @@ -5,6 +5,8 @@ * Copyright (C) 2021-2024 NVIDIA Corporation. All rights reserved. */ +#include + #include #include #include @@ -168,7 +170,7 @@ static int pcie_dma_epf_core_init(struct pci_epf *epf) return 0; } -#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE) +#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */ static int pcie_dma_epf_core_deinit(struct pci_epf *epf) { struct pcie_epf_dma *epfnv = epf_get_drvdata(epf); @@ -269,7 +271,7 @@ static const struct pci_epf_device_id pcie_dma_epf_ids[] = { static const struct pci_epc_event_ops pci_epf_dma_test_event_ops = { .core_init = pcie_dma_epf_core_init, -#if !defined(NV_PCIE_DMA_EPF_CORE_DEINIT_NOT_AVAILABLE) +#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */ .core_deinit = pcie_dma_epf_core_deinit, #endif }; diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index fb6ff49f..cfd7f047 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -142,6 +142,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_disable_pcie_error_reporting NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_enable_pcie_error_reporting NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epf_driver_struct_probe_has_id_arg +NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_irq_type_enum_present NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 7e9393b0..3ef496ce 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7351,6 +7351,23 @@ compile_test() { compile_check_conftest "$CODE" "PCI_EPC_IRQ_TYPE_ENUM_PRESENT" "" "types" ;; + + pci_epc_event_ops_struct_has_core_deinit) + # + # Determine if the pci_epc_event_ops struct has the core_deinit function. + # + # Added by commit 3d99b5acdd3191c ("NVIDIA: SAUCE: PCI: endpoint: Add core_deinit() + # callback support") from Nvidia PCI improvement. + # + CODE=" + #include + int conftest_pci_epc_event_ops_struct_has_core_deinit(void) { + return offsetof(struct pci_epc_event_ops, core_deinit); + }" + + compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT" "" "types" + ;; + register_shrinker_has_fmt_arg) # # Determine if the 'register_shrinker' function