Skip to content

Commit 047a2d0

Browse files
committed
cpufreq/amd-pstate: Use amd_pstate_update_min_max_limit() for EPP limits
When the EPP updates are set the maximum capable frequency for the CPU is used to set the upper limit instead of that of the policy. Adjust amd_pstate_epp_update_limit() to reuse policy calculation code from amd_pstate_update_min_max_limit(). 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 67c08d3 commit 047a2d0

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,26 +1485,13 @@ static void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
14851485
static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
14861486
{
14871487
struct amd_cpudata *cpudata = policy->driver_data;
1488-
u32 max_perf, min_perf, min_limit_perf, max_limit_perf;
1488+
u32 max_perf, min_perf;
14891489
u64 value;
14901490
s16 epp;
14911491

1492-
if (cpudata->boost_supported && !policy->boost_enabled)
1493-
max_perf = READ_ONCE(cpudata->nominal_perf);
1494-
else
1495-
max_perf = READ_ONCE(cpudata->highest_perf);
1492+
max_perf = READ_ONCE(cpudata->highest_perf);
14961493
min_perf = READ_ONCE(cpudata->lowest_perf);
1497-
max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq);
1498-
min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
1499-
1500-
if (min_limit_perf < min_perf)
1501-
min_limit_perf = min_perf;
1502-
1503-
if (max_limit_perf < min_limit_perf)
1504-
max_limit_perf = min_limit_perf;
1505-
1506-
WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf);
1507-
WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf);
1494+
amd_pstate_update_min_max_limit(policy);
15081495

15091496
max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf,
15101497
cpudata->max_limit_perf);

0 commit comments

Comments
 (0)