Skip to content

Commit 068c29a

Browse files
jic23bjorn-helgaas
authored andcommitted
PCI/ERR: Clear PCIe Device Status errors only if OS owns AER
pcie_clear_device_status() resets the error bits in the PCIe Device Status Register (PCI_EXP_DEVSTA). Previously we did this unconditionally, but on ACPI systems, the _OSC AER bit negotiates control of the AER capability. Per sec 4.5.1 of the System Firmware Intermediary _OSC and DPC Updates ECN [1], this bit also covers other error enable/status bits including the following: Correctable Error Reporting Enable Non-Fatal Error Reporting Enable Fatal Error Reporting Enable Unsupported Request Reporting Enable These bits are all in the PCIe Device Control register (the ECN omitted "Reporting", but I think that's a typo), so by implication the _OSC AER bit also applies to the error status bits in the PCIe Device Status register: Correctable Error Detected Non-Fatal Error Detected Fatal Error Detected Unsupported Request Detected Clear the PCIe Device Status error bits only when the OS controls the AER capability and related error enable/status bits. If platform firmware controls the AER capability, firmware is responsible for clearing these bits. One call path leading here is: ghes_do_proc ghes_handle_aer aer_recover_queue schedule_work(&aer_recover_work) ... aer_recover_work_func pcie_do_recovery pcie_clear_device_status [1] System Firmware Intermediary (SFI) _OSC and DPC Updates ECN, Feb 24, 2020, affecting PCI Firmware Specification, Rev. 3.2 https://members.pcisig.com/wg/PCI-SIG/document/14076 [bhelgaas: commit log, move test from pcie_clear_device_status() to callers] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 600a5b4 commit 068c29a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/pci/pcie/aer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,8 @@ static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info)
939939
if (aer)
940940
pci_write_config_dword(dev, aer + PCI_ERR_COR_STATUS,
941941
info->status);
942-
pcie_clear_device_status(dev);
942+
if (pcie_aer_is_native(dev))
943+
pcie_clear_device_status(dev);
943944
} else if (info->severity == AER_NONFATAL)
944945
pcie_do_recovery(dev, pci_channel_io_normal, aer_root_reset);
945946
else if (info->severity == AER_FATAL)

drivers/pci/pcie/err.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
197197
pci_dbg(dev, "broadcast resume message\n");
198198
pci_walk_bus(bus, report_resume, &status);
199199

200-
pcie_clear_device_status(dev);
200+
if (pcie_aer_is_native(dev))
201+
pcie_clear_device_status(dev);
201202
pci_aer_clear_nonfatal_status(dev);
202203
pci_info(dev, "device recovery successful\n");
203204
return status;

0 commit comments

Comments
 (0)