diff --git a/drivers/pci/endpoint/functions/pci-epf-wrapper.h b/drivers/pci/endpoint/functions/pci-epf-wrapper.h index 59f21178..5aba24fd 100644 --- a/drivers/pci/endpoint/functions/pci-epf-wrapper.h +++ b/drivers/pci/endpoint/functions/pci-epf-wrapper.h @@ -21,6 +21,7 @@ #ifndef PCI_EPF_WRAPPER_H #define PCI_EPF_WRAPPER_H +#include #include #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) @@ -31,7 +32,7 @@ #define lpci_epf_alloc_space(A, B, C, D) pci_epf_alloc_space(A, B, C, D) #endif -#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 14, 0)) +#if defined(NV_PCI_EPC_WRITE_HEADER_HAS_VFN_ARG) #define lpci_epc_write_header(A, B, C) pci_epc_write_header(A, B, 0, C) #define lpci_epc_raise_irq(A, B, C, D) pci_epc_raise_irq(A, B, 0, C, D) #define lpci_epc_clear_bar(A, B, C) pci_epc_clear_bar(A, B, 0, C) diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index b0edf267..1d6a0b81 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -151,6 +151,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_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 NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epf_alloc_space_has_epc_features_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 466807bd..5bc16638 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7470,6 +7470,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_PCI_EPC_FEATURES_STRUCT_HAS_BAR" "" "types" ;; + pci_epc_write_header_has_vfn_arg) + # + # Determine if the pci_epc_write_header() has the vfn argument or not. + # + # Commit 53fd3cbe5e9d791("PCI: endpoint: Add virtual function number in pci_epc ops" + # added virtual function number as argument in the APIs in Linux 5.14. + # + CODE=" + #include + int conftest_pci_epc_write_header_has_vfn_arg(void) { + return pci_epc_write_header(NULL, 0, 0, NULL); + }" + + compile_check_conftest "$CODE" "NV_PCI_EPC_WRITE_HEADER_HAS_VFN_ARG" "" "types" + ;; + pci_disable_pcie_error_reporting) # # Determine if the pci_disable_pcie_error_reporting() API available or not.