Skip to content

Commit 1cbc5e2

Browse files
l1kbjorn-helgaas
authored andcommitted
PCI/ERR: Fix uevent on failure to recover
Upon failure to recover from a PCIe error through AER, DPC or EDR, a uevent is sent to inform user space about disconnection of the bridge whose subordinate devices failed to recover. However the bridge itself is not disconnected. Instead, a uevent should be sent for each of the subordinate devices. Only if the "bridge" happens to be a Root Complex Event Collector or Integrated Endpoint does it make sense to send a uevent for it (because there are no subordinate devices). Right now if there is a mix of subordinate devices with and without pci_error_handlers, a BEGIN_RECOVERY event is sent for those with pci_error_handlers but no FAILED_RECOVERY event is ever sent for them afterwards. Fix it. Fixes: 856e1eb ("PCI/AER: Add uevents in AER and EEH error/resume") Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: stable@vger.kernel.org # v4.16+ Link: https://patch.msgid.link/68fc527a380821b5d861dd554d2ce42cb739591c.1755008151.git.lukas@wunner.de
1 parent d0a2dee commit 1cbc5e2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/pci/pcie/err.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ static int report_normal_detected(struct pci_dev *dev, void *data)
108108
return report_error_detected(dev, pci_channel_io_normal, data);
109109
}
110110

111+
static int report_perm_failure_detected(struct pci_dev *dev, void *data)
112+
{
113+
pci_uevent_ers(dev, PCI_ERS_RESULT_DISCONNECT);
114+
return 0;
115+
}
116+
111117
static int report_mmio_enabled(struct pci_dev *dev, void *data)
112118
{
113119
struct pci_driver *pdrv;
@@ -272,7 +278,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
272278
failed:
273279
pci_walk_bridge(bridge, pci_pm_runtime_put, NULL);
274280

275-
pci_uevent_ers(bridge, PCI_ERS_RESULT_DISCONNECT);
281+
pci_walk_bridge(bridge, report_perm_failure_detected, NULL);
276282

277283
pci_info(bridge, "device recovery failed\n");
278284

0 commit comments

Comments
 (0)