Skip to content

Commit a99b4a3

Browse files
committed
Merge tag 'pci-v6.13-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci
Pull PCI fixes from Krzysztof Wilczyński: "Two small patches that are important for fixing boot time hang on Intel JHL7540 'Titan Ridge' platforms equipped with a Thunderbolt controller. The boot time issue manifests itself when a PCI Express bandwidth control is unnecessarily enabled on the Thunderbolt controller downstream ports, which only supports a link speed of 2.5 GT/s in accordance with USB4 v2 specification (p. 671, sec. 11.2.1, "PCIe Physical Layer Logical Sub-block"). As such, there is no need to enable bandwidth control on such downstream port links, which also works around the issue. Both patches were tested by the original reporter on the hardware on which the failure origin golly manifested itself. Both fixes were proven to resolve the reported boot hang issue, and both patches have been in linux-next this week with no reported problems" * tag 'pci-v6.13-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: PCI/bwctrl: Enable only if more than one speed is supported PCI: Honor Max Link Speed when determining supported speeds
2 parents 78b1346 + 774c71c commit a99b4a3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

drivers/pci/pci.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6232,12 +6232,14 @@ u8 pcie_get_supported_speeds(struct pci_dev *dev)
62326232
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP2, &lnkcap2);
62336233
speeds = lnkcap2 & PCI_EXP_LNKCAP2_SLS;
62346234

6235+
/* Ignore speeds higher than Max Link Speed */
6236+
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
6237+
speeds &= GENMASK(lnkcap & PCI_EXP_LNKCAP_SLS, 0);
6238+
62356239
/* PCIe r3.0-compliant */
62366240
if (speeds)
62376241
return speeds;
62386242

6239-
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
6240-
62416243
/* Synthesize from the Max Link Speed field */
62426244
if ((lnkcap & PCI_EXP_LNKCAP_SLS) == PCI_EXP_LNKCAP_SLS_5_0GB)
62436245
speeds = PCI_EXP_LNKCAP2_SLS_5_0GB | PCI_EXP_LNKCAP2_SLS_2_5GB;

drivers/pci/pcie/portdrv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,14 @@ static int get_port_device_capability(struct pci_dev *dev)
265265
(pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
266266
services |= PCIE_PORT_SERVICE_DPC;
267267

268+
/* Enable bandwidth control if more than one speed is supported. */
268269
if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
269270
pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) {
270271
u32 linkcap;
271272

272273
pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &linkcap);
273-
if (linkcap & PCI_EXP_LNKCAP_LBNC)
274+
if (linkcap & PCI_EXP_LNKCAP_LBNC &&
275+
hweight8(dev->supported_speeds) > 1)
274276
services |= PCIE_PORT_SERVICE_BWCTRL;
275277
}
276278

0 commit comments

Comments
 (0)