]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: CPPC: Skip writes to unsupported performance controls
authorChristian Loehle <christian.loehle@arm.com>
Fri, 24 Jul 2026 10:40:42 +0000 (11:40 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 27 Jul 2026 13:18:50 +0000 (15:18 +0200)
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 <sumitg@nvidia.com>
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Link: https://patch.msgid.link/20260724104042.1481804-1-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/cppc_acpi.c

index 1d3a941004912147cb5bacb44f30e8d87b03d372..53d09ca98f06683f3a33949d5dcf815b57b73a10 100644 (file)
@@ -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);
 
        /*
         * Only write if min_perf and max_perf not zero. Some drivers pass zero
         * value to min and max perf, but they don't mean to set the zero value,
         * they just don't want to write to those registers.
         */
-       if (perf_ctrls->min_perf)
+       if (perf_ctrls->min_perf && CPC_SUPPORTED(min_perf_reg))
                cpc_write(cpu, min_perf_reg, perf_ctrls->min_perf);
-       if (perf_ctrls->max_perf)
+       if (perf_ctrls->max_perf && CPC_SUPPORTED(max_perf_reg))
                cpc_write(cpu, max_perf_reg, perf_ctrls->max_perf);
 
        if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg))