In order to unify extlog_print_pcie() with ghes_handle_aer() and
prepare to remove one of the functions, align the behaviour of the
2 functions. Thus:
- Submit the decoded snapshot through aer_recover_queue() instead of
  just printing the error.
- Override the mapped AER severity with AER_FATAL when CPER_SEC_RESET
  is set so the AER worker selects the frozen-channel recovery path
  when it finds an unmasked uncorrectable error.

Signed-off-by: Pierre Gondois <[email protected]>
---
 drivers/acpi/acpi_extlog.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
index 125f7931b98bc..e09ea571c32f5 100644
--- a/drivers/acpi/acpi_extlog.c
+++ b/drivers/acpi/acpi_extlog.c
@@ -8,9 +8,11 @@
 
 #include <linux/module.h>
 #include <linux/acpi.h>
+#include <linux/aer.h>
 #include <linux/cper.h>
 #include <linux/ratelimit.h>
 #include <linux/edac.h>
+#include <linux/pci.h>
 #include <linux/ras.h>
 #include <cxl/event.h>
 #include <acpi/ghes.h>
@@ -138,7 +140,6 @@ static void extlog_print_pcie(struct acpi_hest_generic_data 
*gdata)
 #ifdef CONFIG_ACPI_APEI_PCIEAER
        struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata);
        struct aer_capability_regs aer_regs = {};
-       struct pci_dev *pdev;
        unsigned int devfn;
        unsigned int bus;
        int aer_severity;
@@ -156,6 +157,9 @@ static void extlog_print_pcie(struct acpi_hest_generic_data 
*gdata)
                return;
 
        aer_severity = cper_severity_to_aer(gdata->error_severity);
+       /* A component reset by firmware needs reinitialization. */
+       if (gdata->flags & CPER_SEC_RESET)
+               aer_severity = AER_FATAL;
 
        aer_cap_regs_unpack(&aer_regs, pcie_err->aer_info, 
sizeof(pcie_err->aer_info));
 
@@ -163,12 +167,7 @@ static void extlog_print_pcie(struct 
acpi_hest_generic_data *gdata)
        bus = pcie_err->device_id.bus;
        devfn = PCI_DEVFN(pcie_err->device_id.device,
                          pcie_err->device_id.function);
-       pdev = pci_get_domain_bus_and_slot(domain, bus, devfn);
-       if (!pdev)
-               return;
-
-       pci_print_aer(pdev, aer_severity, &aer_regs);
-       pci_dev_put(pdev);
+       aer_recover_queue(domain, bus, devfn, aer_severity, &aer_regs);
 #endif
 }
 
-- 
2.43.0


Reply via email to