[SRU][N:gke][PATCH 039/106] PCI: Clear Secondary Status errors after enumeration

Tim Whisonant tim.whisonant at canonical.com
Mon Jul 21 16:21:22 UTC 2025


From: Vidya Sagar <vidyas at nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/2117098

We enumerate devices by attempting config reads to the Vendor ID of each
possible device.  On conventional PCI, if no device responds, the read
terminates with a Master Abort (PCI r3.0, sec 6.1).  On PCIe, the config
read is terminated as an Unsupported Request (PCIe r6.0, sec 2.3.2,
7.5.1.3.7).  In either case, if the read addressed a device below a bridge,
it is logged by setting "Received Master Abort" in the bridge Secondary
Status register.

Clear any errors logged in the Secondary Status register after enumeration.

Link: https://lore.kernel.org/r/20240116143258.483235-1-vidyas@nvidia.com
Signed-off-by: Vidya Sagar <vidyas at nvidia.com>
[bhelgaas: simplify commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas at google.com>
(cherry picked from commit 7bf9d2af7e89f65a79225e26d261b52ce4ee3e95)
Signed-off-by: Tim Whisonant <tim.whisonant at canonical.com>
---
 drivers/pci/probe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 29883525b1a28..1dd246011f655 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1527,6 +1527,9 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev,
 	}
 
 out:
+	/* Clear errors in the Secondary Status Register */
+	pci_write_config_word(dev, PCI_SEC_STATUS, 0xffff);
+
 	pci_write_config_word(dev, PCI_BRIDGE_CONTROL, bctl);
 
 	pm_runtime_put(&dev->dev);
-- 
2.43.0




More information about the kernel-team mailing list