Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72abf08

Browse files
ZiyaoMingcongBai
authored andcommitted
FROMLIST: PCI: Override PCIe bridge supported speeds for older Loongson 3C6000 series steppings
Older steppings of the Loongson 3C6000 series incorrectly report the supported link speeds on their PCIe bridges (device IDs 3c19, 3c29) as only 2.5 GT/s, despite the upstream bus supporting speeds from 2.5 GT/s up to 16 GT/s. As a result, certain PCIe devices would be incorrectly probed as a Gen1- only, even if higher link speeds are supported, harming performance and prevents dynamic link speed functionality from being enabled in drivers such as amdgpu. Manually override the `supported_speeds` field for affected PCIe bridges with those found on the upstream bus to correctly reflect the supported link speeds. This patch is found from AOSC OS[1]. Link: #2 #1 Tested-by: Lain Fearyncess Yang <[email protected]> Tested-by: Mingcong Bai <[email protected]> Tested-by: Ayden Meng <[email protected]> Signed-off-by: Ayden Meng <[email protected]> Signed-off-by: Ziyao <[email protected]> Link: https://lore.kernel.org/loongarch/[email protected]/ Signed-off-by: Mingcong Bai <[email protected]>
1 parent a722244 commit 72abf08

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/pci/quirks.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,30 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quir
19561956

19571957
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_HUAWEI, 0x1610, PCI_CLASS_BRIDGE_PCI, 8, quirk_pcie_mch);
19581958

1959+
/*
1960+
* Older steppings of the Loongson 3C6000 series incorrectly report the
1961+
* supported link speeds on their PCIe bridges (device IDs 3c19, 3c29) as
1962+
* only 2.5 GT/s, despite the upstream bus supporting speeds from 2.5 GT/s
1963+
* up to 16 GT/s.
1964+
*/
1965+
static void quirk_loongson_pci_bridge_supported_speeds(struct pci_dev *pdev)
1966+
{
1967+
switch (pdev->bus->max_bus_speed) {
1968+
case PCIE_SPEED_16_0GT:
1969+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_16_0GB;
1970+
case PCIE_SPEED_8_0GT:
1971+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_8_0GB;
1972+
case PCIE_SPEED_5_0GT:
1973+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_5_0GB;
1974+
case PCIE_SPEED_2_5GT:
1975+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_2_5GB;
1976+
default:
1977+
break;
1978+
}
1979+
}
1980+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LOONGSON, 0x3c19, quirk_loongson_secondary_bridge_supported_speeds);
1981+
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_LOONGSON, 0x3c29, quirk_loongson_secondary_bridge_supported_speeds);
1982+
19591983
/*
19601984
* HiSilicon KunPeng920 and KunPeng930 have devices appear as PCI but are
19611985
* actually on the AMBA bus. These fake PCI devices can support SVA via

0 commit comments

Comments
 (0)