cxl/core: Fix cxl_dport debugfs EINJ entries
PATCH 1/1 cxl/core: Fix cxl_dport debugfs EINJ entries
Protocol error injection is only valid for CXL 2.0+ root ports and CXL 1.1 memory-mapped downstream ports as per the ACPI v6.5 spec (Table 8-31). The core code currently creates an 'einj_inject' file in CXL debugfs for all CXL 1.1 downstream ports and all PCI CXL 2.0+ downstream ports. This results in debugfs EINJ files that won't work due to platform/spec restrictions.
Fix by limiting 'einj_inject' file creation to only CXL 1.1 dports and CXL 2.0+ root ports. Update the comment above the check to more accurately represent the requirements expected by the EINJ module and ACPI spec.
--- drivers/cxl/core/port.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/cxl/core/port.c +5 -3
@@ -822,16 +822,18 @@ DEFINE_DEBUGFS_ATTRIBUTE(cxl_einj_inject_fops, NULL, cxl_einj_inject,static void cxl_debugfs_create_dport_dir (struct cxl_dport *dport) { +struct cxl_port *parent =parent_port_of (dport->port);struct dentry *dir;if (!einj_cxl_is_initialized ())return ;/* -* dport_dev needs to be a PCIe port for CXL 2.0+ ports because -* EINJ expects a dport SBDF to be specified for 2.0 error injection. +* Protocol error injection is only available for CXL 2.0+ root ports +* and CXL 1.1 downstream ports */ -if (!dport->rch && !dev_is_pci (dport->dport_dev)) +if (!dport->rch && + !(dev_is_pci (dport->dport_dev) && parent &&is_cxl_root (parent)))return ; dir =cxl_debugfs_create_dir (dev_name (dport->dport_dev));
Signature · 1 line
2.52.0
Quoted 7 lines · Benjamin
Protocol error injection is only valid for CXL 2.0+ root ports and CXL 1.1 memory-mapped downstream ports as per the ACPI v6.5 spec (Table 8-31). The core code currently creates an '
einj_inject' file in CXL debugfs for all CXL 1.1 downstream ports and all PCI CXL 2.0+ downstream ports. This results in debugfs EINJ files that won't work due to platform/spec restrictions.
Quoted 6 lines
Fix by limiting '
einj_inject' file creation to only CXL 1.1 dports and CXL 2.0+ root ports. Update the comment above the check to more accurately represent the requirements expected by the EINJ module and ACPI spec.Fixes 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")Signed-off-by Ben Cheatham <[email protected]>
Quoted 30 lines
--- drivers/cxl/core/port.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/cxl/core/port.c +5
-3@@ -822,16 +822,18 @@ DEFINE_DEBUGFS_ATTRIBUTE(cxl_einj_inject_fops, NULL, cxl_einj_inject,static void cxl_debugfs_create_dport_dir (struct cxl_dport *dport) { +struct cxl_port *parent =parent_port_of (dport->port);struct dentry *dir;if (!einj_cxl_is_initialized ())return ;/* -* dport_dev needs to be a PCIe port for CXL 2.0+ ports because -* EINJ expects a dport SBDF to be specified for 2.0 error injection. +* Protocol error injection is only available for CXL 2.0+ root ports +* and CXL 1.1 downstream ports */ -if (!dport->rch && !dev_is_pci (dport->dport_dev)) +if (!dport->rch && + !(dev_is_pci (dport->dport_dev) && parent &&is_cxl_root (parent)))return ; dir =cxl_debugfs_create_dir (dev_name (dport->dport_dev));
Quoted 7 lines · Benjamin
Protocol error injection is only valid for CXL 2.0+ root ports and CXL 1.1 memory-mapped downstream ports as per the ACPI v6.5 spec (Table 8-31). The core code currently creates an '
einj_inject' file in CXL debugfs for all CXL 1.1 downstream ports and all PCI CXL 2.0+ downstream ports. This results in debugfs EINJ files that won't work due to platform/spec restrictions.
Quoted 6 lines
Fix by limiting '
einj_inject' file creation to only CXL 1.1 dports and CXL 2.0+ root ports. Update the comment above the check to more accurately represent the requirements expected by the EINJ module and ACPI spec.Fixes 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")Signed-off-by Ben Cheatham <[email protected]>
Quoted 7 lines · Benjamin
Protocol error injection is only valid for CXL 2.0+ root ports and CXL 1.1 memory-mapped downstream ports as per the ACPI v6.5 spec (Table 8-31). The core code currently creates an '
einj_inject' file in CXL debugfs for all CXL 1.1 downstream ports and all PCI CXL 2.0+ downstream ports. This results in debugfs EINJ files that won't work due to platform/spec restrictions.
Quoted 6 lines
Fix by limiting '
einj_inject' file creation to only CXL 1.1 dports and CXL 2.0+ root ports. Update the comment above the check to more accurately represent the requirements expected by the EINJ module and ACPI spec.Fixes 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")Signed-off-by Ben Cheatham <[email protected]>
Quoted 7 lines · Benjamin
Protocol error injection is only valid for CXL 2.0+ root ports and CXL 1.1 memory-mapped downstream ports as per the ACPI v6.5 spec (Table 8-31). The core code currently creates an '
einj_inject' file in CXL debugfs for all CXL 1.1 downstream ports and all PCI CXL 2.0+ downstream ports. This results in debugfs EINJ files that won't work due to platform/spec restrictions.
Quoted 6 lines
Fix by limiting '
einj_inject' file creation to only CXL 1.1 dports and CXL 2.0+ root ports. Update the comment above the check to more accurately represent the requirements expected by the EINJ module and ACPI spec.Fixes 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")Signed-off-by Ben Cheatham <[email protected]>
Applied to cxl/next5c604e7a9f6c215a7942671f62b76461678960b1
Quoted 30 lines
--- drivers/cxl/core/port.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/cxl/core/port.c +5
-3@@ -822,16 +822,18 @@ DEFINE_DEBUGFS_ATTRIBUTE(cxl_einj_inject_fops, NULL, cxl_einj_inject,static void cxl_debugfs_create_dport_dir (struct cxl_dport *dport) { +struct cxl_port *parent =parent_port_of (dport->port);struct dentry *dir;if (!einj_cxl_is_initialized ())return ;/* -* dport_dev needs to be a PCIe port for CXL 2.0+ ports because -* EINJ expects a dport SBDF to be specified for 2.0 error injection. +* Protocol error injection is only available for CXL 2.0+ root ports +* and CXL 1.1 downstream ports */ -if (!dport->rch && !dev_is_pci (dport->dport_dev)) +if (!dport->rch && + !(dev_is_pci (dport->dport_dev) && parent &&is_cxl_root (parent)))return ; dir =cxl_debugfs_create_dir (dev_name (dport->dport_dev));