Skip to content

Commit f9a378f

Browse files
committed
cpufreq/amd-pstate: Set different default EPP policy for Epyc and Ryzen
For Ryzen systems the EPP policy set by the BIOS is generally configured to performance as this is the default register value for the CPPC request MSR. If a user doesn't use additional software to configure EPP then the system will default biased towards performance and consume extra battery. Instead configure the default to "balanced_performance" for this case. Suggested-by: Artem S. Tashkinov <aros@gmx.com> Reviewed-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> Tested-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219526 Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Link: https://lore.kernel.org/r/20241209185248.16301-15-mario.limonciello@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
1 parent f8fde68 commit f9a378f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,8 +1501,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
15011501

15021502
policy->driver_data = cpudata;
15031503

1504-
cpudata->epp_cached = cpudata->epp_default = amd_pstate_get_epp(cpudata);
1505-
15061504
policy->min = policy->cpuinfo.min_freq;
15071505
policy->max = policy->cpuinfo.max_freq;
15081506

@@ -1513,10 +1511,13 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
15131511
* the default cpufreq governor is neither powersave nor performance.
15141512
*/
15151513
if (amd_pstate_acpi_pm_profile_server() ||
1516-
amd_pstate_acpi_pm_profile_undefined())
1514+
amd_pstate_acpi_pm_profile_undefined()) {
15171515
policy->policy = CPUFREQ_POLICY_PERFORMANCE;
1518-
else
1516+
cpudata->epp_default = amd_pstate_get_epp(cpudata);
1517+
} else {
15191518
policy->policy = CPUFREQ_POLICY_POWERSAVE;
1519+
cpudata->epp_default = AMD_CPPC_EPP_BALANCE_PERFORMANCE;
1520+
}
15201521

15211522
if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
15221523
ret = rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, &value);
@@ -1529,6 +1530,9 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
15291530
return ret;
15301531
WRITE_ONCE(cpudata->cppc_cap1_cached, value);
15311532
}
1533+
ret = amd_pstate_set_epp(cpudata, cpudata->epp_default);
1534+
if (ret)
1535+
return ret;
15321536

15331537
current_pstate_driver->adjust_perf = NULL;
15341538

0 commit comments

Comments
 (0)