Re: [PATCH] cxl/acpi: Defer probe when ACPI0016 PCI root bridge is not ready
From: Dan Williams (nvidia)
Date: Fri May 15 2026 - 15:34:52 EST
Chen Pei wrote:
> On Thu, 14 May 2026 15:31:11 +0800, Richard Cheng 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>
> > > ---
> > > drivers/cxl/acpi.c | 26 ++++++++++++++++++++++++--
> > > 1 file changed, 24 insertions(+), 2 deletions(-)
> > >
> >
> > Hi Chen Pei,
> >
> > Thanks for the patch.
> > I have a few questions and suggestions regarding to your changes.
> >
> > First of all I would like in which scenario did you encounter the bug?
> > Any specific CONFIG options and the devices ? what's the error log ?
> >
> > It would be nice if you can attach it for us.
>
> Hi Richard,
>
> Thanks for the review.
>
> I'm currently working on bringing up CXL support on the RISC-V QEMU
> virt platform with ACPI (EDK2 UEFI firmware). This is still in the
> early debugging/enabling stage.
>
> During testing, I found that cxl_acpi (ACPI0017) probes before
> acpi_pci_root has bound to the ACPI0016 (CXL host bridge) device.
> RISC-V uses the generic pci_acpi_scan_root() implementation, where
> the probe ordering of acpi_pci_root relative to cxl_acpi is not
> guaranteed.
>
> On x86, acpi_pci_root uses subsys_initcall and binds very early,
> so this race does not manifest there.
If the platform is defined to defer PCI root scans then this dependency
must be declared. Specifically firmware needs to tell Linux about the
dependency given it does not order PCI enumeration before ACPI0017
enumeration by default. Something like:
Device (CXLM) { // ACPI0017
Name (_HID, "ACPI0017")
Name (_DEP, Package () {
\_SB.CXL0, // ACPI0016 host bridge
\_SB.CXL1,
})
}
...in the firmware, and then:
acpi_dev_clear_dependencies()
...for each acpi_pci_root_add().
Then ACPI0017 will naturally await all of the ACPI0016 devices that the
firmware knows about.
Otherwise EPROBE_DEFER and scanning for ACPI0016 attachment is
introducing a mess that _DEP was meant to solve.