Re: [PATCH v1 1/8] ACPI: bus: Fix handling of _OSC errors in acpi_run_osc()

From: Jonathan Cameron

Date: Fri Dec 19 2025 - 07:26:24 EST


On Thu, 18 Dec 2025 21:34:26 +0100
"Rafael J. Wysocki" <rafael@xxxxxxxxxx> wrote:

> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> The handling of _OSC errors in acpi_run_osc() is inconsistent.

I wonder if this would be easier to follow with a brief statement
of why we threat OSC_CAPABILITIES_MASK_ERROR as an error in the first
place for non query cases? It took me a brief think and spec read
to figure that out, but maybe more coffee needed.

>
> For example, if OSC_CAPABILITIES_MASK_ERROR is set in the return buffer
> and OSC_QUERY_ENABLE is set in the capabilities buffer, all of the
> _OSC errors will be ignored even though some of them indicate that
> _OSC evaluation has failed. However, if OSC_QUERY_ENABLE is not set in
> the capabilities buffer, all _OSC errors will be reported, but the error
> value returned by acpi_run_osc() depends on whether or not
> OSC_CAPABILITIES_MASK_ERROR is set in the return buffer.
>
> Adress this by making acpi_run_osc() clear OSC_CAPABILITIES_MASK_ERROR
> in the return buffer if OSC_QUERY_ENABLE is set in the capabilities
> buffer and then check if any other _OSC errors have been returned. Also
> make it use the same error return value for all _OSC errors and print
> a message for OSC_CAPABILITIES_MASK_ERROR like for the other error
> types.
>
> Moreover, make acpi_run_osc() only take the defined _OSC error bits into
> account when checking _OSC errors.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Changes look good to me.
Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>