Re: [PATCHv2 1/3] ACPI: CPPC: Reject desired_perf reads on ACPI 6.6+

Zhongqiu Han <[email protected]> Fri, 31 Jul 2026 18:45:51 +0800
Newsgroups org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.stable
Message-ID <[email protected]>
On 7/29/2026 6:02 PM, Christian Loehle wrote:
> When CPPC feedback counters cannot provide a usable sample, cppc-cpufreq
> calls cppc_get_desired_perf() because some platforms repurpose Desired
> Performance to report actual delivered performance.
> 
> The fallback was added for platforms on which Desired Performance reflects
> delivered performance. ACPI 6.6 defines the register as write-only, so
> invoking that workaround on an ACPI 6.6 or later platform would require an
> invalid register read.
> 
> Make cppc_get_desired_perf() return -EOPNOTSUPP in that case. Its caller
> already handles an error by using the cached desired-performance value.
> When checking the FADT minor revision, mask off its upper errata-generation
> bits and compare only the specification minor version.
> 
> Fixes: c47195631960 ("cppc_cpufreq: Use desired perf if feedback ctrs are 0 or unchanged")

Hi Christian,
Please feel free to correct me if there is any misunderstanding.

ACPI 6.6 was released on 05/13/2025:
https://uefi.org/sites/default/files/resources/ACPI_Spec_6.6.pdf

And the fixes tag commit c47195631960 was committed on 09/29/2024.

Would this be considered an adaptation rather than a regression fix?


With the Fixes tag confirmed/fixed:
Reviewed-by: Zhongqiu Han <[email protected]>

> Cc: [email protected]
> Signed-off-by: Christian Loehle <[email protected]>
> ---
>   drivers/acpi/cppc_acpi.c | 15 ++++++++++++++-
>   1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 53d09ca98f06..6e5381f8de38 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1316,15 +1316,28 @@ static int cppc_set_reg_val(int cpu, enum cppc_regs reg_idx, u64 val)
>   	return cpc_write(cpu, reg, val);
>   }
>   
> +static bool cppc_desired_perf_readable(void)
> +{
> +	u8 minor_revision = acpi_gbl_FADT.minor_revision & 0x0f;
> +
> +	return acpi_gbl_FADT.header.revision < 6 ||
> +	       (acpi_gbl_FADT.header.revision == 6 && minor_revision < 6);
> +}
> +
>   /**
>    * cppc_get_desired_perf - Get the desired performance register value.
>    * @cpunum: CPU from which to get desired performance.
>    * @desired_perf: Return address.
>    *
> - * Return: 0 for success, -EIO otherwise.
> + * Return: 0 for success, -EOPNOTSUPP for ACPI 6.6 or later, and a negative
> + * errno otherwise.
>    */
>   int cppc_get_desired_perf(int cpunum, u64 *desired_perf)
>   {
> +	/* ACPI 6.6 no longer specifies Desired Performance as readable. */
> +	if (!cppc_desired_perf_readable())
> +		return -EOPNOTSUPP;
> +
>   	return cppc_get_reg_val(cpunum, DESIRED_PERF, desired_perf);
>   }
>   EXPORT_SYMBOL_GPL(cppc_get_desired_perf);


-- 
Thx and BRs,
Zhongqiu Han