aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/setup.c
diff options
context:
space:
mode:
authorRohit Seth <rohitseth@google.com>2006-06-26 07:58:17 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 13:48:19 -0400
commitf3fa8ebc25129bb69929e20b0c84049c39029d8d (patch)
tree56b0df80a38128ca91a2e613d30c594e2e54f7c7 /arch/x86_64/kernel/setup.c
parente465058d55a88feb4c7ecabe63eea7ea7147e206 (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/setup.c')
-rw-r--r--arch/x86_64/kernel/setup.c27
1 files changed, 13 insertions, 14 deletions
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)
785static void __init amd_detect_cmp(struct cpuinfo_x86 *c) 785static 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