From: Matt Porter <mporter@kernel.crashing.org>

This makes the PPC40x lowmem large tlb mapping selectable via a cmdline
option.  This allows use of the normal page-sized mapping so that kernel
text can be read only if desired.

Signed-off-by: Josh Boyer <jwboyer@charter.net>
Signed-off-by: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/ppc/mm/4xx_mmu.c |    5 +++++
 25-akpm/arch/ppc/mm/init.c    |    5 +++++
 2 files changed, 10 insertions(+)

diff -puN arch/ppc/mm/4xx_mmu.c~ppc32-make-ppc40x-large-tlb-mapping-optional arch/ppc/mm/4xx_mmu.c
--- 25/arch/ppc/mm/4xx_mmu.c~ppc32-make-ppc40x-large-tlb-mapping-optional	2004-08-15 14:23:54.512737360 -0700
+++ 25-akpm/arch/ppc/mm/4xx_mmu.c	2004-08-15 14:23:54.517736600 -0700
@@ -52,6 +52,7 @@
 #include <asm/setup.h>
 #include "mmu_decl.h"
 
+extern int __map_without_ltlbs;
 /*
  * MMU_init_hw does the chip-specific initialization of the MMU hardware.
  */
@@ -102,6 +103,10 @@ unsigned long __init mmu_mapin_ram(void)
 	p = PPC_MEMSTART;
 	s = 0;
 
+	if (__map_without_ltlbs) {
+		return s;
+	}
+
 	while (s <= (total_lowmem - LARGE_PAGE_SIZE_16M)) {
 		pmd_t *pmdp;
 		unsigned long val = p | _PMD_SIZE_16M | _PAGE_HWEXEC | _PAGE_HWWRITE;
diff -puN arch/ppc/mm/init.c~ppc32-make-ppc40x-large-tlb-mapping-optional arch/ppc/mm/init.c
--- 25/arch/ppc/mm/init.c~ppc32-make-ppc40x-large-tlb-mapping-optional	2004-08-15 14:23:54.513737208 -0700
+++ 25-akpm/arch/ppc/mm/init.c	2004-08-15 14:23:54.517736600 -0700
@@ -104,6 +104,7 @@ extern unsigned long sysmap_size;
  * -- Cort
  */
 int __map_without_bats;
+int __map_without_ltlbs;
 
 /* max amount of RAM to use */
 unsigned long __max_memory;
@@ -204,6 +205,10 @@ void MMU_setup(void)
 		__map_without_bats = 1;
 	}
 
+	if (strstr(cmd_line, "noltlbs")) {
+		__map_without_ltlbs = 1;
+	}
+
 	/* Look for mem= option on command line */
 	if (strstr(cmd_line, "mem=")) {
 		char *p, *q;
_