aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2010-10-26 13:35:12 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-11-28 23:48:21 -0500
commitcd34206e949b66d3c5fa3e4d2905aa4af29d1b85 (patch)
tree361054eb08328d8d9f5ceaba4d8a90ba52244c58 /arch/powerpc
parentf6aedd8606ae673f8e1f4d972fc86c451fbc8ba7 (diff)
powerpc: Add memory_hotplug_max()
Add a function to get the maximum address that can be hotplug added. This is needed to calculate the size of the tce table needed to cover all memory in 1:1 mode. Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/mmzone.h5
-rw-r--r--arch/powerpc/mm/numa.c26
2 files changed, 31 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index aac87cbceb57..fd3fd58bad84 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -33,6 +33,9 @@ extern int numa_cpu_lookup_table[];
33extern cpumask_var_t node_to_cpumask_map[]; 33extern cpumask_var_t node_to_cpumask_map[];
34#ifdef CONFIG_MEMORY_HOTPLUG 34#ifdef CONFIG_MEMORY_HOTPLUG
35extern unsigned long max_pfn; 35extern unsigned long max_pfn;
36u64 memory_hotplug_max(void);
37#else
38#define memory_hotplug_max() memblock_end_of_DRAM()
36#endif 39#endif
37 40
38/* 41/*
@@ -42,6 +45,8 @@ extern unsigned long max_pfn;
42#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) 45#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
43#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) 46#define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn)
44 47
48#else
49#define memory_hotplug_max() memblock_end_of_DRAM()
45#endif /* CONFIG_NEED_MULTIPLE_NODES */ 50#endif /* CONFIG_NEED_MULTIPLE_NODES */
46 51
47#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 74505b245374..8c0944c465f6 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1247,4 +1247,30 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
1247 return nid; 1247 return nid;
1248} 1248}
1249 1249
1250static u64 hot_add_drconf_memory_max(void)
1251{
1252 struct device_node *memory = NULL;
1253 unsigned int drconf_cell_cnt = 0;
1254 u64 lmb_size = 0;
1255 const u32 *dm = 0;
1256
1257 memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
1258 if (memory) {
1259 drconf_cell_cnt = of_get_drconf_memory(memory, &dm);
1260 lmb_size = of_get_lmb_size(memory);
1261 of_node_put(memory);
1262 }
1263 return lmb_size * drconf_cell_cnt;
1264}
1265
1266/*
1267 * memory_hotplug_max - return max address of memory that may be added
1268 *
1269 * This is currently only used on systems that support drconfig memory
1270 * hotplug.
1271 */
1272u64 memory_hotplug_max(void)
1273{
1274 return max(hot_add_drconf_memory_max(), memblock_end_of_DRAM());
1275}
1250#endif /* CONFIG_MEMORY_HOTPLUG */ 1276#endif /* CONFIG_MEMORY_HOTPLUG */