ACPI: CPPC: Stop reading desired_perf in cppc_get_perf()

cppc_get_perf() has one in-tree caller, cppc_cpufreq_get_cpu_data().
It uses the function to preserve existing controls before writing them, but
overwrites desired_perf with highest_perf before the first cppc_set_perf().
Consequently, the current Desired Performance value is not consumed.

Remove the Desired Performance read from this aggregate getter and
document that the field is returned as zero.

Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/20260803203531.1268651-4-christian.loehle@arm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Christian Loehle 2026-08-03 21:35:31 +01:00 committed by Rafael J. Wysocki
parent d3576424e8
commit 334dd0ed87

View File

@ -1834,41 +1834,38 @@ EXPORT_SYMBOL_GPL(cppc_set_enable);
* @cpu: CPU for which to get performance controls.
* @perf_ctrls: ptr to cppc_perf_ctrls. See cppc_acpi.h
*
* Desired Performance is not read and is returned as 0.
*
* Return: 0 for success with perf_ctrls, -ERRNO otherwise.
*/
int cppc_get_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
{
struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu);
struct cpc_register_resource *desired_perf_reg,
*min_perf_reg, *max_perf_reg,
struct cpc_register_resource *min_perf_reg, *max_perf_reg,
*energy_perf_reg, *auto_sel_reg;
u64 desired_perf = 0, min = 0, max = 0, energy_perf = 0, auto_sel = 0;
u64 min = 0, max = 0, energy_perf = 0, auto_sel = 0;
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
struct cppc_pcc_data *pcc_ss_data = NULL;
bool read_desired_perf;
int ret = 0, regs_in_pcc = 0;
if (!cpc_desc) {
pr_debug("No CPC descriptor for CPU:%d\n", cpu);
return -ENODEV;
}
read_desired_perf = cppc_desired_perf_readable(cpc_desc);
if (!perf_ctrls) {
pr_debug("Invalid perf_ctrls pointer\n");
return -EINVAL;
}
desired_perf_reg = &cpc_desc->cpc_regs[DESIRED_PERF];
min_perf_reg = &cpc_desc->cpc_regs[MIN_PERF];
max_perf_reg = &cpc_desc->cpc_regs[MAX_PERF];
energy_perf_reg = &cpc_desc->cpc_regs[ENERGY_PERF];
auto_sel_reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE];
/* Are any of the regs PCC ?*/
if ((read_desired_perf && CPC_IN_PCC(desired_perf_reg)) ||
CPC_IN_PCC(min_perf_reg) ||
CPC_IN_PCC(max_perf_reg) || CPC_IN_PCC(energy_perf_reg) ||
if (CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg) ||
CPC_IN_PCC(energy_perf_reg) ||
CPC_IN_PCC(auto_sel_reg)) {
if (pcc_ss_id < 0) {
pr_debug("Invalid pcc_ss_id for CPU:%d\n", cpu);
@ -1899,12 +1896,7 @@ int cppc_get_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
}
perf_ctrls->min_perf = min;
if (read_desired_perf && CPC_SUPPORTED(desired_perf_reg)) {
ret = cpc_read(cpu, desired_perf_reg, &desired_perf);
if (ret)
goto out_err;
}
perf_ctrls->desired_perf = desired_perf;
perf_ctrls->desired_perf = 0;
if (CPC_SUPPORTED(energy_perf_reg)) {
ret = cpc_read(cpu, energy_perf_reg, &energy_perf);