Re: [PATCH v3 3/3] cpufreq/amd-pstate: Get Highest Freq for a CPU
From: Mario Limonciello
Date: Thu Oct 01 2026 - 10:06:22 EST
On 10/1/26 05:03, Christian Loehle wrote:
On 9/24/26 17:00, Mario Limonciello (AMD) wrote:That's an excellent finding, thanks.
From: Mario Limonciello <mario.limonciello@xxxxxxx>
If the highest frequency is known for a CPU, use this instead of
trying to calculate by linear interpolation.
Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
drivers/cpufreq/amd-pstate.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 496e0342c1c90..2a0cbfe21a67d 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1102,8 +1102,10 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)
WRITE_ONCE(cpudata->nominal_freq, nominal_freq);
- /* max_freq is calculated according to (nominal_freq * highest_perf)/nominal_perf */
- max_freq = perf_to_freq(perf, nominal_freq, perf.highest_perf);
+ /* try to look up from BIOS/quirk first, fall back to (nominal_freq * highest_perf)/nominal_perf */
+ max_freq = amd_get_max_frequency(cpudata->cpu) * 1000;
+ if (!max_freq)
+ max_freq = perf_to_freq(perf, nominal_freq, perf.highest_perf);
Don't you need to align freq_to_perf() (or the callers) for the BIOS-overwrite case too?
amd_pstate_update_min_max_limit() still uses the nominal-based conversion for policy->max,
so the new maximum frequency maps back to highest_perf on each core type?
(and we end up with max_limit_perf < highest_perf if the BIOS-overwrite values are below
the interpolation result.)