aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/process.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-06-09 12:04:27 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-10 09:52:21 -0400
commit09fd4b4ef5bc7e5222c13acec1bee8cd252fb63f (patch)
treef23eec885a8506c2f84987ac443db618fb58aa27 /arch/x86/kernel/process.c
parent732d7be17b98ebfd59e5864c3490f19856fa832c (diff)
x86: use cpuid to check MWAIT support for C1
cpuid(0x05) provides extended information about MWAIT in EDX when bit 0 of ECX is set. Bit 4-7 of EDX determine whether MWAIT is supported for C1. C1E enabled CPUs have these bits set to 0. Based on an earlier patch from Andi Kleen. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r--arch/x86/kernel/process.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index b3078f4ce25b..fe415ba606e0 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -122,19 +122,31 @@ static void poll_idle(void)
122 * 122 *
123 * idle=mwait overrides this decision and forces the usage of mwait. 123 * idle=mwait overrides this decision and forces the usage of mwait.
124 */ 124 */
125
126#define MWAIT_INFO 0x05
127#define MWAIT_ECX_EXTENDED_INFO 0x01
128#define MWAIT_EDX_C1 0xf0
129
125static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) 130static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
126{ 131{
132 u32 eax, ebx, ecx, edx;
133
127 if (force_mwait) 134 if (force_mwait)
128 return 1; 135 return 1;
129 136
130 if (c->x86_vendor == X86_VENDOR_AMD) { 137 if (c->cpuid_level < MWAIT_INFO)
131 switch(c->x86) { 138 return 0;
132 case 0x10: 139
133 case 0x11: 140 cpuid(MWAIT_INFO, &eax, &ebx, &ecx, &edx);
134 return 0; 141 /* Check, whether EDX has extended info about MWAIT */
135 } 142 if (!(ecx & MWAIT_ECX_EXTENDED_INFO))
136 } 143 return 1;
137 return 1; 144
145 /*
146 * edx enumeratios MONITOR/MWAIT extensions. Check, whether
147 * C1 supports MWAIT
148 */
149 return (edx & MWAIT_EDX_C1);
138} 150}
139 151
140void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 152void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)