[PATCH 4/4] cpufreq: amd-pstate-ut: Don't require max_freq >= nominal_freq
From: Mario Limonciello
Date: Mon Sep 21 2026 - 15:04:39 EST
amd_pstate_ut_check_freq() asserts the ordering
max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0
but max_freq >= nominal_freq does not hold on all parts. On
heterogeneous Zen6 client, amd_get_max_frequency() returns a hardcoded
per-CPU-type maximum frequency, and the low-power cores cap below the
shared nominal reference frequency. On a 20-core Zen6 sample the four
low-power cores report a maximum of 2399 MHz against a nominal of
2400 MHz, so the test fails:
```
amd_pstate_ut: amd_pstate_ut_check_freq cpu8 max=2399000 >= nominal=2400000 ... the formula is incorrect!
amd_pstate_ut: 4 amd_pstate_ut_check_freq fail: -22!
```
The maximum frequency is a boost ceiling and its relationship to the
nominal reference is platform dependent, so only require it to sit above
the lowest nonlinear frequency, which holds on every core. The rest of
the ordering (nominal_freq > lowest_nonlinear_freq >= min_freq > 0) is
kept unchanged.
Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
drivers/cpufreq/amd-pstate-ut.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
index f5888beb767a8..e4e85514d0b67 100644
--- a/drivers/cpufreq/amd-pstate-ut.c
+++ b/drivers/cpufreq/amd-pstate-ut.c
@@ -216,7 +216,14 @@ static int amd_pstate_ut_check_perf(u32 index)
/*
* Check if frequency values are reasonable.
- * max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0
+ * nominal_freq > lowest_nonlinear_freq >= min_freq > 0
+ * max_freq >= lowest_nonlinear_freq
+ *
+ * On most parts the boost frequency is the highest, i.e.
+ * max_freq >= nominal_freq. On heterogeneous designs (e.g. Zen6) a
+ * low-power core can have a maximum frequency below the shared nominal
+ * reference frequency, so only require the boost frequency to sit above
+ * the lowest nonlinear frequency here.
* check max freq when set support boost mode.
*/
static int amd_pstate_ut_check_freq(u32 index)
@@ -235,11 +242,11 @@ static int amd_pstate_ut_check_freq(u32 index)
cpudata = policy->driver_data;
perf = READ_ONCE(cpudata->perf);
- if (!((policy->cpuinfo.max_freq >= cpudata->nominal_freq) &&
+ if (!((policy->cpuinfo.max_freq >= cpudata->lowest_nonlinear_freq) &&
(cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) &&
(cpudata->lowest_nonlinear_freq >= policy->cpuinfo.min_freq) &&
(policy->cpuinfo.min_freq > 0))) {
- pr_err("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect!\n",
+ pr_err("%s cpu%d max=%d, nominal=%d, lowest_nonlinear=%d, min=%d, the formula is incorrect!\n",
__func__, cpu, policy->cpuinfo.max_freq, cpudata->nominal_freq,
cpudata->lowest_nonlinear_freq, policy->cpuinfo.min_freq);
return -EINVAL;
--
2.43.0