aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/intel_pstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/intel_pstate.c')
-rw-r--r--drivers/cpufreq/intel_pstate.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 001a532e342e..98fb8821382d 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1101,6 +1101,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1101 policy->max >= policy->cpuinfo.max_freq) { 1101 policy->max >= policy->cpuinfo.max_freq) {
1102 pr_debug("intel_pstate: set performance\n"); 1102 pr_debug("intel_pstate: set performance\n");
1103 limits = &performance_limits; 1103 limits = &performance_limits;
1104 if (hwp_active)
1105 intel_pstate_hwp_set();
1104 return 0; 1106 return 0;
1105 } 1107 }
1106 1108
@@ -1108,7 +1110,8 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1108 limits = &powersave_limits; 1110 limits = &powersave_limits;
1109 limits->min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq; 1111 limits->min_policy_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
1110 limits->min_policy_pct = clamp_t(int, limits->min_policy_pct, 0 , 100); 1112 limits->min_policy_pct = clamp_t(int, limits->min_policy_pct, 0 , 100);
1111 limits->max_policy_pct = (policy->max * 100) / policy->cpuinfo.max_freq; 1113 limits->max_policy_pct = DIV_ROUND_UP(policy->max * 100,
1114 policy->cpuinfo.max_freq);
1112 limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100); 1115 limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100);
1113 1116
1114 /* Normalize user input to [min_policy_pct, max_policy_pct] */ 1117 /* Normalize user input to [min_policy_pct, max_policy_pct] */
@@ -1120,6 +1123,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1120 limits->max_sysfs_pct); 1123 limits->max_sysfs_pct);
1121 limits->max_perf_pct = max(limits->min_policy_pct, 1124 limits->max_perf_pct = max(limits->min_policy_pct,
1122 limits->max_perf_pct); 1125 limits->max_perf_pct);
1126 limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
1123 1127
1124 /* Make sure min_perf_pct <= max_perf_pct */ 1128 /* Make sure min_perf_pct <= max_perf_pct */
1125 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct); 1129 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct);