public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND][PATCH] EINJ, CXL: Fix CXL device SBDF calculation
@ 2024-09-27 16:34 Ben Cheatham
  2024-09-27 23:21 ` Dan Williams
  2024-09-29  3:22 ` [EXT] " Srinivasulu Opensrc
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Cheatham @ 2024-09-27 16:34 UTC (permalink / raw)
  To: rafael, lenb, james.morse, tony.luck, bp
  Cc: linux-acpi, linux-cxl, dan.j.williams, jonathan.cameron,
	sthanneeru, Ben Cheatham

The SBDF of the target CXL 2.0 compliant root port is required to inject a CXL
protocol error as per ACPI 6.5. The SBDF given has to be in the
following format:

31     24 23    16 15    11 10      8  7        0
+-------------------------------------------------+
| segment |   bus  | device | function | reserved |
+-------------------------------------------------+

The SBDF calculated in cxl_dport_get_sbdf() doesn't account for
the reserved bits currently, causing the wrong SBDF to be used.
Fix said calculation to properly shift the SBDF.

Without this fix, error injection into CXL 2.0 root ports through the
CXL debugfs interface (<debugfs>/cxl) is broken. Injection
through the legacy interface (<debugfs>/apei/einj/) will still work
because the SBDF is manually provided by the user.

Fixes: 12fb28ea6b1cf ("EINJ: Add CXL error type support")
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---

Resent to add linux-cxl list and Srinivasulu to CC

---
 drivers/acpi/apei/einj-cxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c
index 8b8be0c90709..d64e2713aae4 100644
--- a/drivers/acpi/apei/einj-cxl.c
+++ b/drivers/acpi/apei/einj-cxl.c
@@ -63,7 +63,7 @@ static int cxl_dport_get_sbdf(struct pci_dev *dport_dev, u64 *sbdf)
 		seg = bridge->domain_nr;
 
 	bus = pbus->number;
-	*sbdf = (seg << 24) | (bus << 16) | dport_dev->devfn;
+	*sbdf = (seg << 24) | (bus << 16) | (dport_dev->devfn << 8);
 
 	return 0;
 }
-- 
2.34.1


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

* Re: [RESEND][PATCH] EINJ, CXL: Fix CXL device SBDF calculation
  2024-09-27 16:34 [RESEND][PATCH] EINJ, CXL: Fix CXL device SBDF calculation Ben Cheatham
@ 2024-09-27 23:21 ` Dan Williams
  2024-09-29  3:22 ` [EXT] " Srinivasulu Opensrc
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2024-09-27 23:21 UTC (permalink / raw)
  To: Ben Cheatham, rafael, lenb, james.morse, tony.luck, bp
  Cc: linux-acpi, linux-cxl, dan.j.williams, jonathan.cameron,
	sthanneeru, Ben Cheatham

Ben Cheatham wrote:
> The SBDF of the target CXL 2.0 compliant root port is required to inject a CXL
> protocol error as per ACPI 6.5. The SBDF given has to be in the
> following format:
> 
> 31     24 23    16 15    11 10      8  7        0
> +-------------------------------------------------+
> | segment |   bus  | device | function | reserved |
> +-------------------------------------------------+
> 
> The SBDF calculated in cxl_dport_get_sbdf() doesn't account for
> the reserved bits currently, causing the wrong SBDF to be used.
> Fix said calculation to properly shift the SBDF.
> 
> Without this fix, error injection into CXL 2.0 root ports through the
> CXL debugfs interface (<debugfs>/cxl) is broken. Injection
> through the legacy interface (<debugfs>/apei/einj/) will still work
> because the SBDF is manually provided by the user.
> 
> Fixes: 12fb28ea6b1cf ("EINJ: Add CXL error type support")
> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>

Looks good to me.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

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

* RE: [EXT] [RESEND][PATCH] EINJ, CXL: Fix CXL device SBDF calculation
  2024-09-27 16:34 [RESEND][PATCH] EINJ, CXL: Fix CXL device SBDF calculation Ben Cheatham
  2024-09-27 23:21 ` Dan Williams
@ 2024-09-29  3:22 ` Srinivasulu Opensrc
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivasulu Opensrc @ 2024-09-29  3:22 UTC (permalink / raw)
  To: Ben Cheatham, rafael@kernel.org, lenb@kernel.org,
	james.morse@arm.com, tony.luck@intel.com, bp@alien8.de
  Cc: linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org,
	dan.j.williams@intel.com, jonathan.cameron@huawei.com,
	Srinivasulu Thanneeru


Micron Confidential



Micron Confidential
>-----Original Message-----
>From: Ben Cheatham <Benjamin.Cheatham@amd.com>
>Sent: Friday, September 27, 2024 10:04 PM
>To: rafael@kernel.org; lenb@kernel.org; james.morse@arm.com;
>tony.luck@intel.com; bp@alien8.de
>Cc: linux-acpi@vger.kernel.org; linux-cxl@vger.kernel.org;
>dan.j.williams@intel.com; jonathan.cameron@huawei.com; Srinivasulu Thanneeru
><sthanneeru@micron.com>; Ben Cheatham <Benjamin.Cheatham@amd.com>
>Subject: [EXT] [RESEND][PATCH] EINJ, CXL: Fix CXL device SBDF calculation
>
>CAUTION: EXTERNAL EMAIL. Do not click links or open attachments unless you
>recognize the sender and were expecting this message.
>
>
>The SBDF of the target CXL 2.0 compliant root port is required to inject a CXL
>protocol error as per ACPI 6.5. The SBDF given has to be in the
>following format:
>
>31     24 23    16 15    11 10      8  7        0
>+-------------------------------------------------+
>| segment |   bus  | device | function | reserved |
>+-------------------------------------------------+
>
>The SBDF calculated in cxl_dport_get_sbdf() doesn't account for
>the reserved bits currently, causing the wrong SBDF to be used.
>Fix said calculation to properly shift the SBDF.
>
>Without this fix, error injection into CXL 2.0 root ports through the
>CXL debugfs interface (<debugfs>/cxl) is broken. Injection
>through the legacy interface (<debugfs>/apei/einj/) will still work
>because the SBDF is manually provided by the user.
>
>Fixes: 12fb28ea6b1cf ("EINJ: Add CXL error type support")
>Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>

Tried this patch, working fine.

Tested-by: Srinivasulu Thanneeru <sthanneeru.opensrc@micron.com>
Reviewed-by: Srinivasulu Thanneeru <sthanneeru.opensrc@micron.com>

>---
>
>Resent to add linux-cxl list and Srinivasulu to CC
>
>---
> drivers/acpi/apei/einj-cxl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c
>index 8b8be0c90709..d64e2713aae4 100644
>--- a/drivers/acpi/apei/einj-cxl.c
>+++ b/drivers/acpi/apei/einj-cxl.c
>@@ -63,7 +63,7 @@ static int cxl_dport_get_sbdf(struct pci_dev *dport_dev, u64
>*sbdf)
>                seg = bridge->domain_nr;
>
>        bus = pbus->number;
>-       *sbdf = (seg << 24) | (bus << 16) | dport_dev->devfn;
>+       *sbdf = (seg << 24) | (bus << 16) | (dport_dev->devfn << 8);
>
>        return 0;
> }
>--
>2.34.1
>


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

end of thread, other threads:[~2024-09-29  3:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 16:34 [RESEND][PATCH] EINJ, CXL: Fix CXL device SBDF calculation Ben Cheatham
2024-09-27 23:21 ` Dan Williams
2024-09-29  3:22 ` [EXT] " Srinivasulu Opensrc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox