Re: [PATCH RFC v3 01/21] ACPI: Only enumerate enabled (or functional) devices
"Rafael J. Wysocki" <[email protected]> Mon, 29 Jan 2024 16:05:42 +0100
| Newsgroups | org.kernel.vger.linux-ia64,dev.linux.lists.acpica-devel,dev.linux.lists.kvmarm,dev.linux.lists.loongarch,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-acpi,org.kernel.vger.linux-arch,org.kernel.vger.linux-csky,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-parisc,org.kernel.vger.linux-pm |
|---|---|
| Message-ID | <CAJZ5v0iba93EhQB2k3LMdb2YczndbRmF5WGRYHhnqCHq6TQJ0A@mail.gmail.com> |
On Mon, Jan 29, 2024 at 3:55=E2=80=AFPM Russell King (Oracle) <[email protected]> wrote: > > Hi Jonathan, > > On Fri, Jan 12, 2024 at 11:52:05AM +0000, Jonathan Cameron wrote: > > On Thu, 11 Jan 2024 10:26:15 +0000 > > "Russell King (Oracle)" <[email protected]> wrote: > > > @@ -2381,16 +2388,38 @@ EXPORT_SYMBOL_GPL(acpi_dev_clear_dependencies= ); > > > * acpi_dev_ready_for_enumeration - Check if the ACPI device is read= y for enumeration > > > * @device: Pointer to the &struct acpi_device to check > > > * > > > - * Check if the device is present and has no unmet dependencies. > > > + * Check if the device is functional or enabled and has no unmet dep= endencies. > > > * > > > - * Return true if the device is ready for enumeratino. Otherwise, re= turn false. > > > + * Return true if the device is ready for enumeration. Otherwise, re= turn false. > > > */ > > > bool acpi_dev_ready_for_enumeration(const struct acpi_device *device= ) > > > { > > > if (device->flags.honor_deps && device->dep_unmet) > > > return false; > > > > > > - return acpi_device_is_present(device); > > > + /* > > > + * ACPI 6.5's 6.3.7 "_STA (Device Status)" allows firmware to ret= urn > > > + * (!present && functional) for certain types of devices that sho= uld be > > > + * enumerated. Note that the enabled bit should not be set unless= the > > > + * present bit is set. > > > + * > > > + * However, limit this only to processor devices to reduce possib= le > > > + * regressions with firmware. > > > + */ > > > + if (device->status.functional) > > > + return true; > > I have a report from within Oracle that this causes testing failures > with QEMU using -smp cpus=3D2,maxcpus=3D4. I think it needs to be: > > if (!device->status.present) > return device->status.functional; > > if (device->status.enabled) > return true; > > return !acpi_device_is_processor(device); The above is fine by me. > So we can better understand the history here, let's list it as a > truth table. P=3Dpresent, F=3Dfunctional, E=3Denabled, Orig=3Dhow the cod= e > is in mainline, James=3DJames' original proposal, Rafael=3Dthe proposed > replacement but seems to be buggy, Rmk=3Dthe fixed version that passes > tests: > > P F E Orig James Rafael Rmk > 0 0 0 0 0 0 0 > 0 0 1 0 0 0 0 > 0 1 0 1 1 1 1 > 0 1 1 1 0 1 1 > 1 0 0 1 0 !processor !processor > 1 0 1 1 1 1 1 > 1 1 0 1 0 1 !processor > 1 1 1 1 1 1 1 > > Any objections to this? So AFAIAC it can return false if not enabled, but present and functional. [Side note: I'm wondering what "functional" means then, but whatever.]