Re: [PATCH v11 17/23] CXL/AER: Introduce cxl_aer.c into AER driver for forwarding CXL errors

Lukas Wunner
2025-08-27T07:56:49Z

On Tue, Aug 26, 2025 at 08:35:32PM -0500, Terry Bowman wrote:
> +++ b/drivers/pci/pcie/aer.c
> @@ -1092,51 +1092,6 @@ static bool find_source_device(struct pci_dev *parent,
> return true;
> }
>
> -#ifdef CONFIG_CXL_RAS
> -
> -/**
> - * pci_aer_unmask_internal_errors - unmask internal errors
> - * @dev: pointer to the pci_dev data structure
> - *
> - * Unmask internal errors in the Uncorrectable and Correctable Error
> - * Mask registers.
> - *
> - * Note: AER must be enabled and supported by the device which must be
> - * checked in advance, e.g. with pcie_aer_is_native().
> - */
> -void pci_aer_unmask_internal_errors(struct pci_dev *dev)
> -{
> - int aer = dev->aer_cap;
> - u32 mask;
> -
> - pci_read_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, &mask);
> - mask &= ~PCI_ERR_UNC_INTN;
> - pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, mask);
> -
> - pci_read_config_dword(dev, aer + PCI_ERR_COR_MASK, &mask);
> - mask &= ~PCI_ERR_COR_INTERNAL;
> - pci_write_config_dword(dev, aer + PCI_ERR_COR_MASK, mask);
> -}
> -EXPORT_SYMBOL_NS_GPL(pci_aer_unmask_internal_errors, "CXL");

PCI device drivers may have a need to unmask internal errors if they know
that the device is capable of signaling them and their pci_error_handlers
can take care of them.

Hence I'm in favor of keeping pci_aer_unmask_internal_errors() as a helper
in drivers/pci/pcie/aer.c which PCI device drivers may call.

In particular, the "xe" driver would be a potential future user of this
helper.

Thanks,

Lukas