Skip to contentSkip to conversation

powerpc: Revise PPC44x MMU code for arch/powerpc

PATCH David Gibson 4 participants 4 messages Apr 30, 2007 – May 1, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

This patch takes the definitions for the PPC44x MMU (a software loaded TLB) from asm-ppc/mmu.h, cleans them up of things no longer necessary in arch/powerpc and puts them in a new asm-powerpc/mmu_44x.h file. It also substantially simplifies arch/powerpc/mm/44x_mmu.c and makes a couple of small fixes necessary for the 44x MMU code to build and work properly in arch/powerpc.

---

Paulus, I think this one's ready to go now. Please apply.

 arch/powerpc/kernel/head_44x.S |    4 +-
 arch/powerpc/mm/44x_mmu.c      |   82 +++++++++--------------------------------
 arch/powerpc/mm/mmu_decl.h     |    3 +
 include/asm-powerpc/mmu-44x.h  |   72 ++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/mmu.h      |    7 ++-
 5 files changed, 100 insertions(+), 68 deletions(-)
include/asm-powerpc/mmu.h +5 -2
Index: working-2.6/include/asm-powerpc/mmu.h
===================================================================
@@ -5,9 +5,12 @@
 #ifdef CONFIG_PPC64
 /* 64-bit classic hash table MMU */
 #  include <asm/mmu-hash64.h>
+#elif defined(CONFIG_44x)
+/* 44x-style software loaded TLB */
+#  include <asm/mmu-44x.h>
 #else
-/* 32-bit.  FIXME: split up the 32-bit MMU types, and revise for
- * arch/powerpc */
+/* Other 32-bit.  FIXME: split up the other 32-bit MMU types, and
+ * revise for arch/powerpc */
 #  include <asm-ppc/mmu.h>
 #endif
 
arch/powerpc/kernel/head_44x.S +2 -2
Index: working-2.6/arch/powerpc/kernel/head_44x.S
===================================================================
@@ -120,8 +120,8 @@ skpinv:	addi	r4,r4,1				/* Increment */
  * Configure and load pinned entry into TLB slot 63.
  */
 
-	lis	r3,KERNELBASE@h		/* Load the kernel virtual address */
-	ori	r3,r3,KERNELBASE@l
+	lis	r3,PAGE_OFFSET@h
+	ori	r3,r3,PAGE_OFFSET@l
 
 	/* Kernel is at the base of RAM */
 	li r4, 0			/* Load the kernel physical address */
arch/powerpc/mm/44x_mmu.c +19 -63

114 lines not on this page · raw message

include/asm-powerpc/mmu-44x.h new file +72 -0

72 lines not on this page · raw message

arch/powerpc/mm/mmu_decl.h +2 -1
Index: working-2.6/arch/powerpc/mm/mmu_decl.h
===================================================================
@@ -40,7 +40,8 @@ extern int __map_without_bats;
 extern unsigned long ioremap_base;
 extern unsigned int rtas_data, rtas_size;
 
-extern PTE *Hash, *Hash_end;
+struct _PTE;
+extern struct _PTE *Hash, *Hash_end;
 extern unsigned long Hash_size, Hash_mask;
 
 extern unsigned int num_tlbcam_entries;
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw
Quoted 4 lines · David Gibson

Index: working-2.6/include/asm-powerpc/mmu-44x.h
===================================================================

include/asm-powerpc/mmu-44x.h new file +0 -0

<snip>

include/asm-powerpc/mmu-44x.h line 58

Quoted 5 lines
include/asm-powerpc/mmu-44x.h new file +5 -0
+#ifndef __ASSEMBLY__
+
+typedef unsigned long long phys_addr_t;
+
+extern phys_addr_t fixup_bigphys_addr(phys_addr_t, phys_addr_t);

This function can likely get removed entirely in arch/powerpc. ioremap can already take a 64 bit address and do the correct thing, so I'm not sure it's even needed anymore.

josh

#2 lore raw
Quoted 8 lines · Josh Boyer
Quoted 4 lines · David Gibson

Index: working-2.6/include/asm-powerpc/mmu-44x.h
===================================================================

include/asm-powerpc/mmu-44x.h new file +0 -0

<snip>

Quoted 9 lines

include/asm-powerpc/mmu-44x.h line 58

Quoted 5 lines
include/asm-powerpc/mmu-44x.h new file +5 -0
+#ifndef __ASSEMBLY__
+
+typedef unsigned long long phys_addr_t;
+
+extern phys_addr_t fixup_bigphys_addr(phys_addr_t, phys_addr_t);

This function can likely get removed entirely in arch/powerpc. ioremap can already take a 64 bit address and do the correct thing, so I'm not sure it's even needed anymore.

Yeah, the bigphys fixup should'nt be necessary now that resources can be 64 bits. There is -one- thing for which that remapping could still potentially be useful is... the X server. That bloody POS currently doesn't deal with PCI very well and will do horrible things to your system if you try to make it grok 64 bits resources (when it's 32 bits binary). But then, if you want that working, you need both the above sort of remapping, but you also need to fix /dev/mem to take it into account (which the current arch/ppc code doesn't do).

Cheers,
Ben.

#3 lore raw
In reply to Josh Boyer
Quoted 8 lines · Josh Boyer
Quoted 4 lines · David Gibson

Index: working-2.6/include/asm-powerpc/mmu-44x.h
===================================================================

include/asm-powerpc/mmu-44x.h new file +0 -0

<snip>

Quoted 9 lines

include/asm-powerpc/mmu-44x.h line 58

Quoted 5 lines
include/asm-powerpc/mmu-44x.h new file +5 -0
+#ifndef __ASSEMBLY__
+
+typedef unsigned long long phys_addr_t;
+
+extern phys_addr_t fixup_bigphys_addr(phys_addr_t, phys_addr_t);

This function can likely get removed entirely in arch/powerpc. ioremap can already take a 64 bit address and do the correct thing, so I'm not sure it's even needed anymore.

Right now it's invoked from common code in the 32-bit pgtable.h though. It'll need some cleanup and factorization in other places to get rid of this; one thing at a time.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson