pci: endpoint: Update drivers for Linux v6.11

For Linux v6.11, the 'pci_epc_event_ops' structure 'core_init' callback
was renamed to 'epc_init' and a new 'epc_deinit' callback was added.

Update the PCI endpoint drivers for Linux v6.11 by:

 1. Adding tests to conftest to detect the presence of 'epc_init' and
    'epc_deinit'.
 2. Update the drivers as necessary to use the appropriate callback
    depending upon what is present in the kernel.

Bug 4749580

Change-Id: Ife7e2d5d18332bf84f22142c9727dc1ece913c49
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3186686
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2024-08-01 19:17:10 +01:00
committed by mobile promotions
parent 6a29330225
commit b0ff4f1358
5 changed files with 86 additions and 8 deletions

View File

@@ -156,6 +156,8 @@ 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_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
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

View File

@@ -7578,6 +7578,39 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT" "" "types"
;;
pci_epc_event_ops_struct_has_epc_deinit)
#
# Determine if the pci_epc_event_ops struct has the epc_deinit function.
#
# Commit 473b2cf9c4d1 ("PCI: endpoint: Introduce 'epc_deinit' event and
# notify the EPF drivers) added 'epc_deinit' callback in Linux v6.11.
#
CODE="
#include <linux/pci-epf.h>
int conftest_pci_epc_event_ops_struct_has_epc_deinit(void) {
return offsetof(struct pci_epc_event_ops, epc_deinit);
}"
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_DEINIT" "" "types"
;;
pci_epc_event_ops_struct_has_epc_init)
#
# Determine if the pci_epc_event_ops struct has the epc_init function.
#
# Commit 4edd7dc82bd6 ("PCI: endpoint: Rename core_init() callback in
# 'struct pci_epc_event_ops' to epc_init()") renamed core_init()
# in Linux v6.11.
#
CODE="
#include <linux/pci-epf.h>
int conftest_pci_epc_event_ops_struct_has_epc_init(void) {
return offsetof(struct pci_epc_event_ops, epc_init);
}"
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_INIT" "" "types"
;;
pci_epc_features_struct_has_bar)
#
# Determine if the pci_epc_features struct has a member 'bar'.