Re: [PATCH] cxl/acpi: Defer probe when ACPI0016 PCI root bridge is not ready

From: Chen Pei

Date: Fri May 15 2026 - 10:06:47 EST


On Thu, 14 May 2026 10:19:43 -0700, Alison Schofield 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@xxxxxxxxxxxxxxxxx>
>
> Hi Chen Pei,
>
> As Richard suggested, this fails for the mock platform in cxl-test.
> (stack trace appended at end)
>
> With this diff applied on top of your patch, it works for cxl-test
> AND I think it works for your case too. With real hardware,
> ACPI_COMPANION returns the device, and with the mock platform,
> ACPI_COMPANION returns NULL and the defer check is skipped.
>
> Try it out, and note that I didn't consider if any of the comments
> need updating.

Hi Alison,

Thanks for the fix!

I'll test it on my RISC-V QEMU setup and fold it into v2 along with
the other review feedback (switching to acpi_dev_hid_match(),
dropping the redundant check in add_host_bridge_uport(), etc.).

Will also run the CXL kselftests to make sure the mock platform path
works correctly.

Thanks,
Pei