Skip to contentSkip to conversation

cpufreq: amd-pstate: prefetch cppc_req_cached value in amd_pstate_cpu_init()

PATCH Superseded Perry Yuan 1 participant 1 message Jul 9, 2022

Subsystems (2)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Perry Yuan

author reviewer
#0 lore raw

PATCH v2 4/14 cpufreq: amd-pstate: prefetch cppc_req_cached value in amd_pstate_cpu_init()

This cppc_req_cached valued should be prefetched during amd_pstate_cpu_init call period, then the amd_pstate_update() will get correct cached value before updating the perf to change the cpu perf level.

---
 drivers/cpufreq/amd-pstate.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/cpufreq/amd-pstate.c +10 -5
index 43e6df9f67f6..e4904da54541 100644
@@ -547,12 +547,17 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
 	cpudata->lowest_nonlinear_freq = lowest_nonlinear_freq;
 
 	policy->driver_data = cpudata;
+	if (!shared_mem) {
+		ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_HW_CTL, &value);
+		if (ret)
+			return ret;
+		WRITE_ONCE(cpudata->cppc_hw_conf_cached, value);
 
-	ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_HW_CTL, &value);
-	if (ret)
-		return ret;
-	WRITE_ONCE(cpudata->cppc_hw_conf_cached, value);
-
+		ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &value);
+		if (ret)
+			return ret;
+		WRITE_ONCE(cpudata->cppc_req_cached, value);
+	}
 	amd_pstate_boost_init(cpudata);
 
 	return 0;
Signature · 1 line
2.25.1