Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 1 | #include <linux/errno.h> |
| 2 | #include <linux/kernel.h> |
| 3 | #include <linux/mm.h> |
Jaswinder Singh | f0bc220 | 2008-12-17 23:20:05 +0530 | [diff] [blame] | 4 | #include <asm/idle.h> |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 5 | #include <linux/smp.h> |
| 6 | #include <linux/slab.h> |
| 7 | #include <linux/sched.h> |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 8 | #include <linux/module.h> |
| 9 | #include <linux/pm.h> |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 10 | #include <linux/clockchips.h> |
Frederic Weisbecker | 1292211 | 2009-02-07 22:16:12 +0100 | [diff] [blame] | 11 | #include <trace/power.h> |
Zhao Yakui | c1e3b37 | 2008-06-24 17:58:53 +0800 | [diff] [blame] | 12 | #include <asm/system.h> |
Ivan Vecera | d3ec5ca | 2008-11-11 14:33:44 +0100 | [diff] [blame] | 13 | #include <asm/apic.h> |
Zhao Yakui | c1e3b37 | 2008-06-24 17:58:53 +0800 | [diff] [blame] | 14 | |
| 15 | unsigned long idle_halt; |
| 16 | EXPORT_SYMBOL(idle_halt); |
Zhao Yakui | da5e09a | 2008-06-24 18:01:09 +0800 | [diff] [blame] | 17 | unsigned long idle_nomwait; |
| 18 | EXPORT_SYMBOL(idle_nomwait); |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 19 | |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 20 | struct kmem_cache *task_xstate_cachep; |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 21 | |
| 22 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
| 23 | { |
| 24 | *dst = *src; |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 25 | if (src->thread.xstate) { |
| 26 | dst->thread.xstate = kmem_cache_alloc(task_xstate_cachep, |
| 27 | GFP_KERNEL); |
| 28 | if (!dst->thread.xstate) |
| 29 | return -ENOMEM; |
| 30 | WARN_ON((unsigned long)dst->thread.xstate & 15); |
| 31 | memcpy(dst->thread.xstate, src->thread.xstate, xstate_size); |
| 32 | } |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 33 | return 0; |
| 34 | } |
| 35 | |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 36 | void free_thread_xstate(struct task_struct *tsk) |
| 37 | { |
| 38 | if (tsk->thread.xstate) { |
| 39 | kmem_cache_free(task_xstate_cachep, tsk->thread.xstate); |
| 40 | tsk->thread.xstate = NULL; |
| 41 | } |
| 42 | } |
| 43 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 44 | void free_thread_info(struct thread_info *ti) |
| 45 | { |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 46 | free_thread_xstate(ti->task); |
Suresh Siddha | 1679f27 | 2008-04-16 10:27:53 +0200 | [diff] [blame] | 47 | free_pages((unsigned long)ti, get_order(THREAD_SIZE)); |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | void arch_task_cache_init(void) |
| 51 | { |
| 52 | task_xstate_cachep = |
| 53 | kmem_cache_create("task_xstate", xstate_size, |
| 54 | __alignof__(union thread_xstate), |
| 55 | SLAB_PANIC, NULL); |
| 56 | } |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 57 | |
Thomas Gleixner | 00dba56 | 2008-06-09 18:35:28 +0200 | [diff] [blame] | 58 | /* |
| 59 | * Idle related variables and functions |
| 60 | */ |
| 61 | unsigned long boot_option_idle_override = 0; |
| 62 | EXPORT_SYMBOL(boot_option_idle_override); |
| 63 | |
| 64 | /* |
| 65 | * Powermanagement idle function, if any.. |
| 66 | */ |
| 67 | void (*pm_idle)(void); |
| 68 | EXPORT_SYMBOL(pm_idle); |
| 69 | |
| 70 | #ifdef CONFIG_X86_32 |
| 71 | /* |
| 72 | * This halt magic was a workaround for ancient floppy DMA |
| 73 | * wreckage. It should be safe to remove. |
| 74 | */ |
| 75 | static int hlt_counter; |
| 76 | void disable_hlt(void) |
| 77 | { |
| 78 | hlt_counter++; |
| 79 | } |
| 80 | EXPORT_SYMBOL(disable_hlt); |
| 81 | |
| 82 | void enable_hlt(void) |
| 83 | { |
| 84 | hlt_counter--; |
| 85 | } |
| 86 | EXPORT_SYMBOL(enable_hlt); |
| 87 | |
| 88 | static inline int hlt_use_halt(void) |
| 89 | { |
| 90 | return (!hlt_counter && boot_cpu_data.hlt_works_ok); |
| 91 | } |
| 92 | #else |
| 93 | static inline int hlt_use_halt(void) |
| 94 | { |
| 95 | return 1; |
| 96 | } |
| 97 | #endif |
| 98 | |
| 99 | /* |
| 100 | * We use this if we don't have any better |
| 101 | * idle routine.. |
| 102 | */ |
| 103 | void default_idle(void) |
| 104 | { |
| 105 | if (hlt_use_halt()) { |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 106 | struct power_trace it; |
| 107 | |
| 108 | trace_power_start(&it, POWER_CSTATE, 1); |
Thomas Gleixner | 00dba56 | 2008-06-09 18:35:28 +0200 | [diff] [blame] | 109 | current_thread_info()->status &= ~TS_POLLING; |
| 110 | /* |
| 111 | * TS_POLLING-cleared state must be visible before we |
| 112 | * test NEED_RESCHED: |
| 113 | */ |
| 114 | smp_mb(); |
| 115 | |
| 116 | if (!need_resched()) |
| 117 | safe_halt(); /* enables interrupts racelessly */ |
| 118 | else |
| 119 | local_irq_enable(); |
| 120 | current_thread_info()->status |= TS_POLLING; |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 121 | trace_power_end(&it); |
Thomas Gleixner | 00dba56 | 2008-06-09 18:35:28 +0200 | [diff] [blame] | 122 | } else { |
| 123 | local_irq_enable(); |
| 124 | /* loop is done by the caller */ |
| 125 | cpu_relax(); |
| 126 | } |
| 127 | } |
| 128 | #ifdef CONFIG_APM_MODULE |
| 129 | EXPORT_SYMBOL(default_idle); |
| 130 | #endif |
| 131 | |
Ivan Vecera | d3ec5ca | 2008-11-11 14:33:44 +0100 | [diff] [blame] | 132 | void stop_this_cpu(void *dummy) |
| 133 | { |
| 134 | local_irq_disable(); |
| 135 | /* |
| 136 | * Remove this CPU: |
| 137 | */ |
| 138 | cpu_clear(smp_processor_id(), cpu_online_map); |
| 139 | disable_local_APIC(); |
| 140 | |
| 141 | for (;;) { |
| 142 | if (hlt_works(smp_processor_id())) |
| 143 | halt(); |
| 144 | } |
| 145 | } |
| 146 | |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 147 | static void do_nothing(void *unused) |
| 148 | { |
| 149 | } |
| 150 | |
| 151 | /* |
| 152 | * cpu_idle_wait - Used to ensure that all the CPUs discard old value of |
| 153 | * pm_idle and update to new pm_idle value. Required while changing pm_idle |
| 154 | * handler on SMP systems. |
| 155 | * |
| 156 | * Caller must have changed pm_idle to the new value before the call. Old |
| 157 | * pm_idle value will not be used by any CPU after the return of this function. |
| 158 | */ |
| 159 | void cpu_idle_wait(void) |
| 160 | { |
| 161 | smp_mb(); |
| 162 | /* kick all the CPUs so that they exit out of pm_idle */ |
Ingo Molnar | 127a237 | 2008-06-27 11:48:22 +0200 | [diff] [blame] | 163 | smp_call_function(do_nothing, NULL, 1); |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 164 | } |
| 165 | EXPORT_SYMBOL_GPL(cpu_idle_wait); |
| 166 | |
| 167 | /* |
| 168 | * This uses new MONITOR/MWAIT instructions on P4 processors with PNI, |
| 169 | * which can obviate IPI to trigger checking of need_resched. |
| 170 | * We execute MONITOR against need_resched and enter optimized wait state |
| 171 | * through MWAIT. Whenever someone changes need_resched, we would be woken |
| 172 | * up from MWAIT (without an IPI). |
| 173 | * |
| 174 | * New with Core Duo processors, MWAIT can take some hints based on CPU |
| 175 | * capability. |
| 176 | */ |
| 177 | void mwait_idle_with_hints(unsigned long ax, unsigned long cx) |
| 178 | { |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 179 | struct power_trace it; |
| 180 | |
| 181 | trace_power_start(&it, POWER_CSTATE, (ax>>4)+1); |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 182 | if (!need_resched()) { |
| 183 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
| 184 | smp_mb(); |
| 185 | if (!need_resched()) |
| 186 | __mwait(ax, cx); |
| 187 | } |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 188 | trace_power_end(&it); |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ |
| 192 | static void mwait_idle(void) |
| 193 | { |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 194 | struct power_trace it; |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 195 | if (!need_resched()) { |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 196 | trace_power_start(&it, POWER_CSTATE, 1); |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 197 | __monitor((void *)¤t_thread_info()->flags, 0, 0); |
| 198 | smp_mb(); |
| 199 | if (!need_resched()) |
| 200 | __sti_mwait(0, 0); |
| 201 | else |
| 202 | local_irq_enable(); |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 203 | trace_power_end(&it); |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 204 | } else |
| 205 | local_irq_enable(); |
| 206 | } |
| 207 | |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 208 | /* |
| 209 | * On SMP it's slightly faster (but much more power-consuming!) |
| 210 | * to poll the ->work.need_resched flag instead of waiting for the |
| 211 | * cross-CPU IPI to arrive. Use this option with caution. |
| 212 | */ |
| 213 | static void poll_idle(void) |
| 214 | { |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 215 | struct power_trace it; |
| 216 | |
| 217 | trace_power_start(&it, POWER_CSTATE, 0); |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 218 | local_irq_enable(); |
Joe Korty | 2c7e9fd | 2008-08-27 10:35:06 -0400 | [diff] [blame] | 219 | while (!need_resched()) |
| 220 | cpu_relax(); |
Arjan van de Ven | f3f47a6 | 2008-11-23 16:49:58 -0800 | [diff] [blame] | 221 | trace_power_end(&it); |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 222 | } |
| 223 | |
Thomas Gleixner | e9623b3 | 2008-05-16 22:55:26 +0200 | [diff] [blame] | 224 | /* |
| 225 | * mwait selection logic: |
| 226 | * |
| 227 | * It depends on the CPU. For AMD CPUs that support MWAIT this is |
| 228 | * wrong. Family 0x10 and 0x11 CPUs will enter C1 on HLT. Powersavings |
| 229 | * then depend on a clock divisor and current Pstate of the core. If |
| 230 | * all cores of a processor are in halt state (C1) the processor can |
| 231 | * enter the C1E (C1 enhanced) state. If mwait is used this will never |
| 232 | * happen. |
| 233 | * |
| 234 | * idle=mwait overrides this decision and forces the usage of mwait. |
| 235 | */ |
Jan Beulich | 08ad8af | 2008-07-18 13:45:20 +0100 | [diff] [blame] | 236 | static int __cpuinitdata force_mwait; |
Thomas Gleixner | 09fd4b4 | 2008-06-09 18:04:27 +0200 | [diff] [blame] | 237 | |
| 238 | #define MWAIT_INFO 0x05 |
| 239 | #define MWAIT_ECX_EXTENDED_INFO 0x01 |
| 240 | #define MWAIT_EDX_C1 0xf0 |
| 241 | |
Thomas Gleixner | e9623b3 | 2008-05-16 22:55:26 +0200 | [diff] [blame] | 242 | static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) |
| 243 | { |
Thomas Gleixner | 09fd4b4 | 2008-06-09 18:04:27 +0200 | [diff] [blame] | 244 | u32 eax, ebx, ecx, edx; |
| 245 | |
Thomas Gleixner | e9623b3 | 2008-05-16 22:55:26 +0200 | [diff] [blame] | 246 | if (force_mwait) |
| 247 | return 1; |
| 248 | |
Thomas Gleixner | 09fd4b4 | 2008-06-09 18:04:27 +0200 | [diff] [blame] | 249 | if (c->cpuid_level < MWAIT_INFO) |
| 250 | return 0; |
| 251 | |
| 252 | cpuid(MWAIT_INFO, &eax, &ebx, &ecx, &edx); |
| 253 | /* Check, whether EDX has extended info about MWAIT */ |
| 254 | if (!(ecx & MWAIT_ECX_EXTENDED_INFO)) |
| 255 | return 1; |
| 256 | |
| 257 | /* |
| 258 | * edx enumeratios MONITOR/MWAIT extensions. Check, whether |
| 259 | * C1 supports MWAIT |
| 260 | */ |
| 261 | return (edx & MWAIT_EDX_C1); |
Thomas Gleixner | e9623b3 | 2008-05-16 22:55:26 +0200 | [diff] [blame] | 262 | } |
| 263 | |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 264 | /* |
| 265 | * Check for AMD CPUs, which have potentially C1E support |
| 266 | */ |
| 267 | static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c) |
| 268 | { |
| 269 | if (c->x86_vendor != X86_VENDOR_AMD) |
| 270 | return 0; |
| 271 | |
| 272 | if (c->x86 < 0x0F) |
| 273 | return 0; |
| 274 | |
| 275 | /* Family 0x0f models < rev F do not have C1E */ |
| 276 | if (c->x86 == 0x0f && c->x86_model < 0x40) |
| 277 | return 0; |
| 278 | |
| 279 | return 1; |
| 280 | } |
| 281 | |
Thomas Gleixner | 4faac97 | 2008-09-22 18:54:29 +0200 | [diff] [blame] | 282 | static cpumask_t c1e_mask = CPU_MASK_NONE; |
| 283 | static int c1e_detected; |
| 284 | |
| 285 | void c1e_remove_cpu(int cpu) |
| 286 | { |
| 287 | cpu_clear(cpu, c1e_mask); |
| 288 | } |
| 289 | |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 290 | /* |
| 291 | * C1E aware idle routine. We check for C1E active in the interrupt |
| 292 | * pending message MSR. If we detect C1E, then we handle it the same |
| 293 | * way as C3 power states (local apic timer and TSC stop) |
| 294 | */ |
| 295 | static void c1e_idle(void) |
| 296 | { |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 297 | if (need_resched()) |
| 298 | return; |
| 299 | |
| 300 | if (!c1e_detected) { |
| 301 | u32 lo, hi; |
| 302 | |
| 303 | rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); |
| 304 | if (lo & K8_INTP_C1E_ACTIVE_MASK) { |
| 305 | c1e_detected = 1; |
Venki Pallipadi | 40fb171 | 2008-11-17 16:11:37 -0800 | [diff] [blame] | 306 | if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) |
Andreas Herrmann | 09bfeea | 2008-09-18 21:12:10 +0200 | [diff] [blame] | 307 | mark_tsc_unstable("TSC halt in AMD C1E"); |
| 308 | printk(KERN_INFO "System has AMD C1E enabled\n"); |
Thomas Gleixner | a8d6829 | 2008-09-22 19:02:25 +0200 | [diff] [blame] | 309 | set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E); |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 310 | } |
| 311 | } |
| 312 | |
| 313 | if (c1e_detected) { |
| 314 | int cpu = smp_processor_id(); |
| 315 | |
| 316 | if (!cpu_isset(cpu, c1e_mask)) { |
| 317 | cpu_set(cpu, c1e_mask); |
Thomas Gleixner | 0beefa2 | 2008-06-17 09:12:03 +0200 | [diff] [blame] | 318 | /* |
| 319 | * Force broadcast so ACPI can not interfere. Needs |
| 320 | * to run with interrupts enabled as it uses |
| 321 | * smp_function_call. |
| 322 | */ |
| 323 | local_irq_enable(); |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 324 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE, |
| 325 | &cpu); |
| 326 | printk(KERN_INFO "Switch to broadcast mode on CPU%d\n", |
| 327 | cpu); |
Thomas Gleixner | 0beefa2 | 2008-06-17 09:12:03 +0200 | [diff] [blame] | 328 | local_irq_disable(); |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 329 | } |
| 330 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu); |
Thomas Gleixner | 0beefa2 | 2008-06-17 09:12:03 +0200 | [diff] [blame] | 331 | |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 332 | default_idle(); |
Thomas Gleixner | 0beefa2 | 2008-06-17 09:12:03 +0200 | [diff] [blame] | 333 | |
| 334 | /* |
| 335 | * The switch back from broadcast mode needs to be |
| 336 | * called with interrupts disabled. |
| 337 | */ |
| 338 | local_irq_disable(); |
| 339 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu); |
| 340 | local_irq_enable(); |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 341 | } else |
| 342 | default_idle(); |
| 343 | } |
| 344 | |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 345 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) |
| 346 | { |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 347 | #ifdef CONFIG_X86_SMP |
| 348 | if (pm_idle == poll_idle && smp_num_siblings > 1) { |
| 349 | printk(KERN_WARNING "WARNING: polling idle and HT enabled," |
| 350 | " performance may degrade.\n"); |
| 351 | } |
| 352 | #endif |
Thomas Gleixner | 6ddd2a2 | 2008-06-09 16:59:53 +0200 | [diff] [blame] | 353 | if (pm_idle) |
| 354 | return; |
| 355 | |
Thomas Gleixner | e9623b3 | 2008-05-16 22:55:26 +0200 | [diff] [blame] | 356 | if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) { |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 357 | /* |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 358 | * One CPU supports mwait => All CPUs supports mwait |
| 359 | */ |
Thomas Gleixner | 6ddd2a2 | 2008-06-09 16:59:53 +0200 | [diff] [blame] | 360 | printk(KERN_INFO "using mwait in idle threads.\n"); |
| 361 | pm_idle = mwait_idle; |
Thomas Gleixner | aa276e1 | 2008-06-09 19:15:00 +0200 | [diff] [blame] | 362 | } else if (check_c1e_idle(c)) { |
| 363 | printk(KERN_INFO "using C1E aware idle routine\n"); |
| 364 | pm_idle = c1e_idle; |
Thomas Gleixner | 6ddd2a2 | 2008-06-09 16:59:53 +0200 | [diff] [blame] | 365 | } else |
| 366 | pm_idle = default_idle; |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 367 | } |
| 368 | |
| 369 | static int __init idle_setup(char *str) |
| 370 | { |
Cyrill Gorcunov | ab6bc3e | 2008-07-05 15:53:36 +0400 | [diff] [blame] | 371 | if (!str) |
| 372 | return -EINVAL; |
| 373 | |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 374 | if (!strcmp(str, "poll")) { |
| 375 | printk("using polling idle threads.\n"); |
| 376 | pm_idle = poll_idle; |
| 377 | } else if (!strcmp(str, "mwait")) |
| 378 | force_mwait = 1; |
Zhao Yakui | c1e3b37 | 2008-06-24 17:58:53 +0800 | [diff] [blame] | 379 | else if (!strcmp(str, "halt")) { |
| 380 | /* |
| 381 | * When the boot option of idle=halt is added, halt is |
| 382 | * forced to be used for CPU idle. In such case CPU C2/C3 |
| 383 | * won't be used again. |
| 384 | * To continue to load the CPU idle driver, don't touch |
| 385 | * the boot_option_idle_override. |
| 386 | */ |
| 387 | pm_idle = default_idle; |
| 388 | idle_halt = 1; |
| 389 | return 0; |
Zhao Yakui | da5e09a | 2008-06-24 18:01:09 +0800 | [diff] [blame] | 390 | } else if (!strcmp(str, "nomwait")) { |
| 391 | /* |
| 392 | * If the boot option of "idle=nomwait" is added, |
| 393 | * it means that mwait will be disabled for CPU C2/C3 |
| 394 | * states. In such case it won't touch the variable |
| 395 | * of boot_option_idle_override. |
| 396 | */ |
| 397 | idle_nomwait = 1; |
| 398 | return 0; |
Zhao Yakui | c1e3b37 | 2008-06-24 17:58:53 +0800 | [diff] [blame] | 399 | } else |
Peter Zijlstra | 7f424a8 | 2008-04-25 17:39:01 +0200 | [diff] [blame] | 400 | return -1; |
| 401 | |
| 402 | boot_option_idle_override = 1; |
| 403 | return 0; |
| 404 | } |
| 405 | early_param("idle", idle_setup); |
| 406 | |