PCI: Clear Secondary Status errors after enumeration
authorVidya Sagar <vidyas@nvidia.com>
Tue, 16 Jan 2024 14:32:58 +0000 (20:02 +0530)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 23 Apr 2024 21:08:17 +0000 (16:08 -0500)
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@nvidia.com>
[bhelgaas: simplify commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/probe.c

index 1325fbae2f28fb10dbbbd6c6ff65ce2cf9193f3d..df5171b912e006b3a229dee008e5ea7c163d0af6 100644 (file)
@@ -1482,6 +1482,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);