Skip to content

Commit 22fb4f0

Browse files
superm1rafaeljw
authored andcommitted
cpufreq/amd-pstate: Fix setting scaling max/min freq values
Scaling min/max freq values were being cached and lagging a setting each time. Fix the ordering of the clamp call to ensure they work. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217931 Fixes: febab20 ("cpufreq/amd-pstate: Fix scaling_min_freq and scaling_max_freq update") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Wyes Karny <wkarny@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 192cdb1 commit 22fb4f0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,14 +1232,13 @@ static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
12321232
max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq);
12331233
min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq);
12341234

1235+
WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf);
1236+
WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf);
1237+
12351238
max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf,
12361239
cpudata->max_limit_perf);
12371240
min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf,
12381241
cpudata->max_limit_perf);
1239-
1240-
WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf);
1241-
WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf);
1242-
12431242
value = READ_ONCE(cpudata->cppc_req_cached);
12441243

12451244
if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)

0 commit comments

Comments
 (0)