diff options
author | Rohit Seth <rohitseth@google.com> | 2006-06-27 05:53:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:37 -0400 |
commit | 4b89aff930d632be10d557d08d1b60dee7163dbe (patch) | |
tree | f7d854a81b9c5b1b4e6df01cb78ce9ff34684309 | |
parent | 7f35bf929ffe2b3967c8f398880fcb78fcd2ab5c (diff) |
[PATCH] i386: move phys_proc_id and cpu_core_id to cpuinfo_x86
Move the phys_core_id and cpu_core_id to cpuinfo_x86 structure. Similar
patch for x86_64 is already accepted by Andi earlier this week.
[akpm@osdl.org: fix warning]
Signed-off-by: Rohit Seth <rohitseth@google.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/i386/kernel/cpu/amd.c | 6 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 15 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/proc.c | 4 | ||||
-rw-r--r-- | arch/i386/kernel/smpboot.c | 16 | ||||
-rw-r--r-- | include/asm-i386/processor.h | 8 | ||||
-rw-r--r-- | include/asm-i386/topology.h | 6 |
6 files changed, 24 insertions, 31 deletions
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c index fd0457c9c827..e6a2d6b80cda 100644 --- a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c | |||
@@ -235,10 +235,10 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
235 | while ((1 << bits) < c->x86_max_cores) | 235 | while ((1 << bits) < c->x86_max_cores) |
236 | bits++; | 236 | bits++; |
237 | } | 237 | } |
238 | cpu_core_id[cpu] = phys_proc_id[cpu] & ((1<<bits)-1); | 238 | c->cpu_core_id = c->phys_proc_id & ((1<<bits)-1); |
239 | phys_proc_id[cpu] >>= bits; | 239 | c->phys_proc_id >>= bits; |
240 | printk(KERN_INFO "CPU %d(%d) -> Core %d\n", | 240 | printk(KERN_INFO "CPU %d(%d) -> Core %d\n", |
241 | cpu, c->x86_max_cores, cpu_core_id[cpu]); | 241 | cpu, c->x86_max_cores, c->cpu_core_id); |
242 | } | 242 | } |
243 | #endif | 243 | #endif |
244 | 244 | ||
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 640364d9b661..2fa401f19f37 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -319,7 +319,7 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c) | |||
319 | early_intel_workaround(c); | 319 | early_intel_workaround(c); |
320 | 320 | ||
321 | #ifdef CONFIG_X86_HT | 321 | #ifdef CONFIG_X86_HT |
322 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | 322 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; |
323 | #endif | 323 | #endif |
324 | } | 324 | } |
325 | 325 | ||
@@ -477,11 +477,9 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
477 | { | 477 | { |
478 | u32 eax, ebx, ecx, edx; | 478 | u32 eax, ebx, ecx, edx; |
479 | int index_msb, core_bits; | 479 | int index_msb, core_bits; |
480 | int cpu = smp_processor_id(); | ||
481 | 480 | ||
482 | cpuid(1, &eax, &ebx, &ecx, &edx); | 481 | cpuid(1, &eax, &ebx, &ecx, &edx); |
483 | 482 | ||
484 | |||
485 | if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) | 483 | if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) |
486 | return; | 484 | return; |
487 | 485 | ||
@@ -492,16 +490,17 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
492 | } else if (smp_num_siblings > 1 ) { | 490 | } else if (smp_num_siblings > 1 ) { |
493 | 491 | ||
494 | if (smp_num_siblings > NR_CPUS) { | 492 | if (smp_num_siblings > NR_CPUS) { |
495 | printk(KERN_WARNING "CPU: Unsupported number of the siblings %d", smp_num_siblings); | 493 | printk(KERN_WARNING "CPU: Unsupported number of the " |
494 | "siblings %d", smp_num_siblings); | ||
496 | smp_num_siblings = 1; | 495 | smp_num_siblings = 1; |
497 | return; | 496 | return; |
498 | } | 497 | } |
499 | 498 | ||
500 | index_msb = get_count_order(smp_num_siblings); | 499 | index_msb = get_count_order(smp_num_siblings); |
501 | phys_proc_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb); | 500 | c->phys_proc_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb); |
502 | 501 | ||
503 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | 502 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", |
504 | phys_proc_id[cpu]); | 503 | c->phys_proc_id); |
505 | 504 | ||
506 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; | 505 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; |
507 | 506 | ||
@@ -509,12 +508,12 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
509 | 508 | ||
510 | core_bits = get_count_order(c->x86_max_cores); | 509 | core_bits = get_count_order(c->x86_max_cores); |
511 | 510 | ||
512 | cpu_core_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) & | 511 | c->cpu_core_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) & |
513 | ((1 << core_bits) - 1); | 512 | ((1 << core_bits) - 1); |
514 | 513 | ||
515 | if (c->x86_max_cores > 1) | 514 | if (c->x86_max_cores > 1) |
516 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | 515 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", |
517 | cpu_core_id[cpu]); | 516 | c->cpu_core_id); |
518 | } | 517 | } |
519 | } | 518 | } |
520 | #endif | 519 | #endif |
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index 4b03f9f58328..f54a15268ed7 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c | |||
@@ -109,9 +109,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
109 | seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size); | 109 | seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size); |
110 | #ifdef CONFIG_X86_HT | 110 | #ifdef CONFIG_X86_HT |
111 | if (c->x86_max_cores * smp_num_siblings > 1) { | 111 | if (c->x86_max_cores * smp_num_siblings > 1) { |
112 | seq_printf(m, "physical id\t: %d\n", phys_proc_id[n]); | 112 | seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); |
113 | seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[n])); | 113 | seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[n])); |
114 | seq_printf(m, "core id\t\t: %d\n", cpu_core_id[n]); | 114 | seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); |
115 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); | 115 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); |
116 | } | 116 | } |
117 | #endif | 117 | #endif |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 9466a3c9ff0d..ab5275beddf7 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -67,12 +67,6 @@ int smp_num_siblings = 1; | |||
67 | EXPORT_SYMBOL(smp_num_siblings); | 67 | EXPORT_SYMBOL(smp_num_siblings); |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | /* Package ID of each logical CPU */ | ||
71 | int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; | ||
72 | |||
73 | /* Core ID of each logical CPU */ | ||
74 | int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; | ||
75 | |||
76 | /* Last level cache ID of each logical CPU */ | 70 | /* Last level cache ID of each logical CPU */ |
77 | int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; | 71 | int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; |
78 | 72 | ||
@@ -473,8 +467,8 @@ set_cpu_sibling_map(int cpu) | |||
473 | 467 | ||
474 | if (smp_num_siblings > 1) { | 468 | if (smp_num_siblings > 1) { |
475 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 469 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
476 | if (phys_proc_id[cpu] == phys_proc_id[i] && | 470 | if (c[cpu].phys_proc_id == c[i].phys_proc_id && |
477 | cpu_core_id[cpu] == cpu_core_id[i]) { | 471 | c[cpu].cpu_core_id == c[i].cpu_core_id) { |
478 | cpu_set(i, cpu_sibling_map[cpu]); | 472 | cpu_set(i, cpu_sibling_map[cpu]); |
479 | cpu_set(cpu, cpu_sibling_map[i]); | 473 | cpu_set(cpu, cpu_sibling_map[i]); |
480 | cpu_set(i, cpu_core_map[cpu]); | 474 | cpu_set(i, cpu_core_map[cpu]); |
@@ -501,7 +495,7 @@ set_cpu_sibling_map(int cpu) | |||
501 | cpu_set(i, c[cpu].llc_shared_map); | 495 | cpu_set(i, c[cpu].llc_shared_map); |
502 | cpu_set(cpu, c[i].llc_shared_map); | 496 | cpu_set(cpu, c[i].llc_shared_map); |
503 | } | 497 | } |
504 | if (phys_proc_id[cpu] == phys_proc_id[i]) { | 498 | if (c[cpu].phys_proc_id == c[i].phys_proc_id) { |
505 | cpu_set(i, cpu_core_map[cpu]); | 499 | cpu_set(i, cpu_core_map[cpu]); |
506 | cpu_set(cpu, cpu_core_map[i]); | 500 | cpu_set(cpu, cpu_core_map[i]); |
507 | /* | 501 | /* |
@@ -1353,8 +1347,8 @@ remove_siblinginfo(int cpu) | |||
1353 | cpu_clear(cpu, cpu_sibling_map[sibling]); | 1347 | cpu_clear(cpu, cpu_sibling_map[sibling]); |
1354 | cpus_clear(cpu_sibling_map[cpu]); | 1348 | cpus_clear(cpu_sibling_map[cpu]); |
1355 | cpus_clear(cpu_core_map[cpu]); | 1349 | cpus_clear(cpu_core_map[cpu]); |
1356 | phys_proc_id[cpu] = BAD_APICID; | 1350 | c[cpu].phys_proc_id = 0; |
1357 | cpu_core_id[cpu] = BAD_APICID; | 1351 | c[cpu].cpu_core_id = 0; |
1358 | cpu_clear(cpu, cpu_sibling_setup_map); | 1352 | cpu_clear(cpu, cpu_sibling_setup_map); |
1359 | } | 1353 | } |
1360 | 1354 | ||
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 55ea992da329..b32346d62e10 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h | |||
@@ -71,8 +71,12 @@ struct cpuinfo_x86 { | |||
71 | cpumask_t llc_shared_map; /* cpus sharing the last level cache */ | 71 | cpumask_t llc_shared_map; /* cpus sharing the last level cache */ |
72 | #endif | 72 | #endif |
73 | unsigned char x86_max_cores; /* cpuid returned max cores value */ | 73 | unsigned char x86_max_cores; /* cpuid returned max cores value */ |
74 | unsigned char booted_cores; /* number of cores as seen by OS */ | ||
75 | unsigned char apicid; | 74 | unsigned char apicid; |
75 | #ifdef CONFIG_SMP | ||
76 | unsigned char booted_cores; /* number of cores as seen by OS */ | ||
77 | __u8 phys_proc_id; /* Physical processor id. */ | ||
78 | __u8 cpu_core_id; /* Core id */ | ||
79 | #endif | ||
76 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | 80 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); |
77 | 81 | ||
78 | #define X86_VENDOR_INTEL 0 | 82 | #define X86_VENDOR_INTEL 0 |
@@ -104,8 +108,6 @@ extern struct cpuinfo_x86 cpu_data[]; | |||
104 | #define current_cpu_data boot_cpu_data | 108 | #define current_cpu_data boot_cpu_data |
105 | #endif | 109 | #endif |
106 | 110 | ||
107 | extern int phys_proc_id[NR_CPUS]; | ||
108 | extern int cpu_core_id[NR_CPUS]; | ||
109 | extern int cpu_llc_id[NR_CPUS]; | 111 | extern int cpu_llc_id[NR_CPUS]; |
110 | extern char ignore_fpu_irq; | 112 | extern char ignore_fpu_irq; |
111 | 113 | ||
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h index b94e5eeef917..aa4185ee81fb 100644 --- a/include/asm-i386/topology.h +++ b/include/asm-i386/topology.h | |||
@@ -28,10 +28,8 @@ | |||
28 | #define _ASM_I386_TOPOLOGY_H | 28 | #define _ASM_I386_TOPOLOGY_H |
29 | 29 | ||
30 | #ifdef CONFIG_X86_HT | 30 | #ifdef CONFIG_X86_HT |
31 | #define topology_physical_package_id(cpu) \ | 31 | #define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) |
32 | (phys_proc_id[cpu] == BAD_APICID ? -1 : phys_proc_id[cpu]) | 32 | #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) |
33 | #define topology_core_id(cpu) \ | ||
34 | (cpu_core_id[cpu] == BAD_APICID ? 0 : cpu_core_id[cpu]) | ||
35 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) | 33 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) |
36 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) | 34 | #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu]) |
37 | #endif | 35 | #endif |