FAILED: patch "[PATCH] PCI: Skip Target Speed quirk on clamped ports with no link" failed to apply to 6.12-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x ff8a969f7dc8e79ea6113abcfa983e070b2b585a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From ff8a969f7dc8e79ea6113abcfa983e070b2b585a Mon Sep 17 00:00:00 2001
From: "Maciej W. Rozycki" <[email protected]>
Date: Sat, 1 Aug 2026 22:11:48 +0200
Subject: [PATCH] PCI: Skip Target Speed quirk on clamped ports with no link
Since commit 72780f796468 ("PCI: Always lift 2.5GT/s restriction in PCIe failed link retraining") the Target Speed quirk lifts a firmware-imposed 2.5GT/s restriction on any downstream port, without checking whether the link is up. Where nothing is plugged in, the retraining that follows can never complete, so each attempt costs PCIE_LINK_RETRAIN_TIMEOUT_MS. The quirk makes two of them -- the initial one and the restore on the error path -- adding a fixed 2 s to every boot.
On an MSI PRO Z690-A WIFI DDR4 (Intel 600 Series PCH) with one empty x1 slot, running v7.2-rc5:
0.541 pci 0000:00:1c.0: removing 2.5GT/s downstream link speed restriction 1.541 pci 0000:00:1c.0: retraining failed
2.541 pci 0000:00:1c.2: [8086:7aba] type 01 class 0x060400
Where the Link Speed has already been clamped at 2.5GT/s and no link has been established there is nothing worth doing, which is what the kerneldoc for the quirk already describes: the restriction is to be lifted where firmware arranged it "and the port reports its link already being up". Bail out early in that case, before either the ASM2824 workaround or the removal of the restriction is considered.
Ports whose link is up are unaffected, and so is the ASM2824 workaround, which is reached with the Target Link Speed not clamped.
With this applied the quirk returns without touching the port: both messages are gone, enumeration proceeds from 0000:00:1c.0 to 0000:00:1c.2 in 1 ms rather than 2 s, and the systemd "kernel" boot phase goes from 3.011 s to 1.036 s.
--- drivers/pci/quirks.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/pci/quirks.c +5 -1
@@ -108,7 +108,11 @@ int pcie_failed_link_retrain(struct pci_dev *dev)pcie_capability_read_word (dev,PCI_EXP_LNKSTA , &lnksta);pcie_capability_read_word (dev,PCI_EXP_LNKCTL2 , &oldlnkctl2); -if (!(lnksta &PCI_EXP_LNKSTA_DLLLA ) &&pcie_lbms_seen (dev, lnksta)) { +if (lnksta &PCI_EXP_LNKSTA_DLLLA ) { + ; + }else if (PCIE_LNKCTL2_TLS2SPEED (oldlnkctl2) ==PCIE_SPEED_2_5GT ) { +return ret; + }else if (pcie_lbms_seen (dev, lnksta)) {pci_info (dev,"broken device, retraining non-functional downstream link at 2.5GT/s\n" ); ret =pcie_set_target_speed (dev,PCIE_SPEED_2_5GT , false);if (ret)
Signature · 1 line
2.53.0
PATCH 1/1 PCI: Skip Target Speed quirk on clamped ports with no link
From: "Maciej W. Rozycki" <[email protected]>
Since commit 72780f796468 ("PCI: Always lift 2.5GT/s restriction in PCIe failed link retraining") the Target Speed quirk lifts a firmware-imposed 2.5GT/s restriction on any downstream port, without checking whether the link is up. Where nothing is plugged in, the retraining that follows can never complete, so each attempt costs PCIE_LINK_RETRAIN_TIMEOUT_MS. The quirk makes two of them -- the initial one and the restore on the error path -- adding a fixed 2 s to every boot.
On an MSI PRO Z690-A WIFI DDR4 (Intel 600 Series PCH) with one empty x1 slot, running v7.2-rc5:
0.541 pci 0000:00:1c.0: removing 2.5GT/s downstream link speed restriction 1.541 pci 0000:00:1c.0: retraining failed
2.541 pci 0000:00:1c.2: [8086:7aba] type 01 class 0x060400
Where the Link Speed has already been clamped at 2.5GT/s and no link has been established there is nothing worth doing, which is what the kerneldoc for the quirk already describes: the restriction is to be lifted where firmware arranged it "and the port reports its link already being up". Bail out early in that case, before either the ASM2824 workaround or the removal of the restriction is considered.
Ports whose link is up are unaffected, and so is the ASM2824 workaround, which is reached with the Target Link Speed not clamped.
With this applied the quirk returns without touching the port: both messages are gone, enumeration proceeds from 0000:00:1c.0 to 0000:00:1c.2 in 1 ms rather than 2 s, and the systemd "kernel" boot phase goes from 3.011 s to 1.036 s.
[ Andreas: this tree predates pcie_lbms_seen() and pcie_set_target_speed()
and still tests LBMS and DLLLA in one expression, so the hunk did not apply. Split that test the same way as upstream and compare the LNKCTL2 Target Link Speed field against PCI_EXP_LNKCTL2_TLS_2_5GT directly, as the existing code further down already does. ]
---
Notes:
Boot-tested on v6.12.116 on the MSI PRO Z690-A WIFI DDR4 from the report (empty x1 slot at 0000:00:1c.0), cold boots: without this patch both messages appear and enumeration from 00:1c.0 to 00:1c.2 takes 2.001 s; with it neither message appears, the step takes 0.001 s, and the systemd "kernel" phase drops from 3.097 s to 1.098 s. The other 22 PCI devices enumerate as before.
drivers/pci/quirks.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pci/quirks.c +6 -2
@@ -93,8 +93,12 @@ int pcie_failed_link_retrain(struct pci_dev *dev)pcie_capability_read_word (dev,PCI_EXP_LNKCTL2 , &lnkctl2);pcie_capability_read_word (dev,PCI_EXP_LNKSTA , &lnksta); oldlnkctl2 = lnkctl2; -if ((lnksta & (PCI_EXP_LNKSTA_LBMS |PCI_EXP_LNKSTA_DLLLA )) == -PCI_EXP_LNKSTA_LBMS ) { +if (lnksta &PCI_EXP_LNKSTA_DLLLA ) { + ; + }else if ((lnkctl2 &PCI_EXP_LNKCTL2_TLS ) == +PCI_EXP_LNKCTL2_TLS_2_5GT ) { +return ret; + }else if (lnksta &PCI_EXP_LNKSTA_LBMS ) {pci_info (dev,"broken device, retraining non-functional downstream link at 2.5GT/s\n" ); lnkctl2 &= ~PCI_EXP_LNKCTL2_TLS ;
Signature · 1 line
2.56.0