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

@@ -1631,7 +1631,8 @@ static void tvnet_ep_pci_epf_linkup(struct pci_epf *epf)
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0))
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT)
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_DEINIT) || \
defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Linux v6.11 || Nvidia Internal */
static int tvnet_ep_pci_epf_core_deinit(struct pci_epf *epf)
{
struct pci_epf_bar *epf_bar = &epf->bar[BAR_0];
@@ -1647,11 +1648,24 @@ static int tvnet_ep_pci_epf_core_deinit(struct pci_epf *epf)
return 0;
}
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_DEINIT)
static void tvnet_ep_pci_epf_epc_deinit(struct pci_epf *epf)
{
WARN_ON(tvnet_ep_pci_epf_core_deinit(epf));
}
#endif
#endif
static const struct pci_epc_event_ops tvnet_event_ops = {
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_INIT) /* Linux v6.11 */
.epc_init = tvnet_ep_pci_epf_core_init,
#else
.core_init = tvnet_ep_pci_epf_core_init,
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT)
#endif
#if defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_EPC_DEINIT) /* Linux v6.11 */
.epc_deinit = tvnet_ep_pci_epf_epc_deinit,
#elif defined(NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT) /* Nvidia Internal */
.core_deinit = tvnet_ep_pci_epf_core_deinit,
#endif
.link_up = tvnet_ep_pci_epf_linkup,