From: Dave Jiang <dave.jiang@intel.com>
To: Chen Pei <cp0613@linux.alibaba.com>,
dave@stgolabs.net, jic23@kernel.org, alison.schofield@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com, djbw@kernel.org,
guoren@kernel.org
Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cxl/acpi: Defer probe when ACPI0016 PCI root bridge is not ready
Date: Fri, 15 May 2026 08:38:01 -0700 [thread overview]
Message-ID: <4ad8feae-6fc7-4e9d-8509-c9cc365d1c53@intel.com> (raw)
In-Reply-To: <20260514023238.49984-1-cp0613@linux.alibaba.com>
On 5/13/26 7:32 PM, Chen Pei wrote:
> On some platforms (e.g., RISC-V and ARM64) that use the generic
> pci_acpi_scan_root() implementation, cxl_acpi_probe may run before
> acpi_pci_root driver has bound to ACPI0016 (CXL host bridge) devices.
> In this case, acpi_pci_find_root() returns NULL, causing
> to_cxl_host_bridge() to skip the device silently. This results in
> incomplete CXL port enumeration on first boot.
>
> Fix this by detecting the case where an ACPI0016 device exists but its
> PCI root bridge is not yet ready, and returning -EPROBE_DEFER to trigger
> a deferred probe retry.
>
> Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
> ---
> drivers/cxl/acpi.c | 26 ++++++++++++++++++++++++--
> 1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 127537628817..9952d0cff903 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -631,8 +631,21 @@ static int add_host_bridge_dport(struct device *match, void *arg)
> struct acpi_pci_root *pci_root;
> struct cxl_port *root_port = arg;
> struct device *host = root_port->dev.parent;
> - struct acpi_device *hb = to_cxl_host_bridge(host, match);
> + struct acpi_device *adev = to_acpi_device(match);
> + struct acpi_device *hb;
>
> + /*
> + * If this is an ACPI0016 device but acpi_pci_find_root() hasn't
> + * found the PCI root yet (driver not probed), defer the probe
> + * to allow acpi_pci_root to bind first.
> + */
> + if (strcmp(acpi_device_hid(adev), "ACPI0016") == 0 &&
> + !acpi_pci_find_root(adev->handle)) {
I would leave the assignment of 'hb' as is above and just what's below after looking at to_cxl_host_bridge() function.
if (!hb) {
if (!acpi_pci_find_root(adev->handle)) {
...
return -EPROBE_DEFER;
}
return 0;
}
I am concerned of other failure cases that causes acpi_pci_find_root() to fail beyond the driver not being attached. Will cxl_acpi probe() be stuck permanently in the defer probe queue when that happens? This is also something that Sashiko raised. Is there no way to adjust the RISCV ACPI setup to go around subsys_initcall()? That would be preferred solution.
DJ
> + dev_dbg(host, "deferring probe, ACPI0016 PCI root not ready\n");
> + return -EPROBE_DEFER;
> + }
> +
> + hb = to_cxl_host_bridge(host, match);
> if (!hb)
> return 0;
>
> @@ -688,7 +701,8 @@ static int add_host_bridge_uport(struct device *match, void *arg)
> {
> struct cxl_port *root_port = arg;
> struct device *host = root_port->dev.parent;
> - struct acpi_device *hb = to_cxl_host_bridge(host, match);
> + struct acpi_device *adev = to_acpi_device(match);
> + struct acpi_device *hb;
> struct acpi_pci_root *pci_root;
> struct cxl_dport *dport;
> struct cxl_port *port;
> @@ -697,6 +711,14 @@ static int add_host_bridge_uport(struct device *match, void *arg)
> resource_size_t component_reg_phys;
> int rc;
>
> + /* Same deferral check as in add_host_bridge_dport() */
> + if (strcmp(acpi_device_hid(adev), "ACPI0016") == 0 &&
> + !acpi_pci_find_root(adev->handle)) {
> + dev_dbg(host, "deferring probe, ACPI0016 PCI root not ready\n");
> + return -EPROBE_DEFER;
> + }
> +
> + hb = to_cxl_host_bridge(host, match);
> if (!hb)
> return 0;
>
prev parent reply other threads:[~2026-05-15 15:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 2:32 [PATCH] cxl/acpi: Defer probe when ACPI0016 PCI root bridge is not ready Chen Pei
2026-05-14 7:31 ` Richard Cheng
2026-05-15 13:46 ` Chen Pei
2026-05-14 17:10 ` Dave Jiang
2026-05-15 13:53 ` Chen Pei
2026-05-14 17:19 ` Alison Schofield
2026-05-15 13:56 ` Chen Pei
2026-05-15 15:38 ` Dave Jiang [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=4ad8feae-6fc7-4e9d-8509-c9cc365d1c53@intel.com \
--to=dave.jiang@intel.com \
--cc=alison.schofield@intel.com \
--cc=cp0613@linux.alibaba.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=guoren@kernel.org \
--cc=ira.weiny@intel.com \
--cc=jic23@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vishal.l.verma@intel.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