powerpc/40x: Limit allocable DRAM during early mapping

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, November 30, 2008 - 5:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=590763...
Commit:     5907630ffc2b2d133de2db18963ee5a6c5af7878
Parent:     cb8fdc69a2a80e81e1280ec58afd2c3217ac8a7f
Author:     Grant Erickson <gerickson@nuovations.com>
AuthorDate: Wed Oct 29 11:41:14 2008 +0000
Committer:  Josh Boyer <jwboyer@linux.vnet.ibm.com>
CommitDate: Thu Nov 13 10:10:56 2008 -0500

    powerpc/40x: Limit allocable DRAM during early mapping
    
    If the size of DRAM is not an exact power of two, we may not have
    covered DRAM in its entirety with large 16 and 4 MiB pages.  If that
    is the case, we can get non-recoverable page faults when doing the
    final PTE mappings for the non-large page PTEs.
    
    Consequently, we restrict the top end of DRAM currently allocable
    by updating '__initial_memory_limit_addr' so that calls to the LMB to
    allocate PTEs for "tail" coverage with normal-sized pages (or other
    reasons) do not attempt to allocate outside the allowed range.
    
    Signed-off-by: Grant Erickson <gerickson@nuovations.com>
    Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
---
 arch/powerpc/mm/40x_mmu.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/40x_mmu.c b/arch/powerpc/mm/40x_mmu.c
index cecbbc7..29954dc 100644
--- a/arch/powerpc/mm/40x_mmu.c
+++ b/arch/powerpc/mm/40x_mmu.c
@@ -93,7 +93,7 @@ void __init MMU_init_hw(void)
 
 unsigned long __init mmu_mapin_ram(void)
 {
-	unsigned long v, s;
+	unsigned long v, s, mapped;
 	phys_addr_t p;
 
 	v = KERNELBASE;
@@ -130,5 +130,17 @@ unsigned long __init mmu_mapin_ram(void)
 		s -= LARGE_PAGE_SIZE_4M;
 	}
 
-	return total_lowmem - s;
+	mapped = total_lowmem - s;
+
+	/* If the size of RAM is not an exact power of two, we may not
+	 * have covered RAM in its entirety with 16 and 4 MiB
+	 * pages. Consequently, restrict the top end of RAM currently
+	 * allocable so that calls to the LMB to allocate PTEs for "tail"
+	 * coverage with normal-sized pages (or other reasons) do not
+	 * attempt to allocate outside the allowed range.
+	 */
+
+	__initial_memory_limit_addr = memstart_addr + mapped;
+
+	return mapped;
 }
--
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/40x: Limit allocable DRAM during early mapping, Linux Kernel Mailing ..., (Sun Nov 30, 5:59 pm)