Skip to content

Commit 7420a7e

Browse files
committed
Merge tag 'amd-pstate-v6.14-2025-01-07' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux
Merge amd-pstate changes for 6.14 from Mario Limonciello: "Fix a regression with preferred core rankings not being used. Fix a precision issue with frequency calculation." * tag 'amd-pstate-v6.14-2025-01-07' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux: cpufreq/amd-pstate: Refactor max frequency calculation cpufreq/amd-pstate: Fix prefcore rankings
2 parents 851daf8 + 857a61c commit 7420a7e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
815815
* sched_set_itmt_support(true) has been called and it is valid to
816816
* update them at any time after it has been called.
817817
*/
818-
sched_set_itmt_core_prio((int)READ_ONCE(cpudata->highest_perf), cpudata->cpu);
818+
sched_set_itmt_core_prio((int)READ_ONCE(cpudata->prefcore_ranking), cpudata->cpu);
819819

820820
schedule_work(&sched_prefcore_work);
821821
}
@@ -908,9 +908,8 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)
908908
{
909909
int ret;
910910
u32 min_freq, max_freq;
911-
u32 nominal_perf, nominal_freq;
911+
u32 highest_perf, nominal_perf, nominal_freq;
912912
u32 lowest_nonlinear_perf, lowest_nonlinear_freq;
913-
u32 boost_ratio, lowest_nonlinear_ratio;
914913
struct cppc_perf_caps cppc_perf;
915914

916915
ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf);
@@ -927,16 +926,12 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)
927926
else
928927
nominal_freq = cppc_perf.nominal_freq;
929928

929+
highest_perf = READ_ONCE(cpudata->highest_perf);
930930
nominal_perf = READ_ONCE(cpudata->nominal_perf);
931-
932-
boost_ratio = div_u64(cpudata->highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf);
933-
max_freq = (nominal_freq * boost_ratio >> SCHED_CAPACITY_SHIFT);
931+
max_freq = div_u64((u64)highest_perf * nominal_freq, nominal_perf);
934932

935933
lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
936-
lowest_nonlinear_ratio = div_u64(lowest_nonlinear_perf << SCHED_CAPACITY_SHIFT,
937-
nominal_perf);
938-
lowest_nonlinear_freq = (nominal_freq * lowest_nonlinear_ratio >> SCHED_CAPACITY_SHIFT);
939-
934+
lowest_nonlinear_freq = div_u64((u64)nominal_freq * lowest_nonlinear_perf, nominal_perf);
940935
WRITE_ONCE(cpudata->min_freq, min_freq * 1000);
941936
WRITE_ONCE(cpudata->lowest_nonlinear_freq, lowest_nonlinear_freq * 1000);
942937
WRITE_ONCE(cpudata->nominal_freq, nominal_freq * 1000);

0 commit comments

Comments
 (0)