Fix a regression introduced where boost control malfunctioned in amd-pstate

-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEECwtuSU6dXvs5GA2aLRkspiR3AnYFAmcP+5oaHG1hcmlvLmxp
 bW9uY2llbGxvQGFtZC5jb20ACgkQLRkspiR3AnYU8g//RcxsdJHYeOkkbUF4tiyZ
 hIxQeQfJe4GzixyNKcN0cu1kIGOo+GBCPLB0O7ahZUg6W993fx9qm2OIt4dADuQR
 JnJXKWPYZezGLSVKgUc7iyvvclXUp+fb+8V8UC+lsTcPOc/JhFcD2xp5732C8tzk
 vNvpjdKKICEfEK2xGW11HSDRT3HU2mlZfjXK3FvYBcm/hGWAZRjB/QM72pT9obmD
 IfhuPFPEUxcdnGPulNbYsz2oZoIxa1hfoSylFbXktxMZWfutJOYwzKaQXNetHGVQ
 g90cI+mmfBrSy6HgNHfLKDJr62Vg/bc3kbkxmI4T2gd5HNOVviRtz6X5WvMFp/JH
 lo2O+nGlkprS1dnB/877BzHs/ps37dmql8fvSkeeWT6dJU82YsCg37XbjZmaOvED
 m1hQ3GjzhH7yqHCAWCncREvPsctDGpCRiZrly1gAbQMHFs2RMhUZ5+AHroPxxXYI
 FF1bZBU5OivUjOiweBXtRVTezHpEQdP/9zxiIz/NY0ub/M8lfxuAHLlWSXiXc5Sj
 Yix4Z9Jdqmqgku4R+J1ha1tG2MClzlmHU3LdcYzY0IxOAr2SurV3lPVjwCW3UxOs
 nDg8FhqJ3GlGusK5V/Cs6W5k9Sn2SlwYuRqo7E0v/HZEw3rYOSIFfkzHG/iP730I
 55Jp9LcELz/E7G1B1OKmCbk=
 =tFDD
 -----END PGP SIGNATURE-----

Merge tag 'amd-pstate-v6.12-2024-10-16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux

Merge an amd-pstate driver fix for 6.12-rc4 from Mario Limonciello:

"Fix a regression introduced where boost control malfunctioned in
 amd-pstate"

* tag 'amd-pstate-v6.12-2024-10-16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux:
  cpufreq/amd-pstate: Use nominal perf for limits when boost is disabled
This commit is contained in:
Rafael J. Wysocki 2024-10-16 22:29:34 +02:00
commit 702dedf758

View File

@ -536,11 +536,16 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy)
static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)
{
u32 max_limit_perf, min_limit_perf, lowest_perf;
u32 max_limit_perf, min_limit_perf, lowest_perf, max_perf;
struct amd_cpudata *cpudata = policy->driver_data;
max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq);
min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq);
if (cpudata->boost_supported && !policy->boost_enabled)
max_perf = READ_ONCE(cpudata->nominal_perf);
else
max_perf = READ_ONCE(cpudata->highest_perf);
max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq);
min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
lowest_perf = READ_ONCE(cpudata->lowest_perf);
if (min_limit_perf < lowest_perf)
@ -1506,10 +1511,13 @@ static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
u64 value;
s16 epp;
max_perf = READ_ONCE(cpudata->highest_perf);
if (cpudata->boost_supported && !policy->boost_enabled)
max_perf = READ_ONCE(cpudata->nominal_perf);
else
max_perf = READ_ONCE(cpudata->highest_perf);
min_perf = READ_ONCE(cpudata->lowest_perf);
max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq);
min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq);
max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq);
min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
if (min_limit_perf < min_perf)
min_limit_perf = min_perf;