From: "Cheatham, Benjamin" <benjamin.cheatham@amd.com>
To: Alison Schofield <alison.schofield@intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>,
Hanjun Guo <guohanjun@huawei.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Shuai Xue <xueshuai@linux.alibaba.com>,
Len Brown <lenb@kernel.org>
Cc: <linux-acpi@vger.kernel.org>, <linux-cxl@vger.kernel.org>,
Pei Gao <pei.gao@intel.com>
Subject: Re: [PATCH] EINJ, CXL: Use PCI domain for CXL root port error injection
Date: Fri, 6 Nov 2026 11:29:58 -0600 [thread overview]
Message-ID: <68be7924-bac8-4b99-9c2d-3ebe35a3f0bc@amd.com> (raw)
In-Reply-To: <20261105184643.907678-1-alison.schofield@intel.com>
On 11/5/2026 12:46 PM, Alison Schofield wrote:
> CXL protocol error injection identifies the target root port to firmware
> using its PCI segment, bus, device, and function (SBDF).
>
> The segment is taken from the PCI host bridge's domain_nr, which is
> only populated for emulated PCI domains. On ACPI systems, firmware
> receives segment 0 even when the target root port belongs to a nonzero
> segment, identifying the wrong PCI device for error injection.
>
> Use the PCI domain of the target root port to obtain the correct segment.
> With the host bridge lookup removed, cxl_dport_get_sbdf() can return the
> SBDF directly.
>
> Reported-by: Pei Gao <pei.gao@intel.com>
> Fixes: 12fb28ea6b1c ("EINJ: Add CXL error type support")
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
>
> The ACPI EINJ SBDF field limits the PCI segment to 8 bits, while PCI
> segment numbers can be 16 bits. A segment greater than 0xff would be
> silently truncated, potentially targeting the wrong device.
>
> I'm unsure how likely systems are to use segments above 0xff. Is this
> a practical concern? Would a range check to enforce the ACPI limit
> be warranted in a follow-up patch?
I don't think I've ever seen a segment of 0xff, so I think it's probably uncommon.
I think a range check would be a good addition since it's enforcing the ACPI spec and
it's relatively low effort, but that's just my opinion :).
Thanks,
Ben
> ---
> drivers/acpi/apei/einj-cxl.c | 29 +++++++----------------------
> 1 file changed, 7 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c
> index e70a416ec925..4c8f014378bc 100644
> --- a/drivers/acpi/apei/einj-cxl.c
> +++ b/drivers/acpi/apei/einj-cxl.c
> @@ -47,25 +47,12 @@ int einj_cxl_available_error_type_show(struct seq_file *m, void *v)
> }
> EXPORT_SYMBOL_NS_GPL(einj_cxl_available_error_type_show, "CXL");
>
> -static int cxl_dport_get_sbdf(struct pci_dev *dport_dev, u64 *sbdf)
> +static u64 cxl_dport_get_sbdf(struct pci_dev *dport_dev)
> {
> - struct pci_bus *pbus;
> - struct pci_host_bridge *bridge;
> - u64 seg = 0, bus;
> + u64 seg = pci_domain_nr(dport_dev->bus);
> + u64 bus = dport_dev->bus->number;
>
> - pbus = dport_dev->bus;
> - bridge = pci_find_host_bridge(pbus);
> -
> - if (!bridge)
> - return -ENODEV;
> -
> - if (bridge->domain_nr != PCI_DOMAIN_NR_NOT_SET)
> - seg = bridge->domain_nr;
> -
> - bus = pbus->number;
> - *sbdf = (seg << 24) | (bus << 16) | (dport_dev->devfn << 8);
> -
> - return 0;
> + return (seg << 24) | (bus << 16) | (dport_dev->devfn << 8);
> }
>
> int einj_cxl_inject_rch_error(u64 rcrb, u64 type)
> @@ -87,7 +74,7 @@ EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_rch_error, "CXL");
>
> int einj_cxl_inject_error(struct pci_dev *dport, u64 type)
> {
> - u64 param4 = 0;
> + u64 sbdf;
> int rc;
>
> /* Only CXL error types can be specified */
> @@ -98,11 +85,9 @@ int einj_cxl_inject_error(struct pci_dev *dport, u64 type)
> if (rc)
> return rc;
>
> - rc = cxl_dport_get_sbdf(dport, ¶m4);
> - if (rc)
> - return rc;
> + sbdf = cxl_dport_get_sbdf(dport);
>
> - return einj_error_inject(type, 0x4, 0, 0, 0, param4);
> + return einj_error_inject(type, 0x4, 0, 0, 0, sbdf);
> }
> EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_error, "CXL");
>
>
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
prev parent reply other threads:[~2026-11-06 17:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 18:46 [PATCH] EINJ, CXL: Use PCI domain for CXL root port error injection Alison Schofield
2026-11-06 17:29 ` Cheatham, Benjamin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=68be7924-bac8-4b99-9c2d-3ebe35a3f0bc@amd.com \
--to=benjamin.cheatham@amd.com \
--cc=alison.schofield@intel.com \
--cc=bp@alien8.de \
--cc=guohanjun@huawei.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pei.gao@intel.com \
--cc=rafael@kernel.org \
--cc=tony.luck@intel.com \
--cc=xueshuai@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox