aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/numa.c
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/mm/numa.c
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/mm/numa.c')
-rw-r--r--arch/powerpc/mm/numa.c26
1 files changed, 26 insertions, 0 deletions
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 */