diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-03-06 16:46:39 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:40:58 -0400 |
commit | 01aaea1afbcdb7c49fe4a567ebe3e295db9f720d (patch) | |
tree | 21974b32aad2b004d2ac67bf5ee7d8812d0d30cd /arch | |
parent | 459cce726730ca0ac93701e53aa1d0d055ce9e90 (diff) |
x86: introduce initial apicid
store initial_apicid from early identify. it is could be different from
phys_proc_id later.
also print it out in /proc/cpuinfo.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 13 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/proc.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/setup_64.c | 11 |
3 files changed, 15 insertions, 12 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 57a46c36fa23..0dd87b8d6707 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -369,10 +369,12 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c) | |||
369 | if (c->x86 >= 0x6) | 369 | if (c->x86 >= 0x6) |
370 | c->x86_model += ((tfms >> 16) & 0xF) << 4; | 370 | c->x86_model += ((tfms >> 16) & 0xF) << 4; |
371 | c->x86_mask = tfms & 15; | 371 | c->x86_mask = tfms & 15; |
372 | c->initial_apicid = (ebx >> 24) & 0xFF; | ||
372 | #ifdef CONFIG_X86_HT | 373 | #ifdef CONFIG_X86_HT |
373 | c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0); | 374 | c->apicid = phys_pkg_id(c->initial_apicid, 0); |
375 | c->phys_proc_id = c->initial_apicid; | ||
374 | #else | 376 | #else |
375 | c->apicid = (ebx >> 24) & 0xFF; | 377 | c->apicid = c->initial_apicid; |
376 | #endif | 378 | #endif |
377 | if (test_cpu_cap(c, X86_FEATURE_CLFLSH)) | 379 | if (test_cpu_cap(c, X86_FEATURE_CLFLSH)) |
378 | c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8; | 380 | c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8; |
@@ -395,9 +397,6 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c) | |||
395 | init_scattered_cpuid_features(c); | 397 | init_scattered_cpuid_features(c); |
396 | } | 398 | } |
397 | 399 | ||
398 | #ifdef CONFIG_X86_HT | ||
399 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; | ||
400 | #endif | ||
401 | } | 400 | } |
402 | 401 | ||
403 | static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | 402 | static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) |
@@ -554,7 +553,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
554 | } | 553 | } |
555 | 554 | ||
556 | index_msb = get_count_order(smp_num_siblings); | 555 | index_msb = get_count_order(smp_num_siblings); |
557 | c->phys_proc_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb); | 556 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb); |
558 | 557 | ||
559 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | 558 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", |
560 | c->phys_proc_id); | 559 | c->phys_proc_id); |
@@ -565,7 +564,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
565 | 564 | ||
566 | core_bits = get_count_order(c->x86_max_cores); | 565 | core_bits = get_count_order(c->x86_max_cores); |
567 | 566 | ||
568 | c->cpu_core_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) & | 567 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) & |
569 | ((1 << core_bits) - 1); | 568 | ((1 << core_bits) - 1); |
570 | 569 | ||
571 | if (c->x86_max_cores > 1) | 570 | if (c->x86_max_cores > 1) |
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index e8e58c09625d..0978a4a39418 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c | |||
@@ -19,6 +19,8 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c, | |||
19 | cpus_weight(per_cpu(cpu_core_map, cpu))); | 19 | cpus_weight(per_cpu(cpu_core_map, cpu))); |
20 | seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); | 20 | seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); |
21 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); | 21 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); |
22 | seq_printf(m, "apicid\t\t: %d\n", c->apicid); | ||
23 | seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid); | ||
22 | } | 24 | } |
23 | #endif | 25 | #endif |
24 | } | 26 | } |
@@ -60,6 +62,7 @@ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c, | |||
60 | seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); | 62 | seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); |
61 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); | 63 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); |
62 | seq_printf(m, "apicid\t\t: %d\n", c->apicid); | 64 | seq_printf(m, "apicid\t\t: %d\n", c->apicid); |
65 | seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid); | ||
63 | } | 66 | } |
64 | #endif | 67 | #endif |
65 | } | 68 | } |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index f303c70dd688..13fe525bf065 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
@@ -562,9 +562,9 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c) | |||
562 | bits = c->x86_coreid_bits; | 562 | bits = c->x86_coreid_bits; |
563 | 563 | ||
564 | /* Low order bits define the core id (index of core in socket) */ | 564 | /* Low order bits define the core id (index of core in socket) */ |
565 | c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1); | 565 | c->cpu_core_id = c->initial_apicid & ((1 << bits)-1); |
566 | /* Convert the APIC ID into the socket ID */ | 566 | /* Convert the initial APIC ID into the socket ID */ |
567 | c->phys_proc_id = (c->apicid - boot_cpu_id) >> bits; | 567 | c->phys_proc_id = c->initial_apicid >> bits; |
568 | 568 | ||
569 | #ifdef CONFIG_NUMA | 569 | #ifdef CONFIG_NUMA |
570 | node = c->phys_proc_id; | 570 | node = c->phys_proc_id; |
@@ -581,7 +581,7 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c) | |||
581 | If that doesn't result in a usable node fall back to the | 581 | If that doesn't result in a usable node fall back to the |
582 | path for the previous case. */ | 582 | path for the previous case. */ |
583 | 583 | ||
584 | int ht_nodeid = apicid - boot_cpu_id; | 584 | int ht_nodeid = c->initial_apicid; |
585 | 585 | ||
586 | if (ht_nodeid >= 0 && | 586 | if (ht_nodeid >= 0 && |
587 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | 587 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) |
@@ -936,8 +936,9 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | |||
936 | c->x86 = 4; | 936 | c->x86 = 4; |
937 | } | 937 | } |
938 | 938 | ||
939 | c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xff; | ||
939 | #ifdef CONFIG_SMP | 940 | #ifdef CONFIG_SMP |
940 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; | 941 | c->phys_proc_id = c->initial_apicid; |
941 | #endif | 942 | #endif |
942 | /* AMD-defined flags: level 0x80000001 */ | 943 | /* AMD-defined flags: level 0x80000001 */ |
943 | xlvl = cpuid_eax(0x80000000); | 944 | xlvl = cpuid_eax(0x80000000); |