Skip to content

Commit 3491f50

Browse files
ij-intelbjorn-helgaas
authored andcommitted
PCI: Abstract LBMS seen check into pcie_lbms_seen()
The Target Speed quirk in pcie_failed_link_retrain() uses the presence of LBMS bit as one of the triggering conditions, effectively monopolizing the use of that bit. An upcoming change will introduce a PCIe bandwidth controller which sets up an interrupt to track LBMS. As LBMS will be cleared by the interrupt handler, the Target Speed quirk will no longer be able to observe LBMS directly. As a preparatory step for the change, extract the LBMS seen check from pcie_failed_link_retrain() into a new function pcie_lmbs_seen(). Link: https://lore.kernel.org/r/20241018144755.7875-6-ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent e93d9fc commit 3491f50

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/pci/quirks.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
#include <linux/switchtec.h>
3434
#include "pci.h"
3535

36+
static bool pcie_lbms_seen(struct pci_dev *dev, u16 lnksta)
37+
{
38+
return lnksta & PCI_EXP_LNKSTA_LBMS;
39+
}
40+
3641
/*
3742
* Retrain the link of a downstream PCIe port by hand if necessary.
3843
*
@@ -96,8 +101,7 @@ int pcie_failed_link_retrain(struct pci_dev *dev)
96101

97102
pcie_capability_read_word(dev, PCI_EXP_LNKCTL2, &lnkctl2);
98103
pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
99-
if ((lnksta & (PCI_EXP_LNKSTA_LBMS | PCI_EXP_LNKSTA_DLLLA)) ==
100-
PCI_EXP_LNKSTA_LBMS) {
104+
if (!(lnksta & PCI_EXP_LNKSTA_DLLLA) && pcie_lbms_seen(dev, lnksta)) {
101105
u16 oldlnkctl2 = lnkctl2;
102106

103107
pci_info(dev, "broken device, retraining non-functional downstream link at 2.5GT/s\n");

0 commit comments

Comments
 (0)