diff options
author | Tejun Heo <tj@kernel.org> | 2011-05-02 08:18:53 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-05-02 08:18:53 -0400 |
commit | 299a180aec6a8ee3069cf0fe90d722ac20c1f837 (patch) | |
tree | 12498f1eb2d54dd9aaaaf2842a683db84e225d4d /arch | |
parent | 5acd91ab837c9d066af7345aea6462dc55695db7 (diff) |
x86-32, NUMA: Update numaq to use new NUMA init protocol
Update numaq such that it calls numa_add_memblk() and sets
numa_nodes_parsed instead of directly diddling with NUMA states. The
original get_memcfg_numaq() is renamed to numaq_numa_init() and new
get_memcfg_numaq() is created in numa_32.c.
The shim numa_add_memblk() implementation handles node_start/end_pfn[]
and node_set_online() for nodes with memory. The new
get_memcfg_numaq() exactly the same with get_memcfg_from_srat() other
than calling the numaq init function. Things get_memcfgs_numaq() do
are not strictly necessary for numaq but added for consistency and to
help unifying NUMA init handling.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/numaq.h | 7 | ||||
-rw-r--r-- | arch/x86/kernel/apic/numaq_32.c | 28 | ||||
-rw-r--r-- | arch/x86/mm/numa_32.c | 23 |
3 files changed, 34 insertions, 24 deletions
diff --git a/arch/x86/include/asm/numaq.h b/arch/x86/include/asm/numaq.h index 37c516545ec8..c3b3c322fd87 100644 --- a/arch/x86/include/asm/numaq.h +++ b/arch/x86/include/asm/numaq.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #ifdef CONFIG_X86_NUMAQ | 29 | #ifdef CONFIG_X86_NUMAQ |
30 | 30 | ||
31 | extern int found_numaq; | 31 | extern int found_numaq; |
32 | extern int get_memcfg_numaq(void); | 32 | extern int numaq_numa_init(void); |
33 | extern int pci_numaq_init(void); | 33 | extern int pci_numaq_init(void); |
34 | 34 | ||
35 | extern void *xquad_portio; | 35 | extern void *xquad_portio; |
@@ -166,11 +166,6 @@ struct sys_cfg_data { | |||
166 | 166 | ||
167 | void numaq_tsc_disable(void); | 167 | void numaq_tsc_disable(void); |
168 | 168 | ||
169 | #else | ||
170 | static inline int get_memcfg_numaq(void) | ||
171 | { | ||
172 | return 0; | ||
173 | } | ||
174 | #endif /* CONFIG_X86_NUMAQ */ | 169 | #endif /* CONFIG_X86_NUMAQ */ |
175 | #endif /* _ASM_X86_NUMAQ_H */ | 170 | #endif /* _ASM_X86_NUMAQ_H */ |
176 | 171 | ||
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c index 41b8b29d36f5..30f13319e24b 100644 --- a/arch/x86/kernel/apic/numaq_32.c +++ b/arch/x86/kernel/apic/numaq_32.c | |||
@@ -48,8 +48,6 @@ | |||
48 | #include <asm/e820.h> | 48 | #include <asm/e820.h> |
49 | #include <asm/ipi.h> | 49 | #include <asm/ipi.h> |
50 | 50 | ||
51 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) | ||
52 | |||
53 | int found_numaq; | 51 | int found_numaq; |
54 | 52 | ||
55 | /* | 53 | /* |
@@ -79,25 +77,20 @@ int quad_local_to_mp_bus_id[NR_CPUS/4][4]; | |||
79 | static inline void numaq_register_node(int node, struct sys_cfg_data *scd) | 77 | static inline void numaq_register_node(int node, struct sys_cfg_data *scd) |
80 | { | 78 | { |
81 | struct eachquadmem *eq = scd->eq + node; | 79 | struct eachquadmem *eq = scd->eq + node; |
80 | u64 start = (u64)(eq->hi_shrd_mem_start - eq->priv_mem_size) << 20; | ||
81 | u64 end = (u64)(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size) << 20; | ||
82 | int ret; | ||
82 | 83 | ||
83 | node_set_online(node); | 84 | node_set(node, numa_nodes_parsed); |
84 | 85 | ret = numa_add_memblk(node, start, end); | |
85 | /* Convert to pages */ | 86 | BUG_ON(ret < 0); |
86 | node_start_pfn[node] = | ||
87 | MB_TO_PAGES(eq->hi_shrd_mem_start - eq->priv_mem_size); | ||
88 | |||
89 | node_end_pfn[node] = | ||
90 | MB_TO_PAGES(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); | ||
91 | |||
92 | memblock_x86_register_active_regions(node, node_start_pfn[node], | ||
93 | node_end_pfn[node]); | ||
94 | } | 87 | } |
95 | 88 | ||
96 | /* | 89 | /* |
97 | * Function: smp_dump_qct() | 90 | * Function: smp_dump_qct() |
98 | * | 91 | * |
99 | * Description: gets memory layout from the quad config table. This | 92 | * Description: gets memory layout from the quad config table. This |
100 | * function also updates node_online_map with the nodes (quads) present. | 93 | * function also updates numa_nodes_parsed with the nodes (quads) present. |
101 | */ | 94 | */ |
102 | static void __init smp_dump_qct(void) | 95 | static void __init smp_dump_qct(void) |
103 | { | 96 | { |
@@ -106,7 +99,6 @@ static void __init smp_dump_qct(void) | |||
106 | 99 | ||
107 | scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR); | 100 | scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR); |
108 | 101 | ||
109 | nodes_clear(node_online_map); | ||
110 | for_each_node(node) { | 102 | for_each_node(node) { |
111 | if (scd->quads_present31_0 & (1 << node)) | 103 | if (scd->quads_present31_0 & (1 << node)) |
112 | numaq_register_node(node, scd); | 104 | numaq_register_node(node, scd); |
@@ -276,14 +268,14 @@ static __init void early_check_numaq(void) | |||
276 | } | 268 | } |
277 | } | 269 | } |
278 | 270 | ||
279 | int __init get_memcfg_numaq(void) | 271 | int __init numaq_numa_init(void) |
280 | { | 272 | { |
281 | early_check_numaq(); | 273 | early_check_numaq(); |
282 | if (!found_numaq) | 274 | if (!found_numaq) |
283 | return 0; | 275 | return -ENOENT; |
284 | smp_dump_qct(); | 276 | smp_dump_qct(); |
285 | 277 | ||
286 | return 1; | 278 | return 0; |
287 | } | 279 | } |
288 | 280 | ||
289 | #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) | 281 | #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) |
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c index 8641239a0667..14135e52cef5 100644 --- a/arch/x86/mm/numa_32.c +++ b/arch/x86/mm/numa_32.c | |||
@@ -332,6 +332,29 @@ static __init void init_alloc_remap(int nid) | |||
332 | nid, node_pa, node_pa + size, remap_va, remap_va + size); | 332 | nid, node_pa, node_pa + size, remap_va, remap_va + size); |
333 | } | 333 | } |
334 | 334 | ||
335 | static int get_memcfg_numaq(void) | ||
336 | { | ||
337 | #ifdef CONFIG_X86_NUMAQ | ||
338 | int nid; | ||
339 | |||
340 | if (numa_off) | ||
341 | return 0; | ||
342 | |||
343 | if (numaq_numa_init() < 0) { | ||
344 | nodes_clear(numa_nodes_parsed); | ||
345 | remove_all_active_ranges(); | ||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | for_each_node_mask(nid, numa_nodes_parsed) | ||
350 | node_set_online(nid); | ||
351 | sort_node_map(); | ||
352 | return 1; | ||
353 | #else | ||
354 | return 0; | ||
355 | #endif | ||
356 | } | ||
357 | |||
335 | static int get_memcfg_from_srat(void) | 358 | static int get_memcfg_from_srat(void) |
336 | { | 359 | { |
337 | #ifdef CONFIG_ACPI_NUMA | 360 | #ifdef CONFIG_ACPI_NUMA |