aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-02-16 06:13:06 -0500
committerTejun Heo <tj@kernel.org>2011-02-16 06:13:06 -0500
commit940fed2e79a15cf0d006c860d7811adbe5c19882 (patch)
tree3a98a59f28445430ff03061c6b2566038c4c63e0
parent86ef4dbf1f736bb1a4d567e043e3dd81b8b7860c (diff)
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>
-rw-r--r--arch/x86/include/asm/acpi.h2
-rw-r--r--arch/x86/include/asm/amd_nb.h2
-rw-r--r--arch/x86/kernel/setup.c4
-rw-r--r--arch/x86/mm/amdtopology_64.c18
-rw-r--r--arch/x86/mm/numa_64.c2
-rw-r--r--arch/x86/mm/srat_64.c4
-rw-r--r--drivers/acpi/numa.c9
7 files changed, 22 insertions, 19 deletions
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 211ca3f7fd16..4e5dff9e0b39 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -187,7 +187,7 @@ struct bootnode;
187extern int acpi_numa; 187extern int acpi_numa;
188extern void acpi_get_nodes(struct bootnode *physnodes, unsigned long start, 188extern void acpi_get_nodes(struct bootnode *physnodes, unsigned long start,
189 unsigned long end); 189 unsigned long end);
190extern int acpi_scan_nodes(unsigned long start, unsigned long end); 190extern int acpi_scan_nodes(void);
191#define NR_NODE_MEMBLKS (MAX_NUMNODES*2) 191#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
192 192
193#ifdef CONFIG_NUMA_EMU 193#ifdef CONFIG_NUMA_EMU
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h
index 2b33c4df979f..dc3c6e34da1d 100644
--- a/arch/x86/include/asm/amd_nb.h
+++ b/arch/x86/include/asm/amd_nb.h
@@ -16,7 +16,7 @@ struct bootnode;
16extern int early_is_amd_nb(u32 value); 16extern int early_is_amd_nb(u32 value);
17extern int amd_cache_northbridges(void); 17extern int amd_cache_northbridges(void);
18extern void amd_flush_garts(void); 18extern void amd_flush_garts(void);
19extern int amd_numa_init(unsigned long start_pfn, unsigned long end_pfn); 19extern int amd_numa_init(void);
20extern int amd_scan_nodes(void); 20extern int amd_scan_nodes(void);
21extern int amd_get_subcaches(int); 21extern int amd_get_subcaches(int);
22extern int amd_set_subcaches(int, int); 22extern int amd_set_subcaches(int, int);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 756d640723f9..96810a3c6003 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -995,12 +995,12 @@ void __init setup_arch(char **cmdline_p)
995 /* 995 /*
996 * Parse SRAT to discover nodes. 996 * Parse SRAT to discover nodes.
997 */ 997 */
998 acpi = acpi_numa_init(); 998 acpi = !acpi_numa_init();
999#endif 999#endif
1000 1000
1001#ifdef CONFIG_AMD_NUMA 1001#ifdef CONFIG_AMD_NUMA
1002 if (!acpi) 1002 if (!acpi)
1003 amd = !amd_numa_init(0, max_pfn); 1003 amd = !amd_numa_init();
1004#endif 1004#endif
1005 1005
1006 initmem_init(acpi, amd); 1006 initmem_init(acpi, amd);
diff --git a/arch/x86/mm/amdtopology_64.c b/arch/x86/mm/amdtopology_64.c
index 2523c3554de5..655ccffc6ee5 100644
--- a/arch/x86/mm/amdtopology_64.c
+++ b/arch/x86/mm/amdtopology_64.c
@@ -51,7 +51,7 @@ static __init int find_northbridge(void)
51 return num; 51 return num;
52 } 52 }
53 53
54 return -1; 54 return -ENOENT;
55} 55}
56 56
57static __init void early_get_boot_cpu_id(void) 57static __init void early_get_boot_cpu_id(void)
@@ -69,17 +69,17 @@ static __init void early_get_boot_cpu_id(void)
69#endif 69#endif
70} 70}
71 71
72int __init amd_numa_init(unsigned long start_pfn, unsigned long end_pfn) 72int __init amd_numa_init(void)
73{ 73{
74 unsigned long start = PFN_PHYS(start_pfn); 74 unsigned long start = PFN_PHYS(0);
75 unsigned long end = PFN_PHYS(end_pfn); 75 unsigned long end = PFN_PHYS(max_pfn);
76 unsigned numnodes; 76 unsigned numnodes;
77 unsigned long prevbase; 77 unsigned long prevbase;
78 int i, nb, found = 0; 78 int i, nb, found = 0;
79 u32 nodeid, reg; 79 u32 nodeid, reg;
80 80
81 if (!early_pci_allowed()) 81 if (!early_pci_allowed())
82 return -1; 82 return -EINVAL;
83 83
84 nb = find_northbridge(); 84 nb = find_northbridge();
85 if (nb < 0) 85 if (nb < 0)
@@ -90,7 +90,7 @@ int __init amd_numa_init(unsigned long start_pfn, unsigned long end_pfn)
90 reg = read_pci_config(0, nb, 0, 0x60); 90 reg = read_pci_config(0, nb, 0, 0x60);
91 numnodes = ((reg >> 4) & 0xF) + 1; 91 numnodes = ((reg >> 4) & 0xF) + 1;
92 if (numnodes <= 1) 92 if (numnodes <= 1)
93 return -1; 93 return -ENOENT;
94 94
95 pr_info("Number of physical nodes %d\n", numnodes); 95 pr_info("Number of physical nodes %d\n", numnodes);
96 96
@@ -121,7 +121,7 @@ int __init amd_numa_init(unsigned long start_pfn, unsigned long end_pfn)
121 if ((base >> 8) & 3 || (limit >> 8) & 3) { 121 if ((base >> 8) & 3 || (limit >> 8) & 3) {
122 pr_err("Node %d using interleaving mode %lx/%lx\n", 122 pr_err("Node %d using interleaving mode %lx/%lx\n",
123 nodeid, (base >> 8) & 3, (limit >> 8) & 3); 123 nodeid, (base >> 8) & 3, (limit >> 8) & 3);
124 return -1; 124 return -EINVAL;
125 } 125 }
126 if (node_isset(nodeid, nodes_parsed)) { 126 if (node_isset(nodeid, nodes_parsed)) {
127 pr_info("Node %d already present, skipping\n", 127 pr_info("Node %d already present, skipping\n",
@@ -160,7 +160,7 @@ int __init amd_numa_init(unsigned long start_pfn, unsigned long end_pfn)
160 if (prevbase > base) { 160 if (prevbase > base) {
161 pr_err("Node map not sorted %lx,%lx\n", 161 pr_err("Node map not sorted %lx,%lx\n",
162 prevbase, base); 162 prevbase, base);
163 return -1; 163 return -EINVAL;
164 } 164 }
165 165
166 pr_info("Node %d MemBase %016lx Limit %016lx\n", 166 pr_info("Node %d MemBase %016lx Limit %016lx\n",
@@ -177,7 +177,7 @@ int __init amd_numa_init(unsigned long start_pfn, unsigned long end_pfn)
177 } 177 }
178 178
179 if (!found) 179 if (!found)
180 return -1; 180 return -ENOENT;
181 return 0; 181 return 0;
182} 182}
183 183
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index d7e4aafd0759..a083f515f004 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -596,7 +596,7 @@ void __init initmem_init(int acpi, int amd)
596#endif 596#endif
597 597
598#ifdef CONFIG_ACPI_NUMA 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 return; 600 return;
601 nodes_clear(node_possible_map); 601 nodes_clear(node_possible_map);
602 nodes_clear(node_online_map); 602 nodes_clear(node_online_map);
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 988b0b70ff39..4f9dbf066ca4 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -359,7 +359,7 @@ void __init acpi_get_nodes(struct bootnode *physnodes, unsigned long start,
359#endif /* CONFIG_NUMA_EMU */ 359#endif /* CONFIG_NUMA_EMU */
360 360
361/* Use the information discovered above to actually set up the nodes. */ 361/* Use the information discovered above to actually set up the nodes. */
362int __init acpi_scan_nodes(unsigned long start, unsigned long end) 362int __init acpi_scan_nodes(void)
363{ 363{
364 int i; 364 int i;
365 365
@@ -368,7 +368,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
368 368
369 /* First clean up the node list */ 369 /* First clean up the node list */
370 for (i = 0; i < MAX_NUMNODES; i++) 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 * Join together blocks on the same node, holes between 374 * Join together blocks on the same node, holes between
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index 5eb25eb3ea48..3b5c3189fd99 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -274,7 +274,7 @@ acpi_table_parse_srat(enum acpi_srat_type id,
274 274
275int __init acpi_numa_init(void) 275int __init acpi_numa_init(void)
276{ 276{
277 int ret = 0; 277 int cnt = 0;
278 278
279 /* 279 /*
280 * Should not limit number with cpu num that is from NR_CPUS or nr_cpus= 280 * Should not limit number with cpu num that is from NR_CPUS or nr_cpus=
@@ -288,7 +288,7 @@ int __init acpi_numa_init(void)
288 acpi_parse_x2apic_affinity, 0); 288 acpi_parse_x2apic_affinity, 0);
289 acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, 289 acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY,
290 acpi_parse_processor_affinity, 0); 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 acpi_parse_memory_affinity, 292 acpi_parse_memory_affinity,
293 NR_NODE_MEMBLKS); 293 NR_NODE_MEMBLKS);
294 } 294 }
@@ -297,7 +297,10 @@ int __init acpi_numa_init(void)
297 acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit); 297 acpi_table_parse(ACPI_SIG_SLIT, acpi_parse_slit);
298 298
299 acpi_numa_arch_fixup(); 299 acpi_numa_arch_fixup();
300 return ret; 300
301 if (cnt <= 0)
302 return cnt ?: -ENOENT;
303 return 0;
301} 304}
302 305
303int acpi_get_pxm(acpi_handle h) 306int acpi_get_pxm(acpi_handle h)