Skip to content

Commit 67c08d3

Browse files
committed
cpufreq/amd-pstate: Don't update CPPC request in amd_pstate_cpu_boost_update()
When boost is changed the CPPC value is changed in amd_pstate_cpu_boost_update() but then changed again when refresh_frequency_limits() and all it's callbacks occur. The first is a pointless write, so instead just update the limits for the policy and let the policy refresh anchor everything properly. Fixes: c8c68c3 ("cpufreq: amd-pstate: initialize core precision boost state") Reviewed-by: Gautham R. Shenoy <[email protected]> Reviewed-by: Perry Yuan <[email protected]> Tested-by: Dhananjay Ugwekar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]>
1 parent 7820e80 commit 67c08d3

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -665,34 +665,12 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
665665
static int amd_pstate_cpu_boost_update(struct cpufreq_policy *policy, bool on)
666666
{
667667
struct amd_cpudata *cpudata = policy->driver_data;
668-
struct cppc_perf_ctrls perf_ctrls;
669-
u32 highest_perf, nominal_perf, nominal_freq, max_freq;
668+
u32 nominal_freq, max_freq;
670669
int ret = 0;
671670

672-
highest_perf = READ_ONCE(cpudata->highest_perf);
673-
nominal_perf = READ_ONCE(cpudata->nominal_perf);
674671
nominal_freq = READ_ONCE(cpudata->nominal_freq);
675672
max_freq = READ_ONCE(cpudata->max_freq);
676673

677-
if (boot_cpu_has(X86_FEATURE_CPPC)) {
678-
u64 value = READ_ONCE(cpudata->cppc_req_cached);
679-
680-
value &= ~GENMASK_ULL(7, 0);
681-
value |= on ? highest_perf : nominal_perf;
682-
WRITE_ONCE(cpudata->cppc_req_cached, value);
683-
684-
wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value);
685-
} else {
686-
perf_ctrls.max_perf = on ? highest_perf : nominal_perf;
687-
ret = cppc_set_perf(cpudata->cpu, &perf_ctrls);
688-
if (ret) {
689-
cpufreq_cpu_release(policy);
690-
pr_debug("Failed to set max perf on CPU:%d. ret:%d\n",
691-
cpudata->cpu, ret);
692-
return ret;
693-
}
694-
}
695-
696674
if (on)
697675
policy->cpuinfo.max_freq = max_freq;
698676
else if (policy->cpuinfo.max_freq > nominal_freq * 1000)

0 commit comments

Comments
 (0)