summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/intel_pstate.c12
-rw-r--r--include/linux/cpuidle.h3
-rw-r--r--kernel/sched/idle.c2
3 files changed, 13 insertions, 4 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 0d159b513469..ee367e9b7d2e 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1460,6 +1460,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1460 1460
1461 intel_pstate_clear_update_util_hook(policy->cpu); 1461 intel_pstate_clear_update_util_hook(policy->cpu);
1462 1462
1463 pr_debug("set_policy cpuinfo.max %u policy->max %u\n",
1464 policy->cpuinfo.max_freq, policy->max);
1465
1463 cpu = all_cpu_data[0]; 1466 cpu = all_cpu_data[0];
1464 if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate && 1467 if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate &&
1465 policy->max < policy->cpuinfo.max_freq && 1468 policy->max < policy->cpuinfo.max_freq &&
@@ -1495,13 +1498,13 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
1495 limits->max_sysfs_pct); 1498 limits->max_sysfs_pct);
1496 limits->max_perf_pct = max(limits->min_policy_pct, 1499 limits->max_perf_pct = max(limits->min_policy_pct,
1497 limits->max_perf_pct); 1500 limits->max_perf_pct);
1498 limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
1499 1501
1500 /* Make sure min_perf_pct <= max_perf_pct */ 1502 /* Make sure min_perf_pct <= max_perf_pct */
1501 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct); 1503 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct);
1502 1504
1503 limits->min_perf = div_fp(limits->min_perf_pct, 100); 1505 limits->min_perf = div_fp(limits->min_perf_pct, 100);
1504 limits->max_perf = div_fp(limits->max_perf_pct, 100); 1506 limits->max_perf = div_fp(limits->max_perf_pct, 100);
1507 limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
1505 1508
1506 out: 1509 out:
1507 intel_pstate_set_update_util_hook(policy->cpu); 1510 intel_pstate_set_update_util_hook(policy->cpu);
@@ -1558,8 +1561,11 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy)
1558 1561
1559 /* cpuinfo and default policy values */ 1562 /* cpuinfo and default policy values */
1560 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling; 1563 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling;
1561 policy->cpuinfo.max_freq = 1564 update_turbo_state();
1562 cpu->pstate.turbo_pstate * cpu->pstate.scaling; 1565 policy->cpuinfo.max_freq = limits->turbo_disabled ?
1566 cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
1567 policy->cpuinfo.max_freq *= cpu->pstate.scaling;
1568
1563 intel_pstate_init_acpi_perf_limits(policy); 1569 intel_pstate_init_acpi_perf_limits(policy);
1564 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 1570 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
1565 cpumask_set_cpu(policy->cpu, policy->cpus); 1571 cpumask_set_cpu(policy->cpu, policy->cpus);
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 786ad32631a6..07b83d32f66c 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -152,6 +152,8 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
152extern int cpuidle_play_dead(void); 152extern int cpuidle_play_dead(void);
153 153
154extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 154extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
155static inline struct cpuidle_device *cpuidle_get_device(void)
156{return __this_cpu_read(cpuidle_devices); }
155#else 157#else
156static inline void disable_cpuidle(void) { } 158static inline void disable_cpuidle(void) { }
157static inline bool cpuidle_not_available(struct cpuidle_driver *drv, 159static inline bool cpuidle_not_available(struct cpuidle_driver *drv,
@@ -187,6 +189,7 @@ static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
187static inline int cpuidle_play_dead(void) {return -ENODEV; } 189static inline int cpuidle_play_dead(void) {return -ENODEV; }
188static inline struct cpuidle_driver *cpuidle_get_cpu_driver( 190static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
189 struct cpuidle_device *dev) {return NULL; } 191 struct cpuidle_device *dev) {return NULL; }
192static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; }
190#endif 193#endif
191 194
192#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_SUSPEND) 195#if defined(CONFIG_CPU_IDLE) && defined(CONFIG_SUSPEND)
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index bd12c6c714ec..c5aeedf4e93a 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -127,7 +127,7 @@ static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
127 */ 127 */
128static void cpuidle_idle_call(void) 128static void cpuidle_idle_call(void)
129{ 129{
130 struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); 130 struct cpuidle_device *dev = cpuidle_get_device();
131 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); 131 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
132 int next_state, entered_state; 132 int next_state, entered_state;
133 133