x86: cpu/common*.c, merge early_identify_cpu()
authorYinghai Lu <yhlu.kernel@gmail.com>
Fri, 5 Sep 2008 03:09:10 +0000 (20:09 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 5 Sep 2008 07:40:54 +0000 (09:40 +0200)
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/common_64.c

index ffc2f5e..61a7074 100644 (file)
@@ -490,7 +490,11 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
  */
 static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 {
+#ifdef CONFIG_X86_64
+       c->x86_clflush_size = 64;
+#else
        c->x86_clflush_size = 32;
+#endif
        c->x86_cache_alignment = c->x86_clflush_size;
 
        if (!have_cpuid_p())
index 75bb7ff..6475548 100644 (file)
@@ -482,15 +482,28 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
 #endif
 }
 
-/* Do some early cpuid on the boot CPU to get some parameter that are
-   needed before check_bugs. Everything advanced is in identify_cpu
-   below. */
+/*
+ * Do minimum CPU detection early.
+ * Fields really needed: vendor, cpuid_level, family, model, mask,
+ * cache alignment.
+ * The others are not touched to avoid unwanted side effects.
+ *
+ * WARNING: this function is only called on the BP.  Don't add code here
+ * that is supposed to run on all CPUs.
+ */
 static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 {
 
+#ifdef CONFIG_X86_64
        c->x86_clflush_size = 64;
+#else
+       c->x86_clflush_size = 32;
+#endif
        c->x86_cache_alignment = c->x86_clflush_size;
 
+       if (!have_cpuid_p())
+               return;
+
        memset(&c->x86_capability, 0, sizeof c->x86_capability);
 
        c->extended_cpuid_level = 0;