linux/drivers/pci/pcie
Jonathan Cameron 068c29a248 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/20200622113523.891666-1-Jonathan.Cameron@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2020-07-22 15:41:03 -05:00
..
aer_inject.c PCI/AER: Fix the broken interrupt injection 2020-03-08 11:07:12 +01:00
aer.c PCI/ERR: Clear PCIe Device Status errors only if OS owns AER 2020-07-22 15:41:03 -05:00
aspm.c PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges 2020-05-07 16:39:44 -05:00
bw_notification.c pci-v5.2-changes 2019-05-14 10:30:10 -07:00
dpc.c PCI/DPC: Print IRQ number used by port 2020-06-01 12:03:22 -05:00
edr.c PCI/EDR: Log only ACPI_NOTIFY_DISCONNECT_RECOVER events 2020-04-24 18:33:29 -05:00
err.c PCI/ERR: Clear PCIe Device Status errors only if OS owns AER 2020-07-22 15:41:03 -05:00
Kconfig PCI/AER: Don't select CONFIG_PCIEAER by default 2020-04-24 14:35:55 -05:00
Makefile PCI/DPC: Add Error Disconnect Recover (EDR) support 2020-03-28 13:19:04 -05:00
pme.c PCI/PME: Fix kernel-doc of pcie_pme_resume() and pcie_pme_remove() 2020-05-21 15:04:45 -05:00
portdrv_core.c PCI/ERR: Remove service dependency in pcie_do_recovery() 2020-03-28 13:18:54 -05:00
portdrv_pci.c PCI: Use 'pci_channel_state_t' instead of 'enum pci_channel_state' 2020-07-07 17:11:52 -05:00
portdrv.h PCI/AER: Remove HEST/FIRMWARE_FIRST parsing for AER ownership 2020-06-01 12:02:29 -05:00
ptm.c PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream Port 2020-05-21 15:53:07 -05:00