Message ID | 20250205112523.201101-6-dhananjay.ugwekar@amd.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Mario Limonciello |
Headers | show |
Series | cpufreq/amd-pstate: Fixes and optimizations | expand |
On 2/5/2025 05:25, Dhananjay Ugwekar wrote: > Currently, amd_pstate_update_freq passes the hardware perf limits as > min/max_perf to amd_pstate_update, which eventually gets programmed into > the min/max_perf fields of the CPPC_REQ register. > > Instead pass the effective perf limits i.e. min/max_limit_perf values to > amd_pstate_update as min/max_perf. > > Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> I'll queue this for 6.15. > --- > drivers/cpufreq/amd-pstate.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 2926f292be7b..e179e929b941 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -615,7 +615,7 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy, > { > struct cpufreq_freqs freqs; > struct amd_cpudata *cpudata = policy->driver_data; > - unsigned long max_perf, min_perf, des_perf, cap_perf; > + unsigned long des_perf, cap_perf; > > if (!cpudata->max_freq) > return -ENODEV; > @@ -624,8 +624,6 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy, > amd_pstate_update_min_max_limit(policy); > > cap_perf = READ_ONCE(cpudata->highest_perf); > - min_perf = READ_ONCE(cpudata->lowest_perf); > - max_perf = cap_perf; > > freqs.old = policy->cur; > freqs.new = target_freq; > @@ -642,8 +640,9 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy, > if (!fast_switch) > cpufreq_freq_transition_begin(policy, &freqs); > > - amd_pstate_update(cpudata, min_perf, des_perf, > - max_perf, fast_switch, policy->governor->flags); > + amd_pstate_update(cpudata, cpudata->min_limit_perf, des_perf, > + cpudata->max_limit_perf, fast_switch, > + policy->governor->flags); > > if (!fast_switch) > cpufreq_freq_transition_end(policy, &freqs, false);
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 2926f292be7b..e179e929b941 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -615,7 +615,7 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy, { struct cpufreq_freqs freqs; struct amd_cpudata *cpudata = policy->driver_data; - unsigned long max_perf, min_perf, des_perf, cap_perf; + unsigned long des_perf, cap_perf; if (!cpudata->max_freq) return -ENODEV; @@ -624,8 +624,6 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy, amd_pstate_update_min_max_limit(policy); cap_perf = READ_ONCE(cpudata->highest_perf); - min_perf = READ_ONCE(cpudata->lowest_perf); - max_perf = cap_perf; freqs.old = policy->cur; freqs.new = target_freq; @@ -642,8 +640,9 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy, if (!fast_switch) cpufreq_freq_transition_begin(policy, &freqs); - amd_pstate_update(cpudata, min_perf, des_perf, - max_perf, fast_switch, policy->governor->flags); + amd_pstate_update(cpudata, cpudata->min_limit_perf, des_perf, + cpudata->max_limit_perf, fast_switch, + policy->governor->flags); if (!fast_switch) cpufreq_freq_transition_end(policy, &freqs, false);
Currently, amd_pstate_update_freq passes the hardware perf limits as min/max_perf to amd_pstate_update, which eventually gets programmed into the min/max_perf fields of the CPPC_REQ register. Instead pass the effective perf limits i.e. min/max_limit_perf values to amd_pstate_update as min/max_perf. Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> --- drivers/cpufreq/amd-pstate.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)