diff mbox series

[02/15] cxl/aer/pci: Update is_internal_error() to be callable w/o CONFIG_PCIEAER_CXL

Message ID 20241008221657.1130181-3-terry.bowman@amd.com (mailing list archive)
State Superseded
Headers show
Series Enable CXL PCIe port protocol error handling and logging | expand

Commit Message

Bowman, Terry Oct. 8, 2024, 10:16 p.m. UTC
CXL port error handling will be updated in future and will use
logic to determine if an error requires CXL or PCIe processing.
Internal errors are one indicator to identify an error is a CXL
protocol error.

is_internal_error() is currently limited by CONFIG_PCIEAER_CXL
kernel config.

Update the is_internal_error() function's declaration such that it is
always available regardless if CONFIG_PCIEAER_CXL kernel config
is enabled or disabled.

Signed-off-by: Terry Bowman <terry.bowman@amd.com>
---
 drivers/pci/pcie/aer.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

Comments

Jonathan Cameron Oct. 16, 2024, 4:11 p.m. UTC | #1
On Tue, 8 Oct 2024 17:16:44 -0500
Terry Bowman <terry.bowman@amd.com> wrote:

> CXL port error handling will be updated in future and will use
> logic to determine if an error requires CXL or PCIe processing.
> Internal errors are one indicator to identify an error is a CXL
> protocol error.
> 
> is_internal_error() is currently limited by CONFIG_PCIEAER_CXL
> kernel config.
> 
> Update the is_internal_error() function's declaration such that it is
> always available regardless if CONFIG_PCIEAER_CXL kernel config
> is enabled or disabled.
> 
> Signed-off-by: Terry Bowman <terry.bowman@amd.com>
Given this has nothing specifically to do with CXL, this seems
sensible to me.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Dan Williams Oct. 22, 2024, 2:17 a.m. UTC | #2
Terry Bowman wrote:
> CXL port error handling will be updated in future and will use
> logic to determine if an error requires CXL or PCIe processing.
> Internal errors are one indicator to identify an error is a CXL
> protocol error.

I expect it would better to fold this into the patch that makes use of
the is_internal_error() outside of the CONFIG_PCIEAER_CXL case.

With this patch in isolation it is not clear that a kernel that sets
CONFIG_PCIEAER_CXL=n should distinguish PCIe internal errors from CXL
errors.

The real problem seems to be that CONFIG_PCIEAER_CXL depends on CXL_PCI.
I.e. is_internal_error() only matters for the CXL case, and the CXL
handling is moving more into the core and dropping its CXL_PCI
dependency.
Bowman, Terry Oct. 22, 2024, 1:54 p.m. UTC | #3
Hi Dan,

On 10/21/24 21:17, Dan Williams wrote:
> Terry Bowman wrote:
>> CXL port error handling will be updated in future and will use
>> logic to determine if an error requires CXL or PCIe processing.
>> Internal errors are one indicator to identify an error is a CXL
>> protocol error.
> 
> I expect it would better to fold this into the patch that makes use of
> the is_internal_error() outside of the CONFIG_PCIEAER_CXL case.
> 
> With this patch in isolation it is not clear that a kernel that sets
> CONFIG_PCIEAER_CXL=n should distinguish PCIe internal errors from CXL
> errors.
> 
> The real problem seems to be that CONFIG_PCIEAER_CXL depends on CXL_PCI.
> I.e. is_internal_error() only matters for the CXL case, and the CXL
> handling is moving more into the core and dropping its CXL_PCI
> dependency.

I will merge the patch as you described.

Regards,
Terry
diff mbox series

Patch

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index a9792b9576b4..1e72829a249f 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -941,8 +941,15 @@  static bool find_source_device(struct pci_dev *parent,
 	return true;
 }
 
-#ifdef CONFIG_PCIEAER_CXL
+static bool is_internal_error(struct aer_err_info *info)
+{
+	if (info->severity == AER_CORRECTABLE)
+		return info->status & PCI_ERR_COR_INTERNAL;
 
+	return info->status & PCI_ERR_UNC_INTN;
+}
+
+#ifdef CONFIG_PCIEAER_CXL
 /**
  * pci_aer_unmask_internal_errors - unmask internal errors
  * @dev: pointer to the pcie_dev data structure
@@ -994,14 +1001,6 @@  static bool cxl_error_is_native(struct pci_dev *dev)
 	return (pcie_ports_native || host->native_aer);
 }
 
-static bool is_internal_error(struct aer_err_info *info)
-{
-	if (info->severity == AER_CORRECTABLE)
-		return info->status & PCI_ERR_COR_INTERNAL;
-
-	return info->status & PCI_ERR_UNC_INTN;
-}
-
 static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data)
 {
 	struct aer_err_info *info = (struct aer_err_info *)data;