Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Tejun Heo 299a180a 5acd91ab

+34 -24
+1 -6
arch/x86/include/asm/numaq.h
··· 29 29 #ifdef CONFIG_X86_NUMAQ 30 30 31 31 extern int found_numaq; 32 - extern int get_memcfg_numaq(void); 32 + extern int numaq_numa_init(void); 33 33 extern int pci_numaq_init(void); 34 34 35 35 extern void *xquad_portio; ··· 166 166 167 167 void numaq_tsc_disable(void); 168 168 169 - #else 170 - static inline int get_memcfg_numaq(void) 171 - { 172 - return 0; 173 - } 174 169 #endif /* CONFIG_X86_NUMAQ */ 175 170 #endif /* _ASM_X86_NUMAQ_H */ 176 171
+10 -18
arch/x86/kernel/apic/numaq_32.c
··· 48 48 #include <asm/e820.h> 49 49 #include <asm/ipi.h> 50 50 51 - #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) 52 - 53 51 int found_numaq; 54 52 55 53 /* ··· 77 79 static inline void numaq_register_node(int node, struct sys_cfg_data *scd) 78 80 { 79 81 struct eachquadmem *eq = scd->eq + node; 82 + u64 start = (u64)(eq->hi_shrd_mem_start - eq->priv_mem_size) << 20; 83 + u64 end = (u64)(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size) << 20; 84 + int ret; 80 85 81 - node_set_online(node); 82 - 83 - /* Convert to pages */ 84 - node_start_pfn[node] = 85 - MB_TO_PAGES(eq->hi_shrd_mem_start - eq->priv_mem_size); 86 - 87 - node_end_pfn[node] = 88 - MB_TO_PAGES(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); 89 - 90 - memblock_x86_register_active_regions(node, node_start_pfn[node], 91 - node_end_pfn[node]); 86 + node_set(node, numa_nodes_parsed); 87 + ret = numa_add_memblk(node, start, end); 88 + BUG_ON(ret < 0); 92 89 } 93 90 94 91 /* 95 92 * Function: smp_dump_qct() 96 93 * 97 94 * Description: gets memory layout from the quad config table. This 98 - * function also updates node_online_map with the nodes (quads) present. 95 + * function also updates numa_nodes_parsed with the nodes (quads) present. 99 96 */ 100 97 static void __init smp_dump_qct(void) 101 98 { ··· 99 106 100 107 scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR); 101 108 102 - nodes_clear(node_online_map); 103 109 for_each_node(node) { 104 110 if (scd->quads_present31_0 & (1 << node)) 105 111 numaq_register_node(node, scd); ··· 268 276 } 269 277 } 270 278 271 - int __init get_memcfg_numaq(void) 279 + int __init numaq_numa_init(void) 272 280 { 273 281 early_check_numaq(); 274 282 if (!found_numaq) 275 - return 0; 283 + return -ENOENT; 276 284 smp_dump_qct(); 277 285 278 - return 1; 286 + return 0; 279 287 } 280 288 281 289 #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER)
+23
arch/x86/mm/numa_32.c
··· 332 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 358 static int get_memcfg_from_srat(void) 336 359 { 337 360 #ifdef CONFIG_ACPI_NUMA