The existing cppc_perf_from_fbctrs() returns a cached desired perf if the delta of feedback counters is 0. Some platforms may update the real frequency back to the desired perf reg. Try getting the latest desired perf first; if failed, return the cached desired perf. Signed-off-by: Jie Zhan <zhanjie9@xxxxxxxxxxxxx> Reviewed-by: Zeng Heng <zengheng4@xxxxxxxxxx> --- drivers/cpufreq/cppc_cpufreq.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 6aa3af56924b..c8fe0f1fc22b 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -715,7 +715,8 @@ static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data, struct cppc_perf_fb_ctrs *fb_ctrs_t1) { u64 delta_reference, delta_delivered; - u64 reference_perf; + u64 reference_perf, desired_perf; + int cpu, ret; reference_perf = fb_ctrs_t0->reference_perf; @@ -725,8 +726,14 @@ static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data, fb_ctrs_t0->delivered); /* Check to avoid divide-by zero and invalid delivered_perf */ - if (!delta_reference || !delta_delivered) - return cpu_data->perf_ctrls.desired_perf; + if (!delta_reference || !delta_delivered) { + cpu = cpumask_first(cpu_data->shared_cpu_map); + ret = cppc_get_desired_perf(cpu, &desired_perf); + if (ret) + return cpu_data->perf_ctrls.desired_perf; + + return desired_perf; + } return (reference_perf * delta_delivered) / delta_reference; } -- 2.33.0