From: Bjorn Helgaas Date: Thu, 22 May 2025 23:21:09 +0000 (-0500) Subject: PCI/AER: Factor COR/UNCOR error handling out from aer_isr_one_error() X-Git-Tag: v6.16-rc1~50^2~26^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fc4dae74afcf29ef82afbaaa9b082893871eda4;p=thirdparty%2Fkernel%2Fstable.git PCI/AER: Factor COR/UNCOR error handling out from aer_isr_one_error() aer_isr_one_error() duplicates the Error Source ID logging and AER error processing for Correctable Errors and Uncorrectable Errors. Factor out the duplicated code to aer_isr_one_error_type(). aer_isr_one_error() doesn't need the struct aer_rpc pointer, so pass it the Root Port or RCEC pci_dev pointer instead. Signed-off-by: Bjorn Helgaas Reviewed-by: Ilpo Järvinen Reviewed-by: Jonathan Cameron Reviewed-by: Kuppuswamy Sathyanarayanan Link: https://patch.msgid.link/20250522232339.1525671-4-helgaas@kernel.org --- diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index a1cf8c7ef628a..568229288ca38 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1273,17 +1273,32 @@ static inline void aer_process_err_devices(struct aer_err_info *e_info) } /** - * aer_isr_one_error - consume an error detected by Root Port - * @rpc: pointer to the Root Port which holds an error + * aer_isr_one_error_type - consume a Correctable or Uncorrectable Error + * detected by Root Port or RCEC + * @root: pointer to Root Port or RCEC that signaled AER interrupt + * @info: pointer to AER error info + */ +static void aer_isr_one_error_type(struct pci_dev *root, + struct aer_err_info *info) +{ + aer_print_port_info(root, info); + + if (find_source_device(root, info)) + aer_process_err_devices(info); +} + +/** + * aer_isr_one_error - consume error(s) signaled by an AER interrupt from + * Root Port or RCEC + * @root: pointer to Root Port or RCEC that signaled AER interrupt * @e_src: pointer to an error source */ -static void aer_isr_one_error(struct aer_rpc *rpc, +static void aer_isr_one_error(struct pci_dev *root, struct aer_err_source *e_src) { - struct pci_dev *pdev = rpc->rpd; struct aer_err_info e_info; - pci_rootport_aer_stats_incr(pdev, e_src); + pci_rootport_aer_stats_incr(root, e_src); /* * There is a possibility that both correctable error and @@ -1297,10 +1312,8 @@ 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)) - aer_process_err_devices(&e_info); + aer_isr_one_error_type(root, &e_info); } if (e_src->status & PCI_ERR_ROOT_UNCOR_RCV) { @@ -1316,10 +1329,7 @@ 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)) - aer_process_err_devices(&e_info); + aer_isr_one_error_type(root, &e_info); } } @@ -1340,7 +1350,7 @@ static irqreturn_t aer_isr(int irq, void *context) return IRQ_NONE; while (kfifo_get(&rpc->aer_fifo, &e_src)) - aer_isr_one_error(rpc, &e_src); + aer_isr_one_error(rpc->rpd, &e_src); return IRQ_HANDLED; }