[PATCH 2/2] cpufreq/amd-pstate: Clamp desired perf on resume

From: Christian Loehle

Date: Thu Oct 29 2026 - 08:20:30 EST


amd_pstate_resume() converts policy->cur to a performance level and
writes it directly alongside the cached policy limits. Both
frequency/performance conversions round up, so the converted value
can exceed max_limit_perf even when the request before suspend was
within the policy limits.

On a Ryzen 5 7430U with a fixed 1.2 GHz policy, a request with
Desired=46 becomes policy->cur=1216621 kHz and converts back to
Desired=47. Resume then writes MIN=46, Desired=47, MAX=46.

Clamp the converted Desired to the cached minimum and maximum before
restoring the request.

Fixes: 608a76b65288 ("cpufreq/amd-pstate: Add support for the "Requested CPU Min frequency" BIOS option")
Signed-off-by: Christian Loehle <christian.loehle@xxxxxxx>
---
drivers/cpufreq/amd-pstate.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 28df8507d93f..0b1b0e263577 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -2211,6 +2211,7 @@ static int amd_pstate_resume(struct cpufreq_policy *policy)
int ret;

/* Set CPPC_REQ to last sane value until the governor updates it */
+ cur_perf = clamp(cur_perf, perf.min_limit_perf, perf.max_limit_perf);
ret = amd_pstate_update_perf(policy, perf.min_limit_perf, cur_perf, perf.max_limit_perf,
0U, false);
if (ret)
--
2.34.1