@@ -390,14 +390,16 @@ void default_idle(void)
390390EXPORT_SYMBOL (default_idle );
391391#endif
392392
393- bool set_pm_idle_to_default (void )
393+ #ifdef CONFIG_XEN
394+ bool xen_set_default_idle (void )
394395{
395396 bool ret = !!x86_idle ;
396397
397398 x86_idle = default_idle ;
398399
399400 return ret ;
400401}
402+ #endif
401403void stop_this_cpu (void * dummy )
402404{
403405 local_irq_disable ();
@@ -407,31 +409,8 @@ void stop_this_cpu(void *dummy)
407409 set_cpu_online (smp_processor_id (), false);
408410 disable_local_APIC ();
409411
410- for (;;) {
411- if (hlt_works (smp_processor_id ()))
412- halt ();
413- }
414- }
415-
416- /* Default MONITOR/MWAIT with no hints, used for default C1 state */
417- static void mwait_idle (void )
418- {
419- if (!need_resched ()) {
420- trace_power_start_rcuidle (POWER_CSTATE , 1 , smp_processor_id ());
421- trace_cpu_idle_rcuidle (1 , smp_processor_id ());
422- if (this_cpu_has (X86_FEATURE_CLFLUSH_MONITOR ))
423- clflush ((void * )& current_thread_info ()-> flags );
424-
425- __monitor ((void * )& current_thread_info ()-> flags , 0 , 0 );
426- smp_mb ();
427- if (!need_resched ())
428- __sti_mwait (0 , 0 );
429- else
430- local_irq_enable ();
431- trace_power_end_rcuidle (smp_processor_id ());
432- trace_cpu_idle_rcuidle (PWR_EVENT_EXIT , smp_processor_id ());
433- } else
434- local_irq_enable ();
412+ for (;;)
413+ halt ();
435414}
436415
437416/*
@@ -450,53 +429,6 @@ static void poll_idle(void)
450429 trace_cpu_idle_rcuidle (PWR_EVENT_EXIT , smp_processor_id ());
451430}
452431
453- /*
454- * mwait selection logic:
455- *
456- * It depends on the CPU. For AMD CPUs that support MWAIT this is
457- * wrong. Family 0x10 and 0x11 CPUs will enter C1 on HLT. Powersavings
458- * then depend on a clock divisor and current Pstate of the core. If
459- * all cores of a processor are in halt state (C1) the processor can
460- * enter the C1E (C1 enhanced) state. If mwait is used this will never
461- * happen.
462- *
463- * idle=mwait overrides this decision and forces the usage of mwait.
464- */
465-
466- #define MWAIT_INFO 0x05
467- #define MWAIT_ECX_EXTENDED_INFO 0x01
468- #define MWAIT_EDX_C1 0xf0
469-
470- int mwait_usable (const struct cpuinfo_x86 * c )
471- {
472- u32 eax , ebx , ecx , edx ;
473-
474- /* Use mwait if idle=mwait boot option is given */
475- if (boot_option_idle_override == IDLE_FORCE_MWAIT )
476- return 1 ;
477-
478- /*
479- * Any idle= boot option other than idle=mwait means that we must not
480- * use mwait. Eg: idle=halt or idle=poll or idle=nomwait
481- */
482- if (boot_option_idle_override != IDLE_NO_OVERRIDE )
483- return 0 ;
484-
485- if (c -> cpuid_level < MWAIT_INFO )
486- return 0 ;
487-
488- cpuid (MWAIT_INFO , & eax , & ebx , & ecx , & edx );
489- /* Check, whether EDX has extended info about MWAIT */
490- if (!(ecx & MWAIT_ECX_EXTENDED_INFO ))
491- return 1 ;
492-
493- /*
494- * edx enumeratios MONITOR/MWAIT extensions. Check, whether
495- * C1 supports MWAIT
496- */
497- return (edx & MWAIT_EDX_C1 );
498- }
499-
500432bool amd_e400_c1e_detected ;
501433EXPORT_SYMBOL (amd_e400_c1e_detected );
502434
@@ -567,13 +499,7 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
567499 if (x86_idle )
568500 return ;
569501
570- if (cpu_has (c , X86_FEATURE_MWAIT ) && mwait_usable (c )) {
571- /*
572- * One CPU supports mwait => All CPUs supports mwait
573- */
574- pr_info ("using mwait in idle threads\n" );
575- x86_idle = mwait_idle ;
576- } else if (cpu_has_amd_erratum (amd_erratum_400 )) {
502+ if (cpu_has_amd_erratum (amd_erratum_400 )) {
577503 /* E400: APIC timer interrupt does not wake up CPU from C1e */
578504 pr_info ("using AMD E400 aware idle routine\n" );
579505 x86_idle = amd_e400_idle ;
@@ -597,9 +523,6 @@ static int __init idle_setup(char *str)
597523 pr_info ("using polling idle threads\n" );
598524 x86_idle = poll_idle ;
599525 boot_option_idle_override = IDLE_POLL ;
600- } else if (!strcmp (str , "mwait" )) {
601- boot_option_idle_override = IDLE_FORCE_MWAIT ;
602- WARN_ONCE (1 , "\"idle=mwait\" will be removed in 2012\n" );
603526 } else if (!strcmp (str , "halt" )) {
604527 /*
605528 * When the boot option of idle=halt is added, halt is
0 commit comments