aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/ps3
diff options
context:
space:
mode:
authorHector Martin <hector@marcansoft.com>2011-08-11 15:31:08 -0400
committerGeoff Levand <geoff@infradead.org>2012-04-24 18:34:18 -0400
commit8ac5fd118cd137db5ca8c786778ba600f87111a0 (patch)
treeab9a29a64c17da1344ce23f7ae1f2459058fd0ac /arch/powerpc/platforms/ps3
parent1e755c09926de2d9b0e239ba0ce10fdb6835551a (diff)
powerpc/ps3: Add highmem region memory early
Real mode memory can be limited and runs out quickly as memory is allocated during kernel startup. Having the highmem available sooner fixes this. This change simplifies the memory management code by converting from hotplug memory to logical memory blocks. Signed-off-by: Hector Martin <hector@marcansoft.com> Signed-off-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'arch/powerpc/platforms/ps3')
-rw-r--r--arch/powerpc/platforms/ps3/mm.c66
1 files changed, 10 insertions, 56 deletions
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 05a2bcb6a875..0c9f643d9e2a 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/export.h> 22#include <linux/export.h>
23#include <linux/memory_hotplug.h>
24#include <linux/memblock.h> 23#include <linux/memblock.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
26 25
@@ -98,7 +97,7 @@ struct mem_region {
98 * The HV virtual address space (vas) allows for hotplug memory regions. 97 * The HV virtual address space (vas) allows for hotplug memory regions.
99 * Memory regions can be created and destroyed in the vas at runtime. 98 * Memory regions can be created and destroyed in the vas at runtime.
100 * @rm: real mode (bootmem) region 99 * @rm: real mode (bootmem) region
101 * @r1: hotplug memory region(s) 100 * @r1: highmem region(s)
102 * 101 *
103 * ps3 addresses 102 * ps3 addresses
104 * virt_addr: a cpu 'translated' effective address 103 * virt_addr: a cpu 'translated' effective address
@@ -224,10 +223,6 @@ void ps3_mm_vas_destroy(void)
224 } 223 }
225} 224}
226 225
227/*============================================================================*/
228/* memory hotplug routines */
229/*============================================================================*/
230
231/** 226/**
232 * ps3_mm_region_create - create a memory region in the vas 227 * ps3_mm_region_create - create a memory region in the vas
233 * @r: pointer to a struct mem_region to accept initialized values 228 * @r: pointer to a struct mem_region to accept initialized values
@@ -328,56 +323,6 @@ zero_region:
328 return result; 323 return result;
329} 324}
330 325
331/**
332 * ps3_mm_add_memory - hot add memory
333 */
334
335static int __init ps3_mm_add_memory(void)
336{
337 int result;
338 unsigned long start_addr;
339 unsigned long start_pfn;
340 unsigned long nr_pages;
341
342 if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
343 return -ENODEV;
344
345 BUG_ON(!mem_init_done);
346
347 if (!map.r1.size) {
348 DBG("%s:%d: No region 1, not adding memory\n",
349 __func__, __LINE__);
350 return 0;
351 }
352
353 start_addr = map.rm.size;
354 start_pfn = start_addr >> PAGE_SHIFT;
355 nr_pages = (map.r1.size + PAGE_SIZE - 1) >> PAGE_SHIFT;
356
357 DBG("%s:%d: start_addr %lxh, start_pfn %lxh, nr_pages %lxh\n",
358 __func__, __LINE__, start_addr, start_pfn, nr_pages);
359
360 result = add_memory(0, start_addr, map.r1.size);
361
362 if (result) {
363 pr_err("%s:%d: add_memory failed: (%d)\n",
364 __func__, __LINE__, result);
365 return result;
366 }
367
368 memblock_add(start_addr, map.r1.size);
369
370 result = online_pages(start_pfn, nr_pages);
371
372 if (result)
373 pr_err("%s:%d: online_pages failed: (%d)\n",
374 __func__, __LINE__, result);
375
376 return result;
377}
378
379device_initcall(ps3_mm_add_memory);
380
381/*============================================================================*/ 326/*============================================================================*/
382/* dma routines */ 327/* dma routines */
383/*============================================================================*/ 328/*============================================================================*/
@@ -1271,6 +1216,15 @@ void __init ps3_mm_init(void)
1271 /* correct map.total for the real total amount of memory we use */ 1216 /* correct map.total for the real total amount of memory we use */
1272 map.total = map.rm.size + map.r1.size; 1217 map.total = map.rm.size + map.r1.size;
1273 1218
1219 if (!map.r1.size) {
1220 DBG("%s:%d: No highmem region found\n", __func__, __LINE__);
1221 } else {
1222 DBG("%s:%d: Adding highmem region: %llxh %llxh\n",
1223 __func__, __LINE__, map.rm.size,
1224 map.total - map.rm.size);
1225 memblock_add(map.rm.size, map.total - map.rm.size);
1226 }
1227
1274 DBG(" <- %s:%d\n", __func__, __LINE__); 1228 DBG(" <- %s:%d\n", __func__, __LINE__);
1275} 1229}
1276 1230