]> www.infradead.org Git - users/jedix/linux-maple.git/commit
PCI/bwctrl: Replace lbms_count with PCI_LINK_LBMS_SEEN flag
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 22 Apr 2025 11:55:47 +0000 (14:55 +0300)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Thu, 15 May 2025 08:38:40 +0000 (08:38 +0000)
commit2389d8dc38fee18176c49e9c4804f5ecc55807fa
treeb1c0ce10bfc670750b3aa1360269762aea8e14c3
parent0af2f6be1b4281385b618cb86ad946eded089ac8
PCI/bwctrl: Replace lbms_count with PCI_LINK_LBMS_SEEN flag

PCIe BW controller counted LBMS assertions for the purposes of the Target
Speed quirk (pcie_failed_link_retrain()). It was also a plan to expose the
LBMS count through sysfs to allow better diagnosing link related issues.
Lukas Wunner suggested, however, that adding a trace event would be better
for diagnostics purposes, leaving only pcie_failed_link_retrain() as a user
of the lbms_count.

The logic in pcie_failed_link_retrain() does not require keeping count of
LBMS assertions, so replace lbms_count with a simple flag in pci_dev's
priv_flags.  The reduced complexity allows removing pcie_bwctrl_lbms_rwsem.

Since pcie_failed_link_retrain() runs before bwctrl is probed during boot,
the LBMS in Link Status register still has to be checked by the quirk.

The priv_flags numbering is not continuous because hotplug code added a few
flags to fill numbers 4-5 (hotplug and bwctrl changes are routed through in
different branches).

Suggested-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
[kwilczynski: squashed a fix to resolve build failures from
https://lore.kernel.org/all/20250508090036.1528-1-ilpo.jarvinen@linux.intel.com]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Link: https://patch.msgid.link/20250422115548.1483-1-ilpo.jarvinen@linux.intel.com
drivers/pci/hotplug/pciehp_ctrl.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/pcie/bwctrl.c
drivers/pci/quirks.c