hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10302 -------------------------------- CONFIG_PCI_P2PDMA adds a pointer to struct pci_dev in the middle of the structure. That changes the layout and the genksyms checksums of every exported symbol that references struct pci_dev, so enabling the option on x86 for the NDS driver would break kABI. Store the pointer in KABI_RESERVE(1) instead on x86. The reserve is a u64 and the pointer is 8 bytes on 64-bit, so the structure size and all existing member offsets stay the same whether the option is enabled or not, and KABI_USE hides the change from genksyms. arm64 already enables CONFIG_PCI_P2PDMA and its kABI baseline has the field in the original position, so keep that position on non-x86 architectures and use the reserve slot only on x86. Enable CONFIG_PCI_P2PDMA in the x86 defconfig for the NDS driver. Signed-off-by: Zizhi Wo <wozizhi@huawei.com> --- arch/x86/configs/openeuler_defconfig | 2 +- include/linux/pci.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index 0400d0f3b1bc..c0426df4a784 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -2086,11 +2086,11 @@ CONFIG_PCI_ATS=y CONFIG_PCI_DOE=y CONFIG_PCI_LOCKLESS_CONFIG=y CONFIG_PCI_IOV=y CONFIG_PCI_PRI=y CONFIG_PCI_PASID=y -# CONFIG_PCI_P2PDMA is not set +CONFIG_PCI_P2PDMA=y CONFIG_PCI_LABEL=y CONFIG_PCI_HYPERV=m CONFIG_VGA_ARB=y CONFIG_VGA_ARB_MAX_GPUS=64 CONFIG_HOTPLUG_PCI=y diff --git a/include/linux/pci.h b/include/linux/pci.h index e4414efab05d..334d7767ff54 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -512,11 +512,16 @@ struct pci_dev { #endif #ifdef CONFIG_PCI_PASID u16 pasid_cap; /* PASID Capability offset */ u16 pasid_features; #endif -#ifdef CONFIG_PCI_P2PDMA +/* + * The x86 kABI baseline was built without CONFIG_PCI_P2PDMA and keeps the + * pointer in a reserve slot instead. arm64 already has the option enabled + * with the field in the upstream position, so keep that position there. + */ +#if IS_ENABLED(CONFIG_PCI_P2PDMA) && !IS_ENABLED(CONFIG_X86) struct pci_p2pdma __rcu *p2pdma; #endif #ifdef CONFIG_PCI_DOE struct xarray doe_mbs; /* Data Object Exchange mailboxes */ #endif @@ -534,11 +539,15 @@ struct pci_dev { * is being removed or rescanned, this flag is set. */ unsigned long slot_being_removed_rescanned; struct pci_dev *rpdev; /* root port pci_dev */ +#if IS_ENABLED(CONFIG_PCI_P2PDMA) && IS_ENABLED(CONFIG_X86) + KABI_USE(1, struct pci_p2pdma __rcu *p2pdma) +#else KABI_RESERVE(1) +#endif KABI_RESERVE(2) KABI_RESERVE(3) KABI_RESERVE(4) KABI_RESERVE(5) KABI_RESERVE(6) -- 2.52.0