diff options
author | Andi Kleen <ak@suse.de> | 2008-01-30 07:33:16 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:16 -0500 |
commit | 0c07ee38c9d4eb081758f5ad14bbffa7197e1aec (patch) | |
tree | f32f5dba9b03b9fa5ac262a2c569b43ae9d0994e /arch/x86/kernel/process_64.c | |
parent | 30d432dfab2bcfd021d352e2058fae6b9405caeb (diff) |
x86: use the correct cpuid method to detect MWAIT support for C states
Previously there was a AMD specific quirk to handle the case of
AMD Fam10h MWAIT not supporting any C states. But it turns out
that CPUID already has ways to detectly detect that without
using special quirks.
The new code simply checks if MWAIT supports at least C1 and doesn't
use it if it doesn't. No more vendor specific code.
Note this is does not simply clear MWAIT because MWAIT can be still
useful even without C states.
Credit goes to Ben Serebrin for pointing out the (nearly) obvious.
Cc: "Andreas Herrmann" <andreas.herrmann3@amd.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/process_64.c')
-rw-r--r-- | arch/x86/kernel/process_64.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 4e65ae8a54bf..dbe0a846ec52 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -280,10 +280,19 @@ static void mwait_idle(void) | |||
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | |||
284 | static int mwait_usable(const struct cpuinfo_x86 *c) | ||
285 | { | ||
286 | if (force_mwait) | ||
287 | return 1; | ||
288 | /* Any C1 states supported? */ | ||
289 | return c->cpuid_level >= 5 && ((cpuid_edx(5) >> 4) & 0xf) > 0; | ||
290 | } | ||
291 | |||
283 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) | 292 | void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) |
284 | { | 293 | { |
285 | static int printed; | 294 | static int printed; |
286 | if (cpu_has(c, X86_FEATURE_MWAIT)) { | 295 | if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) { |
287 | /* | 296 | /* |
288 | * Skip, if setup has overridden idle. | 297 | * Skip, if setup has overridden idle. |
289 | * One CPU supports mwait => All CPUs supports mwait | 298 | * One CPU supports mwait => All CPUs supports mwait |