Skip to content

Commit cf8679b

Browse files
committed
Merge branch 'pm-cpufreq'
Merge amd-pstate driver fixes for 6.12-rc4: - Enable ACPI CPPC in amd_pstate_register_driver() after disabling it in amd_pstate_unregister_driver() during driver operation mode switch (Dhananjay Ugwekar). - Make amd-pstate use nominal performance as the maximum performance level when boost is disabled (Mario Limonciello). * pm-cpufreq: cpufreq/amd-pstate: Use nominal perf for limits when boost is disabled cpufreq/amd-pstate: Fix amd_pstate mode switch on shared memory systems
2 parents 3ebe9c1 + 702dedf commit cf8679b

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,16 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy)
536536

537537
static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)
538538
{
539-
u32 max_limit_perf, min_limit_perf, lowest_perf;
539+
u32 max_limit_perf, min_limit_perf, lowest_perf, max_perf;
540540
struct amd_cpudata *cpudata = policy->driver_data;
541541

542-
max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq);
543-
min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq);
542+
if (cpudata->boost_supported && !policy->boost_enabled)
543+
max_perf = READ_ONCE(cpudata->nominal_perf);
544+
else
545+
max_perf = READ_ONCE(cpudata->highest_perf);
546+
547+
max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq);
548+
min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
544549

545550
lowest_perf = READ_ONCE(cpudata->lowest_perf);
546551
if (min_limit_perf < lowest_perf)
@@ -1201,11 +1206,21 @@ static int amd_pstate_register_driver(int mode)
12011206
return -EINVAL;
12021207

12031208
cppc_state = mode;
1209+
1210+
ret = amd_pstate_enable(true);
1211+
if (ret) {
1212+
pr_err("failed to enable cppc during amd-pstate driver registration, return %d\n",
1213+
ret);
1214+
amd_pstate_driver_cleanup();
1215+
return ret;
1216+
}
1217+
12041218
ret = cpufreq_register_driver(current_pstate_driver);
12051219
if (ret) {
12061220
amd_pstate_driver_cleanup();
12071221
return ret;
12081222
}
1223+
12091224
return 0;
12101225
}
12111226

@@ -1496,10 +1511,13 @@ static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
14961511
u64 value;
14971512
s16 epp;
14981513

1499-
max_perf = READ_ONCE(cpudata->highest_perf);
1514+
if (cpudata->boost_supported && !policy->boost_enabled)
1515+
max_perf = READ_ONCE(cpudata->nominal_perf);
1516+
else
1517+
max_perf = READ_ONCE(cpudata->highest_perf);
15001518
min_perf = READ_ONCE(cpudata->lowest_perf);
1501-
max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq);
1502-
min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq);
1519+
max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq);
1520+
min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
15031521

15041522
if (min_limit_perf < min_perf)
15051523
min_limit_perf = min_perf;

0 commit comments

Comments
 (0)