All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries
@ 2026-01-09 13:57 Cheatham, Benjamin
  2026-01-09 15:42 ` Dave Jiang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Cheatham, Benjamin @ 2026-01-09 13:57 UTC (permalink / raw)
  To: dave, jonathan.cameron, Dave Jiang, Alison Schofield,
	Dan Williams, vishal.l.verma, ira.weiny
  Cc: linux-cxl, benjamin.cheatham

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.

Fixes: 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
 drivers/cxl/core/port.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index fef3aa0c6680..54f72452fb06 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -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));
-- 
2.52.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries
  2026-01-09 13:57 [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries Cheatham, Benjamin
@ 2026-01-09 15:42 ` Dave Jiang
  2026-01-12 20:11 ` Alison Schofield
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2026-01-09 15:42 UTC (permalink / raw)
  To: Cheatham, Benjamin, dave, jonathan.cameron, Alison Schofield,
	Dan Williams, vishal.l.verma, ira.weiny
  Cc: linux-cxl



On 1/9/26 6:57 AM, Cheatham, Benjamin wrote:
> 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.
> 
> Fixes: 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")
> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>


> ---
>  drivers/cxl/core/port.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index fef3aa0c6680..54f72452fb06 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -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));


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries
  2026-01-09 13:57 [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries Cheatham, Benjamin
  2026-01-09 15:42 ` Dave Jiang
@ 2026-01-12 20:11 ` Alison Schofield
  2026-01-15 18:30 ` Jonathan Cameron
  2026-01-15 18:43 ` Dave Jiang
  3 siblings, 0 replies; 5+ messages in thread
From: Alison Schofield @ 2026-01-12 20:11 UTC (permalink / raw)
  To: Cheatham, Benjamin
  Cc: dave, jonathan.cameron, Dave Jiang, Dan Williams, vishal.l.verma,
	ira.weiny, linux-cxl

On Fri, Jan 09, 2026 at 07:57:38AM -0600, Cheatham, Benjamin wrote:
> 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.
> 
> Fixes: 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")
> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>

Reviewed-by: Alison Schofield <alison.schofield@intel.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries
  2026-01-09 13:57 [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries Cheatham, Benjamin
  2026-01-09 15:42 ` Dave Jiang
  2026-01-12 20:11 ` Alison Schofield
@ 2026-01-15 18:30 ` Jonathan Cameron
  2026-01-15 18:43 ` Dave Jiang
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-01-15 18:30 UTC (permalink / raw)
  To: Cheatham, Benjamin
  Cc: dave, Dave Jiang, Alison Schofield, Dan Williams, vishal.l.verma,
	ira.weiny, linux-cxl

On Fri, 9 Jan 2026 07:57:38 -0600
"Cheatham, Benjamin" <benjamin.cheatham@amd.com> wrote:

> 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.
> 
> Fixes: 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")
> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries
  2026-01-09 13:57 [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries Cheatham, Benjamin
                   ` (2 preceding siblings ...)
  2026-01-15 18:30 ` Jonathan Cameron
@ 2026-01-15 18:43 ` Dave Jiang
  3 siblings, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2026-01-15 18:43 UTC (permalink / raw)
  To: Cheatham, Benjamin, dave, jonathan.cameron, Alison Schofield,
	Dan Williams, vishal.l.verma, ira.weiny
  Cc: linux-cxl



On 1/9/26 6:57 AM, Cheatham, Benjamin wrote:
> 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.
> 
> Fixes: 8039804cfa73 ("cxl/core: Add CXL EINJ debugfs files")
> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>

Applied to cxl/next
5c604e7a9f6c215a7942671f62b76461678960b1


> ---
>  drivers/cxl/core/port.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index fef3aa0c6680..54f72452fb06 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -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));


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-15 18:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09 13:57 [PATCH] cxl/core: Fix cxl_dport debugfs EINJ entries Cheatham, Benjamin
2026-01-09 15:42 ` Dave Jiang
2026-01-12 20:11 ` Alison Schofield
2026-01-15 18:30 ` Jonathan Cameron
2026-01-15 18:43 ` Dave Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.