From d449f6cfd69371ca59ec49fbe681c019af9264e9 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Thu, 6 Jun 2024 11:39:08 +0100 Subject: [PATCH] PCI: EPF: dma-test: Fix build for Linux v6.10 In Linux v6.10, the 'core_init_notifier' flag has been removed and dw_pcie_ep_init_notify() is now called by the designware endpoint driver so it is not necessary to call from the EPF DMA test driver. Add a test to the conftest script to detect the presence of the 'core_init_notifier' flag and update the EPF DMA test driver as necessary. Bug 4593750 Change-Id: I1c3862df2c673fcb2d7c19ebbf5e7d1cbdefea1f Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3152309 Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../pci/endpoint/functions/pci-epf-dma-test.c | 5 +++-- scripts/conftest/Makefile | 1 + scripts/conftest/conftest.sh | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-dma-test.c b/drivers/pci/endpoint/functions/pci-epf-dma-test.c index c4a6aa0f..44efac32 100644 --- a/drivers/pci/endpoint/functions/pci-epf-dma-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-dma-test.c @@ -454,17 +454,18 @@ static int pcie_dma_epf_bind(struct pci_epf *epf) goto fail_get_features; } +#if defined(NV_PCI_EPC_FEATURES_STRUCT_HAS_CORE_INIT_NOTIFIER) if (!epc_features->core_init_notifier) { ret = pcie_dma_epf_core_init(epf); if (ret) { dev_err(fdev, "EPF core init failed with err: %d\n", ret); - goto fail_core_init; + goto fail_get_features; } } +#endif return 0; -fail_core_init: fail_get_features: debugfs_remove_recursive(epfnv->debugfs); if (epfnv->chip_id == TEGRA264) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index afd86e1a..6b0e81c2 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -153,6 +153,7 @@ 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_event_ops_struct_has_core_deinit NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_features_struct_has_bar +NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_features_struct_has_core_init_notifier NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_write_header_has_vfn_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_disable_pcie_error_reporting NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_enable_pcie_error_reporting diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 07b04f61..0fc79f67 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7517,6 +7517,23 @@ compile_test() { compile_check_conftest "$CODE" "NV_PCI_EPC_FEATURES_STRUCT_HAS_BAR" "" "types" ;; + pci_epc_features_struct_has_core_init_notifier) + # + # Determine if the pci_epc_features struct has a member 'core_init_notifier'. + # + # Commit a01e7214bef9 ("PCI: endpoint: Remove "core_init_notifier" flag") + # removed the flag 'core_init_notifier' from the pci_epc_features structure + # in Linux v6.10. + # + CODE=" + #include + int conftest_pci_epc_features_struct_has_core_init_notifier(void) { + return offsetof(struct pci_epc_features, core_init_notifier); + }" + + compile_check_conftest "$CODE" "NV_PCI_EPC_FEATURES_STRUCT_HAS_CORE_INIT_NOTIFIER" "" "types" + ;; + pci_epc_write_header_has_vfn_arg) # # Determine if the pci_epc_write_header() has the vfn argument or not.