diff options
author | Tejun Heo <tj@kernel.org> | 2011-02-16 06:13:07 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-02-16 06:13:07 -0500 |
commit | 45fe6c78c4ccc384044d1b4877eebe7acf359e76 (patch) | |
tree | f9b4559afd352cbb825f0116ead0557f08b8db05 /arch/x86/mm/amdtopology_64.c | |
parent | 99df738cd28cc39054cd1a77685d4a94ed2193a4 (diff) |
x86-64, NUMA: Move apicid to numa mapping initialization from amd_scan_nodes() to amd_numa_init()
This brings amd initialization behavior closer to that of acpi.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Shaohui Zheng <shaohui.zheng@intel.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm/amdtopology_64.c')
-rw-r--r-- | arch/x86/mm/amdtopology_64.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/arch/x86/mm/amdtopology_64.c b/arch/x86/mm/amdtopology_64.c index 7d85cf7e0324..b6029a6b129f 100644 --- a/arch/x86/mm/amdtopology_64.c +++ b/arch/x86/mm/amdtopology_64.c | |||
@@ -74,8 +74,9 @@ int __init amd_numa_init(void) | |||
74 | unsigned long end = PFN_PHYS(max_pfn); | 74 | unsigned long end = PFN_PHYS(max_pfn); |
75 | unsigned numnodes; | 75 | unsigned numnodes; |
76 | unsigned long prevbase; | 76 | unsigned long prevbase; |
77 | int i, nb; | 77 | int i, j, nb; |
78 | u32 nodeid, reg; | 78 | u32 nodeid, reg; |
79 | unsigned int bits, cores, apicid_base; | ||
79 | 80 | ||
80 | if (!early_pci_allowed()) | 81 | if (!early_pci_allowed()) |
81 | return -EINVAL; | 82 | return -EINVAL; |
@@ -176,6 +177,26 @@ int __init amd_numa_init(void) | |||
176 | 177 | ||
177 | if (!nodes_weight(mem_nodes_parsed)) | 178 | if (!nodes_weight(mem_nodes_parsed)) |
178 | return -ENOENT; | 179 | return -ENOENT; |
180 | |||
181 | /* | ||
182 | * We seem to have valid NUMA configuration. Map apicids to nodes | ||
183 | * using the coreid bits from early_identify_cpu. | ||
184 | */ | ||
185 | bits = boot_cpu_data.x86_coreid_bits; | ||
186 | cores = 1 << bits; | ||
187 | apicid_base = 0; | ||
188 | |||
189 | /* get the APIC ID of the BSP early for systems with apicid lifting */ | ||
190 | early_get_boot_cpu_id(); | ||
191 | if (boot_cpu_physical_apicid > 0) { | ||
192 | pr_info("BSP APIC ID: %02x\n", boot_cpu_physical_apicid); | ||
193 | apicid_base = boot_cpu_physical_apicid; | ||
194 | } | ||
195 | |||
196 | for_each_node_mask(i, cpu_nodes_parsed) | ||
197 | for (j = apicid_base; j < cores + apicid_base; j++) | ||
198 | set_apicid_to_node((i << bits) + j, i); | ||
199 | |||
179 | return 0; | 200 | return 0; |
180 | } | 201 | } |
181 | 202 | ||
@@ -251,9 +272,6 @@ void __init amd_fake_nodes(const struct bootnode *nodes, int nr_nodes) | |||
251 | 272 | ||
252 | int __init amd_scan_nodes(void) | 273 | int __init amd_scan_nodes(void) |
253 | { | 274 | { |
254 | unsigned int bits; | ||
255 | unsigned int cores; | ||
256 | unsigned int apicid_base; | ||
257 | int i; | 275 | int i; |
258 | 276 | ||
259 | memnode_shift = compute_hash_shift(nodes, 8, NULL); | 277 | memnode_shift = compute_hash_shift(nodes, 8, NULL); |
@@ -264,28 +282,13 @@ int __init amd_scan_nodes(void) | |||
264 | pr_info("Using node hash shift of %d\n", memnode_shift); | 282 | pr_info("Using node hash shift of %d\n", memnode_shift); |
265 | 283 | ||
266 | /* use the coreid bits from early_identify_cpu */ | 284 | /* use the coreid bits from early_identify_cpu */ |
267 | bits = boot_cpu_data.x86_coreid_bits; | ||
268 | cores = (1<<bits); | ||
269 | apicid_base = 0; | ||
270 | /* get the APIC ID of the BSP early for systems with apicid lifting */ | ||
271 | early_get_boot_cpu_id(); | ||
272 | if (boot_cpu_physical_apicid > 0) { | ||
273 | pr_info("BSP APIC ID: %02x\n", boot_cpu_physical_apicid); | ||
274 | apicid_base = boot_cpu_physical_apicid; | ||
275 | } | ||
276 | |||
277 | for_each_node_mask(i, node_possible_map) | 285 | for_each_node_mask(i, node_possible_map) |
278 | memblock_x86_register_active_regions(i, | 286 | memblock_x86_register_active_regions(i, |
279 | nodes[i].start >> PAGE_SHIFT, | 287 | nodes[i].start >> PAGE_SHIFT, |
280 | nodes[i].end >> PAGE_SHIFT); | 288 | nodes[i].end >> PAGE_SHIFT); |
281 | init_memory_mapping_high(); | 289 | init_memory_mapping_high(); |
282 | for_each_node_mask(i, node_possible_map) { | 290 | for_each_node_mask(i, node_possible_map) |
283 | int j; | ||
284 | |||
285 | for (j = apicid_base; j < cores + apicid_base; j++) | ||
286 | set_apicid_to_node((i << bits) + j, i); | ||
287 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 291 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
288 | } | ||
289 | 292 | ||
290 | numa_init_array(); | 293 | numa_init_array(); |
291 | return 0; | 294 | return 0; |