diff options
author | Andi Kleen <ak@suse.de> | 2005-05-20 17:27:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-20 18:48:20 -0400 |
commit | b41e29398a873945d02e0009ce7e57608fdb4042 (patch) | |
tree | dc2e4cfd8cb20ce788bc341e9d734adbcebedd27 /arch/i386/kernel/cpu | |
parent | b39c4fab259b216148e705344a892c96efe1946d (diff) |
[PATCH] x86_64: 386/x86-64 Further AMD dual core fixes
- Remove duplicated ifdef
- Make core_id match what Intel uses
- Initialize phys_proc_id correctly for non DC case
- Handle non power of two core numbers.
Fixes for both i386 and x86-64
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/cpu')
-rw-r--r-- | arch/i386/kernel/cpu/amd.c | 9 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c index fa34a06c0d79..73aeaf5a9d4e 100644 --- a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c | |||
@@ -195,7 +195,7 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
195 | c->x86_num_cores = 1; | 195 | c->x86_num_cores = 1; |
196 | } | 196 | } |
197 | 197 | ||
198 | #ifdef CONFIG_X86_SMP | 198 | #ifdef CONFIG_X86_HT |
199 | /* | 199 | /* |
200 | * On a AMD dual core setup the lower bits of the APIC id | 200 | * On a AMD dual core setup the lower bits of the APIC id |
201 | * distingush the cores. Assumes number of cores is a power | 201 | * distingush the cores. Assumes number of cores is a power |
@@ -203,8 +203,11 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
203 | */ | 203 | */ |
204 | if (c->x86_num_cores > 1) { | 204 | if (c->x86_num_cores > 1) { |
205 | int cpu = smp_processor_id(); | 205 | int cpu = smp_processor_id(); |
206 | /* Fix up the APIC ID following AMD specifications. */ | 206 | unsigned bits = 0; |
207 | cpu_core_id[cpu] >>= hweight32(c->x86_num_cores - 1); | 207 | while ((1 << bits) < c->x86_num_cores) |
208 | bits++; | ||
209 | cpu_core_id[cpu] = phys_proc_id[cpu] & ((1<<bits)-1); | ||
210 | phys_proc_id[cpu] >>= bits; | ||
208 | printk(KERN_INFO "CPU %d(%d) -> Core %d\n", | 211 | printk(KERN_INFO "CPU %d(%d) -> Core %d\n", |
209 | cpu, c->x86_num_cores, cpu_core_id[cpu]); | 212 | cpu, c->x86_num_cores, cpu_core_id[cpu]); |
210 | } | 213 | } |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 11e6e6f23fa0..d199e525680a 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -244,11 +244,8 @@ static void __init early_cpu_detect(void) | |||
244 | 244 | ||
245 | early_intel_workaround(c); | 245 | early_intel_workaround(c); |
246 | 246 | ||
247 | #ifdef CONFIG_SMP | ||
248 | #ifdef CONFIG_X86_HT | 247 | #ifdef CONFIG_X86_HT |
249 | phys_proc_id[smp_processor_id()] = | 248 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; |
250 | #endif | ||
251 | cpu_core_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | ||
252 | #endif | 249 | #endif |
253 | } | 250 | } |
254 | 251 | ||