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

x86-64, NUMA: Unify {acpi|amd}_{numa_init|scan_nodes}() arguments and return values

The functions used during NUMA initialization - *_numa_init() and
*_scan_nodes() - have different arguments and return values. Unify
them such that they all take no argument and return 0 on success and
-errno on failure. This is in preparation for further NUMA init
cleanups.

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>

Tejun Heo 940fed2e 86ef4dbf

+22 -19
+1 -1
arch/x86/include/asm/acpi.h
··· 187 187 extern int acpi_numa; 188 188 extern void acpi_get_nodes(struct bootnode *physnodes, unsigned long start, 189 189 unsigned long end); 190 - extern int acpi_scan_nodes(unsigned long start, unsigned long end); 190 + extern int acpi_scan_nodes(void); 191 191 #define NR_NODE_MEMBLKS (MAX_NUMNODES*2) 192 192 193 193 #ifdef CONFIG_NUMA_EMU
+1 -1
arch/x86/include/asm/amd_nb.h
··· 16 16 extern int early_is_amd_nb(u32 value); 17 17 extern int amd_cache_northbridges(void); 18 18 extern void amd_flush_garts(void); 19 - extern int amd_numa_init(unsigned long start_pfn, unsigned long end_pfn); 19 + extern int amd_numa_init(void); 20 20 extern int amd_scan_nodes(void); 21 21 extern int amd_get_subcaches(int); 22 22 extern int amd_set_subcaches(int, int);
+2 -2
arch/x86/kernel/setup.c
··· 995 995 /* 996 996 * Parse SRAT to discover nodes. 997 997 */ 998 - acpi = acpi_numa_init(); 998 + acpi = !acpi_numa_init(); 999 999 #endif 1000 1000 1001 1001 #ifdef CONFIG_AMD_NUMA 1002 1002 if (!acpi) 1003 - amd = !amd_numa_init(0, max_pfn); 1003 + amd = !amd_numa_init(); 1004 1004 #endif 1005 1005 1006 1006 initmem_init(acpi, amd);
+9 -9
arch/x86/mm/amdtopology_64.c
··· 51 51 return num; 52 52 } 53 53 54 - return -1; 54 + return -ENOENT; 55 55 } 56 56 57 57 static __init void early_get_boot_cpu_id(void) ··· 69 69 #endif 70 70 } 71 71 72 - int __init amd_numa_init(unsigned long start_pfn, unsigned long end_pfn) 72 + int __init amd_numa_init(void) 73 73 { 74 - unsigned long start = PFN_PHYS(start_pfn); 75 - unsigned long end = PFN_PHYS(end_pfn); 74 + unsigned long start = PFN_PHYS(0); 75 + unsigned long end = PFN_PHYS(max_pfn); 76 76 unsigned numnodes; 77 77 unsigned long prevbase; 78 78 int i, nb, found = 0; 79 79 u32 nodeid, reg; 80 80 81 81 if (!early_pci_allowed()) 82 - return -1; 82 + return -EINVAL; 83 83 84 84 nb = find_northbridge(); 85 85 if (nb < 0) ··· 90 90 reg = read_pci_config(0, nb, 0, 0x60); 91 91 numnodes = ((reg >> 4) & 0xF) + 1; 92 92 if (numnodes <= 1) 93 - return -1; 93 + return -ENOENT; 94 94 95 95 pr_info("Number of physical nodes %d\n", numnodes); 96 96 ··· 121 121 if ((base >> 8) & 3 || (limit >> 8) & 3) { 122 122 pr_err("Node %d using interleaving mode %lx/%lx\n", 123 123 nodeid, (base >> 8) & 3, (limit >> 8) & 3); 124 - return -1; 124 + return -EINVAL; 125 125 } 126 126 if (node_isset(nodeid, nodes_parsed)) { 127 127 pr_info("Node %d already present, skipping\n", ··· 160 160 if (prevbase > base) { 161 161 pr_err("Node map not sorted %lx,%lx\n", 162 162 prevbase, base); 163 - return -1; 163 + return -EINVAL; 164 164 } 165 165 166 166 pr_info("Node %d MemBase %016lx Limit %016lx\n", ··· 177 177 } 178 178 179 179 if (!found) 180 - return -1; 180 + return -ENOENT; 181 181 return 0; 182 182 } 183 183
+1 -1
arch/x86/mm/numa_64.c
··· 596 596 #endif 597 597 598 598 #ifdef CONFIG_ACPI_NUMA 599 - if (!numa_off && acpi && !acpi_scan_nodes(0, max_pfn << PAGE_SHIFT)) 599 + if (!numa_off && acpi && !acpi_scan_nodes()) 600 600 return; 601 601 nodes_clear(node_possible_map); 602 602 nodes_clear(node_online_map);
+2 -2
arch/x86/mm/srat_64.c
··· 359 359 #endif /* CONFIG_NUMA_EMU */ 360 360 361 361 /* Use the information discovered above to actually set up the nodes. */ 362 - int __init acpi_scan_nodes(unsigned long start, unsigned long end) 362 + int __init acpi_scan_nodes(void) 363 363 { 364 364 int i; 365 365 ··· 368 368 369 369 /* First clean up the node list */ 370 370 for (i = 0; i < MAX_NUMNODES; i++) 371 - cutoff_node(i, start, end); 371 + cutoff_node(i, 0, max_pfn << PAGE_SHIFT); 372 372 373 373 /* 374 374 * Join together blocks on the same node, holes between
+6 -3
drivers/acpi/numa.c
··· 274 274 275 275 int __init acpi_numa_init(void) 276 276 { 277 - int ret = 0; 277 + int cnt = 0; 278 278 279 279 /* 280 280 * Should not limit number with cpu num that is from NR_CPUS or nr_cpus= ··· 288 288 acpi_parse_x2apic_affinity, 0); 289 289 acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, 290 290 acpi_parse_processor_affinity, 0); 291 - ret = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, 291 + cnt = acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, 292 292 acpi_parse_memory_affinity, 293 293 NR_NODE_MEMBLKS); 294 294 } ··· 297 297 acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit); 298 298 299 299 acpi_numa_arch_fixup(); 300 - return ret; 300 + 301 + if (cnt <= 0) 302 + return cnt ?: -ENOENT; 303 + return 0; 301 304 } 302 305 303 306 int acpi_get_pxm(acpi_handle h)