On Mon, 19 May 2025, Bjorn Helgaas wrote: > From: Bjorn Helgaas <bhelg...@google.com> > > Previously we decoded the AER Error Source ID in two places. Consolidate > them so both places use aer_print_port_info(). Add a "details" parameter > so we can add a note when we didn't find any downstream devices with errors > logged in their AER Capability. > > When we didn't read any error details from the source device, we logged two > messages: one in aer_isr_one_error() and another in find_source_device(). > Since they both contain the same information, only log the first one when > when find_source_device() has found error details. > > This changes the dmesg logging when we found no devices with errors logged: > > - pci 0000:00:01.0: AER: Correctable error message received from > 0000:02:00.0 > - pci 0000:00:01.0: AER: found no error details for 0000:02:00.0 > + pci 0000:00:01.0: AER: Correctable error message received from > 0000:02:00.0 (no details found) > > Signed-off-by: Bjorn Helgaas <bhelg...@google.com> > --- > drivers/pci/pcie/aer.c | 30 ++++++++++++++++-------------- > 1 file changed, 16 insertions(+), 14 deletions(-) > > diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c > index a1cf8c7ef628..b8494ccd935b 100644 > --- a/drivers/pci/pcie/aer.c > +++ b/drivers/pci/pcie/aer.c > @@ -733,16 +733,17 @@ void aer_print_error(struct pci_dev *dev, struct > aer_err_info *info) > info->severity, info->tlp_header_valid, &info->tlp); > } > > -static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info > *info) > +static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info > *info, > + const char *details) > { > u8 bus = info->id >> 8; > u8 devfn = info->id & 0xff; > > - pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d\n", > + pci_info(dev, "%s%s error message received from %04x:%02x:%02x.%d%s\n", > info->multi_error_valid ? "Multiple " : "", > aer_error_severity_string[info->severity], > pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn), > - PCI_FUNC(devfn)); > + PCI_FUNC(devfn), details); > } > > #ifdef CONFIG_ACPI_APEI_PCIEAER > @@ -926,13 +927,13 @@ static bool find_source_device(struct pci_dev *parent, > else > pci_walk_bus(parent->subordinate, find_device_iter, e_info); > > + /* > + * If we didn't find any devices with errors logged in the AER > + * Capability, just print the Error Source ID from the Root Port or > + * RCEC that received an ERR_* Message. > + */ > if (!e_info->error_dev_num) { > - u8 bus = e_info->id >> 8; > - u8 devfn = e_info->id & 0xff; > - > - pci_info(parent, "found no error details for > %04x:%02x:%02x.%d\n", > - pci_domain_nr(parent->bus), bus, PCI_SLOT(devfn), > - PCI_FUNC(devfn)); > + aer_print_port_info(parent, e_info, " (no details found)"); > return false; > } > return true; > @@ -1297,10 +1298,11 @@ static void aer_isr_one_error(struct aer_rpc *rpc, > e_info.multi_error_valid = 1; > else > e_info.multi_error_valid = 0; > - aer_print_port_info(pdev, &e_info); > > - if (find_source_device(pdev, &e_info)) > + if (find_source_device(pdev, &e_info)) { > + aer_print_port_info(pdev, &e_info, ""); > aer_process_err_devices(&e_info); > + } > } > > if (e_src->status & PCI_ERR_ROOT_UNCOR_RCV) { > @@ -1316,10 +1318,10 @@ static void aer_isr_one_error(struct aer_rpc *rpc, > else > e_info.multi_error_valid = 0; > > - aer_print_port_info(pdev, &e_info); > - > - if (find_source_device(pdev, &e_info)) > + if (find_source_device(pdev, &e_info)) { > + aer_print_port_info(pdev, &e_info, ""); > aer_process_err_devices(&e_info); > + } > } > } > >
Reviewed-by: Ilpo Järvinen <ilpo.jarvi...@linux.intel.com> -- i.