On Thu, Dec 5, 2024 at 8:24 AM Miao Wang <shankerwangmiao@xxxxxxxxx> wrote: > > > > 2024年12月4日 03:44,Rafael J. Wysocki <rafael@xxxxxxxxxx> 写道: > > > > Hi, > > > > Sorry for the delay. > > > > On Thu, Nov 21, 2024 at 10:57 PM Miao Wang <shankerwangmiao@xxxxxxxxx> wrote: > >> > >> 2023年11月7日 00:09,Rafael J. Wysocki <rjw@xxxxxxxxxxxxx> 写道: > >>> > >>> +static acpi_status acpi_bus_check_add(acpi_handle handle, bool first_pass, > >>> struct acpi_device **adev_p) > >>> { > >>> struct acpi_device *device = acpi_fetch_acpi_dev(handle); > >>> @@ -2054,9 +2059,25 @@ static acpi_status acpi_bus_check_add(ac > >>> if (acpi_device_should_be_hidden(handle)) > >>> return AE_OK; > >>> > >>> - /* Bail out if there are dependencies. */ > >>> - if (acpi_scan_check_dep(handle, check_dep) > 0) > >>> - return AE_CTRL_DEPTH; > >>> + if (first_pass) { > >>> + acpi_mipi_check_crs_csi2(handle); > >>> + > >>> + /* Bail out if there are dependencies. */ > >>> + if (acpi_scan_check_dep(handle) > 0) { > >>> + /* > >>> + * The entire CSI-2 connection graph needs to be > >>> + * extracted before any drivers or scan handlers > >>> + * are bound to struct device objects, so scan > >>> + * _CRS CSI-2 resource descriptors for all > >>> + * devices below the current handle. > >>> + */ > >>> + acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, > >>> + ACPI_UINT32_MAX, > >>> + acpi_scan_check_crs_csi2_cb, > >>> + NULL, NULL, NULL); > >>> + return AE_CTRL_DEPTH; > >>> + } > >>> + } > >>> > >>> fallthrough; > >>> case ACPI_TYPE_ANY: /* for ACPI_ROOT_OBJECT */ > >>> > >> > >> Hi, I'd like to report some issues caused by this patch. Correct me if I'm wrong > >> since I'm not expert on ACPI. Before this patch, properties of ACPI devices with > >> _DEP relationship declared were evaluated after the initialization of the > >> depending devices, i.e. the execution of handler->attach(). With this patch, > >> _CRS of all the ACPI devices are evaluated to check if the device contains a > >> CSI2 resource, regardless of the declaration of _DEP relationship. [cut] > > Maybe we can prioritize the initialization of the PCI host bridge to > fully eliminate this issue? The problem with this is that the current code requires struct acpi_device objects to be present for all PCI devices that have corresponding objects in the ACPI Namespace at the time when the host bridge is initialized because that causes the PCI bus to be scanned for devices and struct acpi_device objects are looked up from there. To make this work, the "ACPI companion lookup" code needs to be changed and that would be kind of a heavy lifting and it may introduce some unexpected enumeration ordering issues. Alternatively, the PCI host bridge could be initialized early, but without scanning the PCI bus which would be scanned at the time when all of the struct acpi_device objects are present. It looks like this could be made work, but it would require some investigation and code refactoring.