powerpc: Force memory size to be a multiple of PAGE_SIZE

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, December 28, 2008 - 6:05 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6ca4f7...
Commit:     6ca4f7494bde078b2b730e28e4ea1dc36a772f70
Parent:     f8f50b1bddd49eb171398cfc543c957884dc6e35
Author:     Hollis Blanchard <hollisb@us.ibm.com>
AuthorDate: Wed Nov 26 10:19:26 2008 -0600
Committer:  Paul Mackerras <paulus@samba.org>
CommitDate: Mon Dec 29 09:53:14 2008 +1100

    powerpc: Force memory size to be a multiple of PAGE_SIZE
    
    Ensure that total memory size is page-aligned, because otherwise
    mark_bootmem() gets upset.
    
    This error case was triggered by using 64 KiB pages in the kernel
    while arch/powerpc/boot/4xx.c arbitrarily reduced the amount of memory
    by 4096 (to work around a chip bug that affects the last 256 bytes of
    physical memory).
    
    Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
    Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 arch/powerpc/kernel/prom.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d8266dd..6f73c73 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1160,6 +1160,8 @@ static inline void __init phyp_dump_reserve_mem(void) {}
 
 void __init early_init_devtree(void *params)
 {
+	unsigned long limit;
+
 	DBG(" -> early_init_devtree(%p)\n", params);
 
 	/* Setup flat device-tree pointer */
@@ -1200,7 +1202,19 @@ void __init early_init_devtree(void *params)
 	early_reserve_mem();
 	phyp_dump_reserve_mem();
 
-	lmb_enforce_memory_limit(memory_limit);
+	limit = memory_limit;
+	if (! limit) {
+		unsigned long memsize;
+
+		/* Ensure that total memory size is page-aligned, because
+		 * otherwise mark_bootmem() gets upset. */
+		lmb_analyze();
+		memsize = lmb_phys_mem_size();
+		if ((memsize & PAGE_MASK) != memsize)
+			limit = memsize & PAGE_MASK;
+	}
+	lmb_enforce_memory_limit(limit);
+
 	lmb_analyze();
 
 	DBG("Phys. mem: %lx\n", lmb_phys_mem_size());
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
powerpc: Force memory size to be a multiple of PAGE_SIZE, Linux Kernel Mailing ..., (Sun Dec 28, 6:05 pm)