Re: [PATCH] ACPI: CPPC: Skip writes to unsupported performance controls

Sudeep Holla <[email protected]>
Newsgroups gmane.linux.acpi.devel,gmane.linux.power-management.general,gmane.linux.kernel
Message-ID <20260724-astonishing-hysterical-goldfish-87f8df@sudeepholla>
On Fri, Jul 24, 2026 at 11:40:42AM +0100, Christian Loehle wrote:
> MIN_PERF and MAX_PERF are optional CPPC controls. DESIRED_PERF is also
> optional with CPPC2 when autonomous selection is supported.
> 
> The cppc-cpufreq target callbacks populate both limits for every request
> without checking whether the controls are implemented. cppc_set_perf()
> consequently passes NULL register descriptors to cpc_write(). The writes
> fail width validation and their return values are ignored, so the failed
> access paths are repeated on every target request. An autonomous-only
> platform can take the same path for DESIRED_PERF.
> 
> Check that each performance control is supported before calling
> cpc_write().
> 
> Fixes: ea3db45ae476 ("cpufreq: cppc: Update MIN_PERF/MAX_PERF in target callbacks")
> Reviewed-by: Sumit Gupta <[email protected]>
> Signed-off-by: Christian Loehle <[email protected]>
> ---
> v2: Also added desired_perf check (Sumit)
> 
>  drivers/acpi/cppc_acpi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 1d3a94100491..53d09ca98f06 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1963,16 +1963,17 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
>  		cpc_desc->write_cmd_status = 0;
>  	}
>  
> -	cpc_write(cpu, desired_reg, perf_ctrls->desired_perf);
> +	if (CPC_SUPPORTED(desired_reg))
> +		cpc_write(cpu, desired_reg, perf_ctrls->desired_perf);
>  

In general, can't be set perf_ctrls->desired_perf if and only if
CPC_SUPPORTED(desired_reg) ?

I see cppc_get_perf() does that but I assume you are catering for some
other access that may happen before ?

-- 
Regards,
Sudeep
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.