Skip to content

Commit eeebfde

Browse files
AydenMengmengxiangdong
authored andcommitted
PCI: loongson: Fix supported link speeds for Loongson 3c19/3c29 PCIe
devices proper dynamic speed negotiation. The "Supported Link Speeds" field reported by Loongson PCIe devices 3c19 and 3c29 is incorrect, which prevents the AMDGPU driver (and potentially others) from correctly detecting the dynamic link speed capabilities of the device. As a result, the PCIe card is incorrectly identified as a GEN1-only device, even when higher speeds are supported. This patch manually overrides the `supported_speeds` field for these devices to reflect the actual supported link speeds. Tested-by: Lain "Fearyncess" Yang <[email protected]> Signed-off-by: Ayden Meng <[email protected]>
1 parent 146561e commit eeebfde

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
@@ -1988,6 +1988,30 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quir
19881988

19891989
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_HUAWEI, 0x1610, PCI_CLASS_BRIDGE_PCI, 8, quirk_pcie_mch);
19901990

1991+
/*
1992+
* The PCIe devices 3c19/3c29 on Loongson platforms report an incorrect
1993+
* "Supported Link Speeds" value. By explicitly overriding the
1994+
* supported_speeds field, the dynamic speed switching functionality
1995+
* can be enabled.
1996+
*/
1997+
static void loongson_fixup_support_speeds(struct pci_dev *pdev)
1998+
{
1999+
switch (pdev->bus->max_bus_speed) {
2000+
case PCIE_SPEED_16_0GT:
2001+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_16_0GB;
2002+
case PCIE_SPEED_8_0GT:
2003+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_8_0GB;
2004+
case PCIE_SPEED_5_0GT:
2005+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_5_0GB;
2006+
case PCIE_SPEED_2_5GT:
2007+
pdev->supported_speeds |= PCI_EXP_LNKCAP2_SLS_2_5GB;
2008+
default:
2009+
break;
2010+
}
2011+
}
2012+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, 0x3c19, loongson_fixup_support_speeds);
2013+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, 0x3c29, loongson_fixup_support_speeds);
2014+
19912015
/*
19922016
* HiSilicon KunPeng920 and KunPeng930 have devices appear as PCI but are
19932017
* actually on the AMBA bus. These fake PCI devices can support SVA via

0 commit comments

Comments
 (0)