From 7218ef434c9dd9e7408226ffdb2ab61258edec44 Mon Sep 17 00:00:00 2001 From: DuanqiangWen Date: Tue, 21 Nov 2023 23:17:22 +0800 Subject: [PATCH 1/2] Revert "openeuler: pci: workaround multiple functions can be assigned to only one VM" wangxun inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I66W4Y --------------------------------- This reverts commit ed2b7e53c47f2a035a55ab4eae1353633bdb76aa. Signed-off-by: DuanqiangWen --- drivers/net/ethernet/netswift/ngbe/ngbe_type.h | 5 +++++ drivers/net/ethernet/netswift/txgbe/txgbe_type.h | 5 +++++ drivers/pci/quirks.c | 1 - include/linux/pci_ids.h | 2 -- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/netswift/ngbe/ngbe_type.h b/drivers/net/ethernet/netswift/ngbe/ngbe_type.h index bae091ffd6e0..ab175d1292cc 100644 --- a/drivers/net/ethernet/netswift/ngbe/ngbe_type.h +++ b/drivers/net/ethernet/netswift/ngbe/ngbe_type.h @@ -65,6 +65,11 @@ #endif /************ ngbe_register.h ************/ +/* Vendor ID */ +#ifndef PCI_VENDOR_ID_TRUSTNETIC +#define PCI_VENDOR_ID_TRUSTNETIC 0x8088 +#endif + /* Device IDs */ /* copper */ #define NGBE_DEV_ID_EM_TEST 0x0000 diff --git a/drivers/net/ethernet/netswift/txgbe/txgbe_type.h b/drivers/net/ethernet/netswift/txgbe/txgbe_type.h index 9aaca94c6fae..aadab1a21823 100644 --- a/drivers/net/ethernet/netswift/txgbe/txgbe_type.h +++ b/drivers/net/ethernet/netswift/txgbe/txgbe_type.h @@ -89,6 +89,11 @@ #endif /************ txgbe_register.h ************/ +/* Vendor ID */ +#ifndef PCI_VENDOR_ID_TRUSTNETIC +#define PCI_VENDOR_ID_TRUSTNETIC 0x8088 +#endif + /* Device IDs */ #define TXGBE_DEV_ID_SP1000 0x1001 #define TXGBE_DEV_ID_WX1820 0x2001 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 07d057a1970c..8db878c8505d 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4979,7 +4979,6 @@ static const struct pci_dev_acs_enabled { /* because rootcomplex Vendor id is 0x17cd on phytium cpu */ { 0x17cd, PCI_ANY_ID, pci_quirk_xgene_acs }, #endif - { PCI_VENDOR_ID_TRUSTNETIC, PCI_ANY_ID, pci_quirk_mf_endpoint_acs }, { 0 } }; diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index d55f33c423d3..a84dcf49e200 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -3148,8 +3148,6 @@ #define PCI_VENDOR_ID_NCUBE 0x10ff -#define PCI_VENDOR_ID_TRUSTNETIC 0x8088 - #define PCI_VENDOR_ID_PHYTIUM 0x1db7 #endif /* _LINUX_PCI_IDS_H */ -- Gitee From e486387c123c3cfaa31c34fdba7afe3b7cc0ad8c Mon Sep 17 00:00:00 2001 From: DuanqiangWen Date: Tue, 21 Nov 2023 23:18:54 +0800 Subject: [PATCH 2/2] PCI: Add ACS quirk for Wangxun NICs maillist inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I66W4Y Reference: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=a2b9b123ccac913e9f9b80337d687a2fe786a634 ------------------------------------ Wangxun has verified there is no peer-to-peer between functions for the below selection of SFxxx, RP1000 and RP2000 NICS. They may be multi-function devices, but the hardware does not advertise ACS capability. Add an ACS quirk for these devices so the functions can be in independent IOMMU groups. Signed-off-by: DuanqiangWen --- drivers/pci/quirks.c | 22 ++++++++++++++++++++++ include/linux/pci_ids.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 8db878c8505d..31b2a25d8a2c 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4824,6 +4824,26 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags) PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); } +/* + * Wangxun 10G/1G NICs have no ACS capability, and on multi-function + * devices, peer-to-peer transactions are not be used between the functions. + * So add an ACS quirk for below devices to isolate functions. + * SFxxx 1G NICs(em). + * RP1000/RP2000 10G NICs(sp). + */ +static int pci_quirk_wangxun_nic_acs(struct pci_dev *dev, u16 acs_flags) +{ + switch (dev->device) { + case 0x0100 ... 0x010F: + case 0x1001: + case 0x2001: + return pci_acs_ctrl_enabled(acs_flags, + PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); + } + + return false; +} + static const struct pci_dev_acs_enabled { u16 vendor; u16 device; @@ -4973,6 +4993,8 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs }, /* Zhaoxin Root/Downstream Ports */ { PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs }, + /* Wangxun nics */ + { PCI_VENDOR_ID_WANGXUN, PCI_ANY_ID, pci_quirk_wangxun_nic_acs }, #ifdef CONFIG_ARCH_PHYTIUM /* because PLX switch Vendor id is 0x10b5 on phytium cpu */ { 0x10b5, PCI_ANY_ID, pci_quirk_xgene_acs }, diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index a84dcf49e200..27229ffde658 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -3043,6 +3043,8 @@ #define PCI_DEVICE_ID_INTEL_VMD_9A0B 0x9a0b #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 +#define PCI_VENDOR_ID_WANGXUN 0x8088 + #define PCI_VENDOR_ID_SCALEMP 0x8686 #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010 -- Gitee