amd-pstate-6.14 content 1/7/25

Fix a regression with preferred core rankings not being used.
 Fix a precision issue with frequency calculation.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEECwtuSU6dXvs5GA2aLRkspiR3AnYFAmd9nfoaHG1hcmlvLmxp
 bW9uY2llbGxvQGFtZC5jb20ACgkQLRkspiR3AnZwjBAA4KrGmCNlV3At/v82MQXx
 Bwe+I6ngIweHDglV9UDDGgtqtQJfP3cJfXp36ppZSHn+xidMoEt3TjVpnCF3dP7X
 GYQOsMWQlPnsBQfh8TQusPoDGZK+UnS5GQ6F9jHkUxo1p4PsOcajW6fu6EZGQBc9
 dAf+roHDZqEcAWwmxAzycpYrFxNU2YWvWW6gX24yYdO+mbNQpkgw6zMmzLKUtlCm
 uWBtOXxOepee65dMqPMgsRyjWJPoGXWB4mnAo17147LW0qYQ0mPw4D6wyKJsOj5y
 UTLxz4QxHH5WbRPdMBcdX5m85CqxOqj+KeauWHsnQ4XGrA1n+D5SOt0ieAIWgSOm
 k9/KCYvw2+ZZ8dFYEvwtuImrDbBrJDQGjAQr1HAiPl5f4TE7vfbZY6SLYO8gQ0RH
 U4POkGUDWdGoKwCjyBReZ6dVIerCCH1gYmLp+HJqPK7k4BoX7bHNOCJ9sc+hCop5
 x9SZFA5Gmf8TkXRcSMctatm9CxvIawh4THkkzctQErKZs0qJ/+KdTVEwg0i44sKm
 XNH3iRjWPttFI3b+wJZMwwoBmUSTvOMycz4oJZ5jN0wYXfvdPh3FcF7XUpdn9wNq
 8qWE00zMPy9u9wCpjOiIQ1BPHBaqXxfvTDfcoi2zoxpv/f9QM6tsqtjUhZG0+n5t
 oKkupREcIpKqUIvgdCf1v8M=
 =vmI+
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Rafael J. Wysocki 2025-01-10 14:17:22 +01:00
commit 7420a7e867

View File

@ -815,7 +815,7 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
* sched_set_itmt_support(true) has been called and it is valid to
* update them at any time after it has been called.
*/
sched_set_itmt_core_prio((int)READ_ONCE(cpudata->highest_perf), cpudata->cpu);
sched_set_itmt_core_prio((int)READ_ONCE(cpudata->prefcore_ranking), cpudata->cpu);
schedule_work(&sched_prefcore_work);
}
@ -908,9 +908,8 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)
{
int ret;
u32 min_freq, max_freq;
u32 nominal_perf, nominal_freq;
u32 highest_perf, nominal_perf, nominal_freq;
u32 lowest_nonlinear_perf, lowest_nonlinear_freq;
u32 boost_ratio, lowest_nonlinear_ratio;
struct cppc_perf_caps cppc_perf;
ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf);
@ -927,16 +926,12 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)
else
nominal_freq = cppc_perf.nominal_freq;
highest_perf = READ_ONCE(cpudata->highest_perf);
nominal_perf = READ_ONCE(cpudata->nominal_perf);
boost_ratio = div_u64(cpudata->highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf);
max_freq = (nominal_freq * boost_ratio >> SCHED_CAPACITY_SHIFT);
max_freq = div_u64((u64)highest_perf * nominal_freq, nominal_perf);
lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
lowest_nonlinear_ratio = div_u64(lowest_nonlinear_perf << SCHED_CAPACITY_SHIFT,
nominal_perf);
lowest_nonlinear_freq = (nominal_freq * lowest_nonlinear_ratio >> SCHED_CAPACITY_SHIFT);
lowest_nonlinear_freq = div_u64((u64)nominal_freq * lowest_nonlinear_perf, nominal_perf);
WRITE_ONCE(cpudata->min_freq, min_freq * 1000);
WRITE_ONCE(cpudata->lowest_nonlinear_freq, lowest_nonlinear_freq * 1000);
WRITE_ONCE(cpudata->nominal_freq, nominal_freq * 1000);