From: "Andi Kleen" <ak@suse.de>

Fix bugs in the AMD K8 CMP support code.

Check the correct cpuid level and move numa_add_cpu to the correct place.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/x86_64/kernel/setup.c   |    6 +++++-
 25-akpm/arch/x86_64/kernel/setup64.c |    4 ----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff -puN arch/x86_64/kernel/setup64.c~x86_64-fix-bugs-in-the-amd-k8-cmp-support-code arch/x86_64/kernel/setup64.c
--- 25/arch/x86_64/kernel/setup64.c~x86_64-fix-bugs-in-the-amd-k8-cmp-support-code	2004-11-28 01:54:25.709688640 -0800
+++ 25-akpm/arch/x86_64/kernel/setup64.c	2004-11-28 01:54:25.716687576 -0800
@@ -274,8 +274,4 @@ void __init cpu_init (void)
 	set_debug(0UL, 7);
 
 	fpu_init(); 
-
-#ifdef CONFIG_NUMA
-	numa_add_cpu(cpu);
-#endif
 }
diff -puN arch/x86_64/kernel/setup.c~x86_64-fix-bugs-in-the-amd-k8-cmp-support-code arch/x86_64/kernel/setup.c
--- 25/arch/x86_64/kernel/setup.c~x86_64-fix-bugs-in-the-amd-k8-cmp-support-code	2004-11-28 01:54:25.710688488 -0800
+++ 25-akpm/arch/x86_64/kernel/setup.c	2004-11-28 01:54:25.715687728 -0800
@@ -57,6 +57,7 @@
 #include <asm/proto.h>
 #include <asm/setup.h>
 #include <asm/mach_apic.h>
+#include <asm/numa.h>
 
 /*
  * Machine setup..
@@ -684,7 +685,7 @@ static int __init init_amd(struct cpuinf
 	} 
 	display_cacheinfo(c);
 
-	if (c->cpuid_level >= 0x80000008) {
+	if (cpuid_eax(0x80000000) >= 0x80000008) {
 		c->x86_num_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
 		if (c->x86_num_cores & (c->x86_num_cores - 1))
 			c->x86_num_cores = 1;
@@ -911,6 +912,9 @@ void __init identify_cpu(struct cpuinfo_
 #ifdef CONFIG_X86_MCE
 	mcheck_init(c);
 #endif
+#ifdef CONFIG_NUMA
+	numa_add_cpu(c - cpu_data);
+#endif
 }
  
 
_