[PATCH 6/6] cpufreq/amd-pstate: Get highest freq from CPPC if available

Mario Limonciello (AMD)
2026-04-27T03:55:35Z

If the _CPC object advertises the highest frequency for a CPU,
use this instead of trying to calculate by linear interpolation.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
drivers/cpufreq/amd-pstate.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index f5c7cc05220c4..9703b54ee4820 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1026,8 +1026,12 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)

WRITE_ONCE(cpudata->nominal_freq, nominal_freq);

+ /* max freq came from _CPC */
+ if (cppc_perf.highest_freq)
+ max_freq = cppc_perf.highest_freq * 1000;
/* max_freq is calculated according to (nominal_freq * highest_perf)/nominal_perf */
- max_freq = perf_to_freq(perf, nominal_freq, perf.highest_perf);
+ else
+ max_freq = perf_to_freq(perf, nominal_freq, perf.highest_perf);
WRITE_ONCE(cpudata->max_freq, max_freq);

lowest_nonlinear_freq = perf_to_freq(perf, nominal_freq, perf.lowest_nonlinear_perf);
--
2.43.0