Skip to content

Commit 331d9a3

Browse files
chenhuacaismb49
authored andcommitted
PCI: Add ACS quirk for Loongson PCIe
BugLink: https://bugs.launchpad.net/bugs/2120812 commit 1f3303aa92e15fa273779acac2d0023609de30f1 upstream. Loongson PCIe Root Ports don't advertise an ACS capability, but they do not allow peer-to-peer transactions between Root Ports. Add an ACS quirk so each Root Port can be in a separate IOMMU group. Signed-off-by: Xianglai Li <lixianglai@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20250403040756.720409-1-chenhuacai@loongson.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Noah Wager <noah.wager@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent ae67236 commit 331d9a3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/pci/quirks.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5010,6 +5010,18 @@ static int pci_quirk_brcm_acs(struct pci_dev *dev, u16 acs_flags)
50105010
PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
50115011
}
50125012

5013+
static int pci_quirk_loongson_acs(struct pci_dev *dev, u16 acs_flags)
5014+
{
5015+
/*
5016+
* Loongson PCIe Root Ports don't advertise an ACS capability, but
5017+
* they do not allow peer-to-peer transactions between Root Ports.
5018+
* Allow each Root Port to be in a separate IOMMU group by masking
5019+
* SV/RR/CR/UF bits.
5020+
*/
5021+
return pci_acs_ctrl_enabled(acs_flags,
5022+
PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF);
5023+
}
5024+
50135025
/*
50145026
* Wangxun 40G/25G/10G/1G NICs have no ACS capability, but on
50155027
* multi-function devices, the hardware isolates the functions by
@@ -5143,6 +5155,17 @@ static const struct pci_dev_acs_enabled {
51435155
{ PCI_VENDOR_ID_BROADCOM, 0x1762, pci_quirk_mf_endpoint_acs },
51445156
{ PCI_VENDOR_ID_BROADCOM, 0x1763, pci_quirk_mf_endpoint_acs },
51455157
{ PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs },
5158+
/* Loongson PCIe Root Ports */
5159+
{ PCI_VENDOR_ID_LOONGSON, 0x3C09, pci_quirk_loongson_acs },
5160+
{ PCI_VENDOR_ID_LOONGSON, 0x3C19, pci_quirk_loongson_acs },
5161+
{ PCI_VENDOR_ID_LOONGSON, 0x3C29, pci_quirk_loongson_acs },
5162+
{ PCI_VENDOR_ID_LOONGSON, 0x7A09, pci_quirk_loongson_acs },
5163+
{ PCI_VENDOR_ID_LOONGSON, 0x7A19, pci_quirk_loongson_acs },
5164+
{ PCI_VENDOR_ID_LOONGSON, 0x7A29, pci_quirk_loongson_acs },
5165+
{ PCI_VENDOR_ID_LOONGSON, 0x7A39, pci_quirk_loongson_acs },
5166+
{ PCI_VENDOR_ID_LOONGSON, 0x7A49, pci_quirk_loongson_acs },
5167+
{ PCI_VENDOR_ID_LOONGSON, 0x7A59, pci_quirk_loongson_acs },
5168+
{ PCI_VENDOR_ID_LOONGSON, 0x7A69, pci_quirk_loongson_acs },
51465169
/* Amazon Annapurna Labs */
51475170
{ PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs },
51485171
/* Zhaoxin multi-function devices */

0 commit comments

Comments
 (0)