diff mbox

[3/6] powerpc/ps3: Write highmem info to repository

Message ID 3deced9919246f281e48f1258885937f11a4b4ee.1421109719.git.geoff@infradead.org (mailing list archive)
State Accepted
Commit 5ae74630ee4fa98bbba7a7cd8ee6919fd9f38561
Delegated to: Michael Ellerman
Headers show

Commit Message

Geoff Levand Jan. 13, 2015, 1 a.m. UTC
Add calls to the ps3_mm_set_repository_highmem() routine when the ps3
r1 highmem region is either created or destroyed.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/powerpc/platforms/ps3/mm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Michael Ellerman Jan. 13, 2015, 3:04 a.m. UTC | #1
On Tue, 2015-01-13 at 01:00 +0000, Geoff Levand wrote:
> Add calls to the ps3_mm_set_repository_highmem() routine when the ps3
> r1 highmem region is either created or destroyed.

What does this actually do? ie. from a user perspective.

cheers
Geoff Levand Jan. 13, 2015, 6:33 p.m. UTC | #2
Hi Michael,

On Tue, 2015-01-13 at 14:04 +1100, Michael Ellerman wrote:
> On Tue, 2015-01-13 at 01:00 +0000, Geoff Levand wrote:
> > Add calls to the ps3_mm_set_repository_highmem() routine when the ps3
> > r1 highmem region is either created or destroyed.
> 
> What does this actually do? ie. from a user perspective.

It will allow a kexec based bootloader (petitboot for example) to
pre-allocate a highmem region and store things like an initrd or other
large data needed to boot an OS.  With some PS3 configurations the boot
memory region is not large enough to fit all the boot data.

There was ongoing discussion about this on the ML.  Here are two
relevant posts:

https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-April/097691.html
https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-April/097695.html

Here is the very first post which outlines the motivation, etc.:

https://lists.ozlabs.org/pipermail/cbe-oss-dev/2011-August/007420.html

-Geoff
diff mbox

Patch

diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 04c1b93..b0f3466 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -329,6 +329,7 @@  static void ps3_mm_region_destroy(struct mem_region *r)
 		r->size = r->base = r->offset = 0;
 		map.total = map.rm.size;
 	}
+	ps3_mm_set_repository_highmem(NULL);
 }
 
 /*============================================================================*/
@@ -1218,8 +1219,12 @@  void __init ps3_mm_init(void)
 
 	/* Check if we got the highmem region from an earlier boot step */
 
-	if (ps3_mm_get_repository_highmem(&map.r1))
-		ps3_mm_region_create(&map.r1, map.total - map.rm.size);
+	if (ps3_mm_get_repository_highmem(&map.r1)) {
+		result = ps3_mm_region_create(&map.r1, map.total - map.rm.size);
+
+		if (!result)
+			ps3_mm_set_repository_highmem(&map.r1);
+	}
 
 	/* correct map.total for the real total amount of memory we use */
 	map.total = map.rm.size + map.r1.size;