diff options
author | Rohit Seth <rohitseth@google.com> | 2006-06-26 07:58:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 13:48:19 -0400 |
commit | f3fa8ebc25129bb69929e20b0c84049c39029d8d (patch) | |
tree | 56b0df80a38128ca91a2e613d30c594e2e54f7c7 /arch/x86_64/kernel | |
parent | e465058d55a88feb4c7ecabe63eea7ea7147e206 (diff) |
[PATCH] x86_64: moving phys_proc_id and cpu_core_id to cpuinfo_x86
Most of the fields of cpuinfo are defined in cpuinfo_x86 structure.
This patch moves the phys_proc_id and cpu_core_id for each processor to
cpuinfo_x86 structure as well.
Signed-off-by: Rohit Seth <rohitseth@google.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel')
-rw-r--r-- | arch/x86_64/kernel/mce_amd.c | 10 | ||||
-rw-r--r-- | arch/x86_64/kernel/pci-gart.c | 3 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup.c | 27 | ||||
-rw-r--r-- | arch/x86_64/kernel/smpboot.c | 14 |
4 files changed, 23 insertions, 31 deletions
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c index d13b241ad094..86e1e022b20e 100644 --- a/arch/x86_64/kernel/mce_amd.c +++ b/arch/x86_64/kernel/mce_amd.c | |||
@@ -115,7 +115,7 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c) | |||
115 | per_cpu(bank_map, cpu) |= (1 << bank); | 115 | per_cpu(bank_map, cpu) |= (1 << bank); |
116 | 116 | ||
117 | #ifdef CONFIG_SMP | 117 | #ifdef CONFIG_SMP |
118 | if (shared_bank[bank] && cpu_core_id[cpu]) | 118 | if (shared_bank[bank] && c->cpu_core_id) |
119 | continue; | 119 | continue; |
120 | #endif | 120 | #endif |
121 | 121 | ||
@@ -323,10 +323,10 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, int bank) | |||
323 | struct threshold_bank *b = NULL; | 323 | struct threshold_bank *b = NULL; |
324 | 324 | ||
325 | #ifdef CONFIG_SMP | 325 | #ifdef CONFIG_SMP |
326 | if (cpu_core_id[cpu] && shared_bank[bank]) { /* symlink */ | 326 | if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */ |
327 | char name[16]; | 327 | char name[16]; |
328 | unsigned lcpu = first_cpu(cpu_core_map[cpu]); | 328 | unsigned lcpu = first_cpu(cpu_core_map[cpu]); |
329 | if (cpu_core_id[lcpu]) | 329 | if (cpu_data[lcpu].cpu_core_id) |
330 | goto out; /* first core not up yet */ | 330 | goto out; /* first core not up yet */ |
331 | 331 | ||
332 | b = per_cpu(threshold_banks, lcpu)[bank]; | 332 | b = per_cpu(threshold_banks, lcpu)[bank]; |
@@ -434,7 +434,7 @@ static __cpuinit int threshold_create_symlinks(unsigned int cpu) | |||
434 | int bank, err = 0; | 434 | int bank, err = 0; |
435 | unsigned int lcpu = 0; | 435 | unsigned int lcpu = 0; |
436 | 436 | ||
437 | if (cpu_core_id[cpu]) | 437 | if (cpu_data[cpu].cpu_core_id) |
438 | return 0; | 438 | return 0; |
439 | for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { | 439 | for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { |
440 | if (lcpu == cpu) | 440 | if (lcpu == cpu) |
@@ -455,7 +455,7 @@ static __cpuinit void threshold_remove_symlinks(unsigned int cpu) | |||
455 | { | 455 | { |
456 | int bank; | 456 | int bank; |
457 | unsigned int lcpu = 0; | 457 | unsigned int lcpu = 0; |
458 | if (cpu_core_id[cpu]) | 458 | if (cpu_data[cpu].cpu_core_id) |
459 | return; | 459 | return; |
460 | for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { | 460 | for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { |
461 | if (lcpu == cpu) | 461 | if (lcpu == cpu) |
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 9a93954bed37..4ca674d16b09 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c | |||
@@ -680,9 +680,6 @@ void __init gart_iommu_init(void) | |||
680 | dma_ops = &gart_dma_ops; | 680 | dma_ops = &gart_dma_ops; |
681 | } | 681 | } |
682 | 682 | ||
683 | /* Must execute after PCI subsystem */ | ||
684 | fs_initcall(gart_iommu_init); | ||
685 | |||
686 | void gart_parse_options(char *p) | 683 | void gart_parse_options(char *p) |
687 | { | 684 | { |
688 | int arg; | 685 | int arg; |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 04b2d7b92d17..24aa25ee0d7d 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -785,9 +785,9 @@ static int nearby_node(int apicid) | |||
785 | static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | 785 | static void __init amd_detect_cmp(struct cpuinfo_x86 *c) |
786 | { | 786 | { |
787 | #ifdef CONFIG_SMP | 787 | #ifdef CONFIG_SMP |
788 | int cpu = smp_processor_id(); | ||
789 | unsigned bits; | 788 | unsigned bits; |
790 | #ifdef CONFIG_NUMA | 789 | #ifdef CONFIG_NUMA |
790 | int cpu = smp_processor_id(); | ||
791 | int node = 0; | 791 | int node = 0; |
792 | unsigned apicid = hard_smp_processor_id(); | 792 | unsigned apicid = hard_smp_processor_id(); |
793 | #endif | 793 | #endif |
@@ -805,12 +805,12 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
805 | } | 805 | } |
806 | 806 | ||
807 | /* Low order bits define the core id (index of core in socket) */ | 807 | /* Low order bits define the core id (index of core in socket) */ |
808 | cpu_core_id[cpu] = phys_proc_id[cpu] & ((1 << bits)-1); | 808 | c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1); |
809 | /* Convert the APIC ID into the socket ID */ | 809 | /* Convert the APIC ID into the socket ID */ |
810 | phys_proc_id[cpu] = phys_pkg_id(bits); | 810 | c->phys_proc_id = phys_pkg_id(bits); |
811 | 811 | ||
812 | #ifdef CONFIG_NUMA | 812 | #ifdef CONFIG_NUMA |
813 | node = phys_proc_id[cpu]; | 813 | node = c->phys_proc_id; |
814 | if (apicid_to_node[apicid] != NUMA_NO_NODE) | 814 | if (apicid_to_node[apicid] != NUMA_NO_NODE) |
815 | node = apicid_to_node[apicid]; | 815 | node = apicid_to_node[apicid]; |
816 | if (!node_online(node)) { | 816 | if (!node_online(node)) { |
@@ -823,7 +823,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
823 | but in the same order as the HT nodeids. | 823 | but in the same order as the HT nodeids. |
824 | If that doesn't result in a usable node fall back to the | 824 | If that doesn't result in a usable node fall back to the |
825 | path for the previous case. */ | 825 | path for the previous case. */ |
826 | int ht_nodeid = apicid - (phys_proc_id[0] << bits); | 826 | int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); |
827 | if (ht_nodeid >= 0 && | 827 | if (ht_nodeid >= 0 && |
828 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | 828 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) |
829 | node = apicid_to_node[ht_nodeid]; | 829 | node = apicid_to_node[ht_nodeid]; |
@@ -834,7 +834,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c) | |||
834 | numa_set_node(cpu, node); | 834 | numa_set_node(cpu, node); |
835 | 835 | ||
836 | printk(KERN_INFO "CPU %d/%x(%d) -> Node %d -> Core %d\n", | 836 | printk(KERN_INFO "CPU %d/%x(%d) -> Node %d -> Core %d\n", |
837 | cpu, apicid, c->x86_max_cores, node, cpu_core_id[cpu]); | 837 | cpu, apicid, c->x86_max_cores, node, c->cpu_core_id); |
838 | #endif | 838 | #endif |
839 | #endif | 839 | #endif |
840 | } | 840 | } |
@@ -905,7 +905,6 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
905 | #ifdef CONFIG_SMP | 905 | #ifdef CONFIG_SMP |
906 | u32 eax, ebx, ecx, edx; | 906 | u32 eax, ebx, ecx, edx; |
907 | int index_msb, core_bits; | 907 | int index_msb, core_bits; |
908 | int cpu = smp_processor_id(); | ||
909 | 908 | ||
910 | cpuid(1, &eax, &ebx, &ecx, &edx); | 909 | cpuid(1, &eax, &ebx, &ecx, &edx); |
911 | 910 | ||
@@ -926,10 +925,10 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
926 | } | 925 | } |
927 | 926 | ||
928 | index_msb = get_count_order(smp_num_siblings); | 927 | index_msb = get_count_order(smp_num_siblings); |
929 | phys_proc_id[cpu] = phys_pkg_id(index_msb); | 928 | c->phys_proc_id = phys_pkg_id(index_msb); |
930 | 929 | ||
931 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | 930 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", |
932 | phys_proc_id[cpu]); | 931 | c->phys_proc_id); |
933 | 932 | ||
934 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; | 933 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; |
935 | 934 | ||
@@ -937,12 +936,12 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c) | |||
937 | 936 | ||
938 | core_bits = get_count_order(c->x86_max_cores); | 937 | core_bits = get_count_order(c->x86_max_cores); |
939 | 938 | ||
940 | cpu_core_id[cpu] = phys_pkg_id(index_msb) & | 939 | c->cpu_core_id = phys_pkg_id(index_msb) & |
941 | ((1 << core_bits) - 1); | 940 | ((1 << core_bits) - 1); |
942 | 941 | ||
943 | if (c->x86_max_cores > 1) | 942 | if (c->x86_max_cores > 1) |
944 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | 943 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", |
945 | cpu_core_id[cpu]); | 944 | c->cpu_core_id); |
946 | } | 945 | } |
947 | #endif | 946 | #endif |
948 | } | 947 | } |
@@ -1080,7 +1079,7 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | |||
1080 | } | 1079 | } |
1081 | 1080 | ||
1082 | #ifdef CONFIG_SMP | 1081 | #ifdef CONFIG_SMP |
1083 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | 1082 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; |
1084 | #endif | 1083 | #endif |
1085 | } | 1084 | } |
1086 | 1085 | ||
@@ -1288,9 +1287,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1288 | #ifdef CONFIG_SMP | 1287 | #ifdef CONFIG_SMP |
1289 | if (smp_num_siblings * c->x86_max_cores > 1) { | 1288 | if (smp_num_siblings * c->x86_max_cores > 1) { |
1290 | int cpu = c - cpu_data; | 1289 | int cpu = c - cpu_data; |
1291 | seq_printf(m, "physical id\t: %d\n", phys_proc_id[cpu]); | 1290 | seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); |
1292 | seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu])); | 1291 | seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu])); |
1293 | seq_printf(m, "core id\t\t: %d\n", cpu_core_id[cpu]); | 1292 | seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); |
1294 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); | 1293 | seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); |
1295 | } | 1294 | } |
1296 | #endif | 1295 | #endif |
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 06535e7687ce..b1c10b154bfe 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -63,10 +63,6 @@ | |||
63 | 63 | ||
64 | /* Number of siblings per CPU package */ | 64 | /* Number of siblings per CPU package */ |
65 | int smp_num_siblings = 1; | 65 | int smp_num_siblings = 1; |
66 | /* Package ID of each logical CPU */ | ||
67 | u8 phys_proc_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; | ||
68 | /* core ID of each logical CPU */ | ||
69 | u8 cpu_core_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; | ||
70 | 66 | ||
71 | /* Last level cache ID of each logical CPU */ | 67 | /* Last level cache ID of each logical CPU */ |
72 | u8 cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; | 68 | u8 cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; |
@@ -472,8 +468,8 @@ static inline void set_cpu_sibling_map(int cpu) | |||
472 | 468 | ||
473 | if (smp_num_siblings > 1) { | 469 | if (smp_num_siblings > 1) { |
474 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 470 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
475 | if (phys_proc_id[cpu] == phys_proc_id[i] && | 471 | if (c[cpu].phys_proc_id == c[i].phys_proc_id && |
476 | cpu_core_id[cpu] == cpu_core_id[i]) { | 472 | c[cpu].cpu_core_id == c[i].cpu_core_id) { |
477 | cpu_set(i, cpu_sibling_map[cpu]); | 473 | cpu_set(i, cpu_sibling_map[cpu]); |
478 | cpu_set(cpu, cpu_sibling_map[i]); | 474 | cpu_set(cpu, cpu_sibling_map[i]); |
479 | cpu_set(i, cpu_core_map[cpu]); | 475 | cpu_set(i, cpu_core_map[cpu]); |
@@ -500,7 +496,7 @@ static inline void set_cpu_sibling_map(int cpu) | |||
500 | cpu_set(i, c[cpu].llc_shared_map); | 496 | cpu_set(i, c[cpu].llc_shared_map); |
501 | cpu_set(cpu, c[i].llc_shared_map); | 497 | cpu_set(cpu, c[i].llc_shared_map); |
502 | } | 498 | } |
503 | if (phys_proc_id[cpu] == phys_proc_id[i]) { | 499 | if (c[cpu].phys_proc_id == c[i].phys_proc_id) { |
504 | cpu_set(i, cpu_core_map[cpu]); | 500 | cpu_set(i, cpu_core_map[cpu]); |
505 | cpu_set(cpu, cpu_core_map[i]); | 501 | cpu_set(cpu, cpu_core_map[i]); |
506 | /* | 502 | /* |
@@ -1201,8 +1197,8 @@ static void remove_siblinginfo(int cpu) | |||
1201 | cpu_clear(cpu, cpu_sibling_map[sibling]); | 1197 | cpu_clear(cpu, cpu_sibling_map[sibling]); |
1202 | cpus_clear(cpu_sibling_map[cpu]); | 1198 | cpus_clear(cpu_sibling_map[cpu]); |
1203 | cpus_clear(cpu_core_map[cpu]); | 1199 | cpus_clear(cpu_core_map[cpu]); |
1204 | phys_proc_id[cpu] = BAD_APICID; | 1200 | c[cpu].phys_proc_id = 0; |
1205 | cpu_core_id[cpu] = BAD_APICID; | 1201 | c[cpu].cpu_core_id = 0; |
1206 | cpu_clear(cpu, cpu_sibling_setup_map); | 1202 | cpu_clear(cpu, cpu_sibling_setup_map); |
1207 | } | 1203 | } |
1208 | 1204 | ||