Skip to content

Commit 89ac482

Browse files
Perry Yuansuperm1
authored andcommitted
cpufreq: amd-pstate: Cap the CPPC.max_perf to nominal_perf if CPB is off
When Core Performance Boost is disabled by the user, the CPPC_REQ.max_perf should not exceed the nominal_perf since by definition the frequencies between nominal_perf and the highest_perf are in the boost range. Fix this in amd_pstate_update() Acked-by: Huang Rui <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Reviewed-by: Gautham R. Shenoy <[email protected]> Signed-off-by: Perry Yuan <[email protected]> Link: https://lore.kernel.org/r/66f55232be01092c423f0523f68b82b80c293943.1718988436.git.perry.yuan@amd.com Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]>
1 parent c8c68c3 commit 89ac482

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
514514
unsigned long max_freq;
515515
struct cpufreq_policy *policy = cpufreq_cpu_get(cpudata->cpu);
516516
u64 prev = READ_ONCE(cpudata->cppc_req_cached);
517+
u32 nominal_perf = READ_ONCE(cpudata->nominal_perf);
517518
u64 value = prev;
518519

519520
min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf,
@@ -536,6 +537,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
536537
value &= ~AMD_CPPC_DES_PERF(~0L);
537538
value |= AMD_CPPC_DES_PERF(des_perf);
538539

540+
/* limit the max perf when core performance boost feature is disabled */
541+
if (!cpudata->boost_supported)
542+
max_perf = min_t(unsigned long, nominal_perf, max_perf);
543+
539544
value &= ~AMD_CPPC_MAX_PERF(~0L);
540545
value |= AMD_CPPC_MAX_PERF(max_perf);
541546

0 commit comments

Comments
 (0)