[PATCH] x86, cpu: Fix X86_FEATURE_NOPL

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Borislav Petkov
Date: Monday, October 4, 2010 - 12:31 am

ba0593bf553c450a03dbc5f8c1f0ff58b778a0c8 cleared the aforementioned
cpuid bit only on 32-bit due to various problems with Virtual PC. This
somehow got lost during the 32- + 64-bit merge so restore the feature
bit on 64-bit. For that, set it explicitly for non-constant arguments of
cpu_has(). Update comment for future reference.

Signed-off-by: Borislav Petkov <bp@alien8.de>
---
 arch/x86/kernel/cpu/common.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index caa967d..4b68bda 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -704,16 +704,21 @@ void __init early_cpu_init(void)
 }
 
 /*
- * The NOPL instruction is supposed to exist on all CPUs with
- * family >= 6; unfortunately, that's not true in practice because
- * of early VIA chips and (more importantly) broken virtualizers that
- * are not easy to detect.  In the latter case it doesn't even *fail*
- * reliably, so probing for it doesn't even work.  Disable it completely
+ * The NOPL instruction is supposed to exist on all CPUs of family >= 6;
+ * unfortunately, that's not true in practice because of early VIA
+ * chips and (more importantly) broken virtualizers that are not easy
+ * to detect. In the latter case it doesn't even *fail* reliably, so
+ * probing for it doesn't even work. Disable it completely on 32-bit
  * unless we can find a reliable way to detect all the broken cases.
+ * Enable it explicitly on 64-bit for non-constant inputs of cpu_has().
  */
 static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
 {
+#ifdef CONFIG_X86_32
 	clear_cpu_cap(c, X86_FEATURE_NOPL);
+#else
+	set_cpu_cap(c, X86_FEATURE_NOPL);
+#endif
 }
 
 static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
-- 
1.7.2.3

-- 
Regards/Gruss,
    Boris.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
NOPL on 32-bit, Borislav Petkov, (Sun Oct 3, 2:37 am)
Re: NOPL on 32-bit, H. Peter Anvin, (Sun Oct 3, 7:43 am)
[PATCH] x86, cpu: Fix X86_FEATURE_NOPL, Borislav Petkov, (Mon Oct 4, 12:31 am)
[tip:x86/cpu] x86, cpu: Fix X86_FEATURE_NOPL, tip-bot for Borislav ..., (Mon Oct 4, 1:36 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, Linus Torvalds, (Mon Oct 4, 1:47 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, H. Peter Anvin, (Mon Oct 4, 2:02 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, Linus Torvalds, (Mon Oct 4, 2:12 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, H. Peter Anvin, (Mon Oct 4, 2:21 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, Borislav Petkov, (Mon Oct 4, 2:48 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, H. Peter Anvin, (Mon Oct 4, 2:50 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, H. Peter Anvin, (Mon Oct 4, 2:53 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, Hugh Dickins, (Mon Oct 4, 3:17 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, H. Peter Anvin, (Mon Oct 4, 3:19 pm)
Re: [PATCH] x86, cpu: Fix X86_FEATURE_NOPL, Borislav Petkov, (Mon Oct 4, 11:19 pm)
Re: [tip:x86/cpu] x86, cpu: Fix X86_FEATURE_NOPL, Borislav Petkov, (Tue Oct 5, 2:47 am)
Re: [tip:x86/cpu] x86, cpu: Fix X86_FEATURE_NOPL, H. Peter Anvin, (Tue Oct 5, 9:30 am)
Re: [tip:x86/cpu] x86, cpu: Fix X86_FEATURE_NOPL, Borislav Petkov, (Tue Oct 5, 9:53 am)