When firmware grants control of Advanced Error Reporting to the operating system, that not only encompasses the AER capability, but also error enable/status bits in the Device Control and Device Status registers (PCI Firmware r3.3 table 4-6 bit 3).
PCIe devices without AER capability still support baseline capability error reporting through these enable/status bits (PCIe r7.1 sec 6.2.1), but the bits must not be modified unless AER control was granted. pcie_aer_is_native() is unsuitable to check for control of AER-incapable devices because it implicitly checks for presence of an AER capability. Move that check to its callers (where needed) to allow using the function for the imminent baseline capability error reporting. Signed-off-by: Lukas Wunner <[email protected]> --- drivers/pci/pcie/aer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index d8dcd238fda1..34a8eddc427a 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -257,9 +257,6 @@ int pcie_aer_is_native(struct pci_dev *dev) { struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); - if (!dev->aer_cap) - return 0; - return pcie_ports_native || host->native_aer; } EXPORT_SYMBOL_NS_GPL(pcie_aer_is_native, "CXL"); @@ -280,7 +277,7 @@ int pci_aer_clear_nonfatal_status(struct pci_dev *dev) int aer = dev->aer_cap; u32 status, sev; - if (!pcie_aer_is_native(dev)) + if (!aer || !pcie_aer_is_native(dev)) return -EIO; /* Clear status bits for ERR_NONFATAL errors only */ @@ -299,7 +296,7 @@ void pci_aer_clear_fatal_status(struct pci_dev *dev) int aer = dev->aer_cap; u32 status, sev; - if (!pcie_aer_is_native(dev)) + if (!aer || !pcie_aer_is_native(dev)) return; /* Clear status bits for ERR_FATAL errors only */ -- 2.53.0
