summaryrefslogtreecommitdiff
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorPerry Yuan <Perry.Yuan@amd.com>2022-08-14 19:35:46 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-08-31 22:05:38 +0300
commit0e9a86386bca646d3b0fc50e5e15eedb1eb620b3 (patch)
treeb5b8ec755b2ac2a5eaccacd7f234ca2ce540245a /drivers/cpufreq
parentb185c5053c65b7704ead4537e4d4d9b33dc398dc (diff)
downloadlinux-0e9a86386bca646d3b0fc50e5e15eedb1eb620b3.tar.xz
cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor
The patch will fix the invalid desired perf value for powersave governor. This issue is found when testing on one AMD EPYC system, the actual des_perf is smaller than the min_perf value, that is invalid value. because the min_perf is the lowest_perf system can support in idle state. Reviewed-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Perry Yuan <Perry.Yuan@amd.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/amd-pstate.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index a47a1a2fdd06..fd563a002fd0 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -269,6 +269,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
u64 prev = READ_ONCE(cpudata->cppc_req_cached);
u64 value = prev;
+ des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
value &= ~AMD_CPPC_MIN_PERF(~0L);
value |= AMD_CPPC_MIN_PERF(min_perf);
@@ -357,8 +358,6 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
if (max_perf < min_perf)
max_perf = min_perf;
- des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
-
amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true);
}