aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-09-07 20:58:52 -0400
committerIngo Molnar <mingo@elte.hu>2008-09-08 09:32:00 -0400
commit2b86473604f6e9aef0b5e89c56798a90ccddcdbe (patch)
tree7adc631326723b2c053944a72840d37d235643c7 /arch
parentc58606ad551e9a1c85a9bd4f1698ca41ec279b2c (diff)
x86: add srat_detect_node for amd64
separate that from amd_detect_cmp() 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/amd_64.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/arch/x86/kernel/cpu/amd_64.c b/arch/x86/kernel/cpu/amd_64.c
index 466a1eaa81ea..20c3f12dfe78 100644
--- a/arch/x86/kernel/cpu/amd_64.c
+++ b/arch/x86/kernel/cpu/amd_64.c
@@ -36,19 +36,23 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
36{ 36{
37#ifdef CONFIG_SMP 37#ifdef CONFIG_SMP
38 unsigned bits; 38 unsigned bits;
39#ifdef CONFIG_NUMA 39
40 int cpu = smp_processor_id();
41 int node = 0;
42 unsigned apicid = hard_smp_processor_id();
43#endif
44 bits = c->x86_coreid_bits; 40 bits = c->x86_coreid_bits;
45 41
46 /* Low order bits define the core id (index of core in socket) */ 42 /* Low order bits define the core id (index of core in socket) */
47 c->cpu_core_id = c->initial_apicid & ((1 << bits)-1); 43 c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
48 /* Convert the initial APIC ID into the socket ID */ 44 /* Convert the initial APIC ID into the socket ID */
49 c->phys_proc_id = c->initial_apicid >> bits; 45 c->phys_proc_id = c->initial_apicid >> bits;
46#endif
47}
50 48
49static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
50{
51#ifdef CONFIG_NUMA 51#ifdef CONFIG_NUMA
52 int cpu = smp_processor_id();
53 int node;
54 unsigned apicid = hard_smp_processor_id();
55
52 node = c->phys_proc_id; 56 node = c->phys_proc_id;
53 if (apicid_to_node[apicid] != NUMA_NO_NODE) 57 if (apicid_to_node[apicid] != NUMA_NO_NODE)
54 node = apicid_to_node[apicid]; 58 node = apicid_to_node[apicid];
@@ -76,7 +80,6 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
76 80
77 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node); 81 printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
78#endif 82#endif
79#endif
80} 83}
81 84
82static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c) 85static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
@@ -169,8 +172,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
169 display_cacheinfo(c); 172 display_cacheinfo(c);
170 173
171 /* Multi core CPU? */ 174 /* Multi core CPU? */
172 if (c->extended_cpuid_level >= 0x80000008) 175 if (c->extended_cpuid_level >= 0x80000008) {
173 amd_detect_cmp(c); 176 amd_detect_cmp(c);
177 srat_detect_node(c);
178 }
174 179
175 if (c->extended_cpuid_level >= 0x80000006) { 180 if (c->extended_cpuid_level >= 0x80000006) {
176 if ((c->x86 >= 0x0f) && (cpuid_edx(0x80000006) & 0xf000)) 181 if ((c->x86 >= 0x0f) && (cpuid_edx(0x80000006) & 0xf000))