From bf46060d1efde564bb7f8ccb5d3929c0840d55ac Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 5 Dec 2023 18:07:41 +0000 Subject: [PATCH] pci: Use conftest to find if pci_enable_pcie_error_reporting() present Use conftest to find if API pci_enable_pcie_error_reporting() is present. This API is dropped from Linux 6.5 with change commit 7ec4b34be42345 ("PCI/AER: Unexport pci_enable_pcie_error_reporting()") Bug 4346767 Change-Id: Ib0037544b4480b37c0ed6ac8b9ef9aef6ae82619 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028742 Reviewed-by: Shardar Mohammed GVS: Gerrit_Virtual_Submit --- Makefile | 3 --- drivers/misc/nvscic2c-pcie/epc/module.c | 2 +- drivers/misc/tegra-pcie-dma-test.c | 4 +++- drivers/net/ethernet/nvidia/pcie/tegra_vnet.c | 2 +- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 17 +++++++++++++++++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8c7e05b1..2c5cc5ce 100644 --- a/Makefile +++ b/Makefile @@ -49,9 +49,6 @@ subdir-ccflags-y += -DNV_V4L2_ASYNC_MATCH_FWNODE_RENAME # Rename async_nf_init and v4l2_async_subdev_nf_register subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME -# Deprecate PCIED Error reporting pci_enable_pcie_error_reporting -subdir-ccflags-y += -DNV_DROP_PCIE_ERROR_REPORTING - # PCIE EPF driver probe has additional argument as ID subdir-ccflags-y += -DNV_PCIE_EFP_DRIVER_PROBE_HAS_ID_ARG diff --git a/drivers/misc/nvscic2c-pcie/epc/module.c b/drivers/misc/nvscic2c-pcie/epc/module.c index cd6ffb64..78c7b164 100644 --- a/drivers/misc/nvscic2c-pcie/epc/module.c +++ b/drivers/misc/nvscic2c-pcie/epc/module.c @@ -354,7 +354,7 @@ nvscic2c_pcie_epc_probe(struct pci_dev *pdev, ret = pcim_enable_device(pdev); if (ret) goto err_enable_device; -#if !defined(NV_DROP_PCIE_ERROR_REPORTING) +#if defined(NV_PCI_ENABLE_PCIE_ERROR_REPORTING_PRESENT) /* Linux 6.5 */ pci_enable_pcie_error_reporting(pdev); #endif pci_set_master(pdev); diff --git a/drivers/misc/tegra-pcie-dma-test.c b/drivers/misc/tegra-pcie-dma-test.c index b6d693bc..7dea5be0 100644 --- a/drivers/misc/tegra-pcie-dma-test.c +++ b/drivers/misc/tegra-pcie-dma-test.c @@ -5,6 +5,8 @@ * Copyright (C) 2021-2023 NVIDIA Corporation. All rights reserved. */ +#include + #include #include #include @@ -170,7 +172,7 @@ static int ep_test_dma_probe(struct pci_dev *pdev, return ret; } -#if !defined(NV_DROP_PCIE_ERROR_REPORTING) +#if defined(NV_PCI_ENABLE_PCIE_ERROR_REPORTING_PRESENT) /* Linux 6.5 */ pci_enable_pcie_error_reporting(pdev); #endif diff --git a/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c b/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c index 6b5d9b53..05fc4e5d 100644 --- a/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c +++ b/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c @@ -749,7 +749,7 @@ static int tvnet_host_probe(struct pci_dev *pdev, goto free_netdev; } -#if !defined(NV_DROP_PCIE_ERROR_REPORTING) +#if defined(NV_PCI_ENABLE_PCIE_ERROR_REPORTING_PRESENT) /* Linux 6.5 */ pci_enable_pcie_error_reporting(pdev); #endif diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index 7cf1c43d..10336a12 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -128,6 +128,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit 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 += register_shrinker_has_fmt_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index c22cb6f4..052f153c 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7050,6 +7050,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_PCI_DISABLE_PCIE_ERROR_REPORTING_PRESENT" "" "functions" ;; + pci_enable_pcie_error_reporting) + # + # Determine if the pci_enable_pcie_error_reporting() API available. + # + # API pci_enable_pcie_error_reporting() is dropped from Linux 6.5 + # with commit 7ec4b34be42345 ("PCI/AER: Unexport + # pci_disable_pcie_error_reporting()") + # + CODE=" + #include + void conftest_pci_enable_pcie_error_reporting(void) { + pci_enable_pcie_error_reporting(); + }" + + compile_check_conftest "$CODE" "NV_PCI_ENABLE_PCIE_ERROR_REPORTING_PRESENT" "" "functions" + ;; + register_shrinker_has_fmt_arg) # # Determine if the 'register_shrinker' function