diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 07b5f9af1eecef60c45282e7ecee2f89c2332fd8..096c24467b04ade658afe6dc04edec672451a463 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4863,6 +4863,22 @@ static int pci_quirk_wangxun_nic_acs(struct pci_dev *dev, u16 acs_flags) return false; } +/* + * Phytium 5000E SOC 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. + */ +static int pci_quirk_phytium_pcie_ports_acs(struct pci_dev *dev, u16 acs_flags) +{ + switch (dev->device) { + case 0x0100: + 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; @@ -4961,10 +4977,14 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs }, { PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs }, { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs }, - /* because PLX switch Vendor id is 0x10b5 on phytium cpu */ - { 0x10b5, PCI_ANY_ID, pci_quirk_xgene_acs }, - /* because rootcomplex Vendor id is 0x17cd on phytium cpu */ - { 0x17cd, PCI_ANY_ID, pci_quirk_xgene_acs }, + /* Phytium Socs */ + { PCI_VENDOR_ID_PHYTIUM, PCI_ANY_ID, pci_quirk_phytium_pcie_ports_acs }, +#ifdef CONFIG_ARCH_PHYTIUM + /* PLX switch on phytium cpu */ + { PCI_VENDOR_ID_PLX, PCI_ANY_ID, pci_quirk_xgene_acs }, + /* rootcomplex on phytium cpu */ + { PCI_VENDOR_ID_CDNS, PCI_ANY_ID, pci_quirk_xgene_acs }, +#endif /* Broadcom multi-function device */ { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0x1750, pci_quirk_mf_endpoint_acs },