lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2512080348310.49654@angie.orcam.me.uk>
Date: Mon, 8 Dec 2025 19:24:34 +0000 (GMT)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: Bjorn Helgaas <bhelgaas@...gle.com>, 
    Matthew W Carlis <mattc@...estorage.com>, 
    ALOK TIWARI <alok.a.tiwari@...cle.com>
cc: ashishk@...estorage.com, msaggi@...estorage.com, sconnor@...estorage.com, 
    Lukas Wunner <lukas@...ner.de>, 
    Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>, 
    Jiwei <jiwei.sun.bj@...com>, guojinhui.liam@...edance.com, 
    ahuang12@...ovo.com, sunjw10@...ovo.com, linux-pci@...r.kernel.org, 
    linux-kernel@...r.kernel.org
Subject: [PATCH v2 2/3] PCI: Use pcie_get_speed_cap() in PCIe failed link
 retraining

Rewrite a check for the maximum link speed in the Link Capabilities 
register in terms of pcie_get_speed_cap().  No functional change.

Signed-off-by: Maciej W. Rozycki <macro@...am.me.uk>
---
 drivers/pci/quirks.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

linux-pcie-failed-link-retrain-get-speed-cap.diff
Index: linux-macro/drivers/pci/quirks.c
===================================================================
--- linux-macro.orig/drivers/pci/quirks.c
+++ linux-macro/drivers/pci/quirks.c
@@ -94,8 +94,8 @@ static bool pcie_lbms_seen(struct pci_de
 int pcie_failed_link_retrain(struct pci_dev *dev)
 {
 	u16 lnksta, lnkctl2, oldlnkctl2;
+	enum pci_bus_speed speed_cap;
 	int ret = -ENOTTY;
-	u32 lnkcap;
 
 	if (!pci_is_pcie(dev) || !pcie_downstream_port(dev) ||
 	    !pcie_cap_has_lnkctl2(dev) || !dev->link_active_reporting)
@@ -110,12 +110,12 @@ int pcie_failed_link_retrain(struct pci_
 			goto err;
 	}
 
+	speed_cap = pcie_get_speed_cap(dev);
 	pcie_capability_read_word(dev, PCI_EXP_LNKCTL2, &lnkctl2);
-	pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
 	if ((lnkctl2 & PCI_EXP_LNKCTL2_TLS) == PCI_EXP_LNKCTL2_TLS_2_5GT &&
-	    (lnkcap & PCI_EXP_LNKCAP_SLS) != PCI_EXP_LNKCAP_SLS_2_5GB) {
+	    speed_cap > PCIE_SPEED_2_5GT) {
 		pci_info(dev, "removing 2.5GT/s downstream link speed restriction\n");
-		ret = pcie_set_target_speed(dev, PCIE_LNKCAP_SLS2SPEED(lnkcap), false);
+		ret = pcie_set_target_speed(dev, speed_cap, false);
 		if (ret)
 			goto err;
 	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ