Skip to contentSkip to conversation

powerpc/fsl-booke: Add new ISA 2.06 page sizes and MAS defines

PATCH Superseded Kumar Gala 3 participants 7 messages Feb 11, 2009 – Feb 12, 2009 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH v2 1/1 powerpc/fsl-booke: Add new ISA 2.06 page sizes and MAS defines

The Power ISA 2.06 added power of two page sizes to the embedded MMU architecture. Its done it such a way to be code compatiable with the existing HW. Made the minor code changes to support both power of two and power of four page sizes. Also added some new MAS bits and macros that are defined as part of the 2.06 ISA.

Note, its still invalid to try and use a page size that isn't supported by cpu.

---
* Fixed MAS6_ISIZE macro

 arch/powerpc/include/asm/mmu-fsl-booke.h |   54 ++++++++++++++++++++----------
 arch/powerpc/kernel/head_fsl_booke.S     |    2 +-
 arch/powerpc/mm/fsl_booke_mmu.c          |    2 +-
 3 files changed, 38 insertions(+), 20 deletions(-)
arch/powerpc/include/asm/mmu-fsl-booke.h +36 -18
index 3f941c0..e69a165 100644
@@ -6,21 +6,37 @@
 
 /* Book-E defined page sizes */
 #define BOOKE_PAGESZ_1K		0
-#define BOOKE_PAGESZ_4K		1
-#define BOOKE_PAGESZ_16K	2
-#define BOOKE_PAGESZ_64K	3
-#define BOOKE_PAGESZ_256K	4
-#define BOOKE_PAGESZ_1M		5
-#define BOOKE_PAGESZ_4M		6
-#define BOOKE_PAGESZ_16M	7
-#define BOOKE_PAGESZ_64M	8
-#define BOOKE_PAGESZ_256M	9
-#define BOOKE_PAGESZ_1GB	10
-#define BOOKE_PAGESZ_4GB	11
-#define BOOKE_PAGESZ_16GB	12
-#define BOOKE_PAGESZ_64GB	13
-#define BOOKE_PAGESZ_256GB	14
-#define BOOKE_PAGESZ_1TB	15
+#define BOOKE_PAGESZ_2K		1
+#define BOOKE_PAGESZ_4K		2
+#define BOOKE_PAGESZ_8K		3
+#define BOOKE_PAGESZ_16K	4
+#define BOOKE_PAGESZ_32K	5
+#define BOOKE_PAGESZ_64K	6
+#define BOOKE_PAGESZ_128K	7
+#define BOOKE_PAGESZ_256K	8
+#define BOOKE_PAGESZ_512K	9
+#define BOOKE_PAGESZ_1M		10
+#define BOOKE_PAGESZ_2M		11
+#define BOOKE_PAGESZ_4M		12
+#define BOOKE_PAGESZ_8M		13
+#define BOOKE_PAGESZ_16M	14
+#define BOOKE_PAGESZ_32M	15
+#define BOOKE_PAGESZ_64M	16
+#define BOOKE_PAGESZ_128M	17
+#define BOOKE_PAGESZ_256M	18
+#define BOOKE_PAGESZ_512M	19
+#define BOOKE_PAGESZ_1GB	20
+#define BOOKE_PAGESZ_2GB	21
+#define BOOKE_PAGESZ_4GB	22
+#define BOOKE_PAGESZ_8GB	23
+#define BOOKE_PAGESZ_16GB	24
+#define BOOKE_PAGESZ_32GB	25
+#define BOOKE_PAGESZ_64GB	26
+#define BOOKE_PAGESZ_128GB	27
+#define BOOKE_PAGESZ_256GB	28
+#define BOOKE_PAGESZ_512GB	29
+#define BOOKE_PAGESZ_1TB	30
+#define BOOKE_PAGESZ_2TB	31
 
 #define MAS0_TLBSEL(x)	((x << 28) & 0x30000000)
 #define MAS0_ESEL(x)	((x << 16) & 0x0FFF0000)
@@ -29,8 +45,9 @@
 #define MAS1_VALID 	0x80000000
 #define MAS1_IPROT	0x40000000
 #define MAS1_TID(x)	((x << 16) & 0x3FFF0000)
+#define MAS1_IND	0x00002000
 #define MAS1_TS		0x00001000
-#define MAS1_TSIZE(x)	((x << 8) & 0x00000F00)
+#define MAS1_TSIZE(x)	((x << 7) & 0x00000F80)
 
 #define MAS2_EPN	0xFFFFF000
 #define MAS2_X0		0x00000040
@@ -40,7 +57,7 @@
 #define MAS2_M		0x00000004
 #define MAS2_G		0x00000002
 #define MAS2_E		0x00000001
-#define MAS2_EPN_MASK(size)		(~0 << (2*(size) + 10))
+#define MAS2_EPN_MASK(size)		(~0 << (size + 10))
 #define MAS2_VAL(addr, size, flags)	((addr) & MAS2_EPN_MASK(size) | (flags))
 
 #define MAS3_RPN	0xFFFFF000
@@ -56,7 +73,7 @@
 #define MAS3_SR		0x00000001
 
 #define MAS4_TLBSELD(x) MAS0_TLBSEL(x)
-#define MAS4_TIDDSEL	0x000F0000
+#define MAS4_INDD	0x00008000
 #define MAS4_TSIZED(x)	MAS1_TSIZE(x)
 #define MAS4_X0D	0x00000040
 #define MAS4_X1D	0x00000020
@@ -68,6 +85,7 @@
 
 #define MAS6_SPID0	0x3FFF0000
 #define MAS6_SPID1	0x00007FFE
+#define MAS6_ISIZE(x)	MAS1_TSIZE(x)
 #define MAS6_SAS	0x00000001
 #define MAS6_SPID	MAS6_SPID0
 
arch/powerpc/kernel/head_fsl_booke.S +1 -1
index 64ecb16..7f49af7 100644
@@ -173,7 +173,7 @@ skpinv:	addi	r6,r6,1				/* Increment */
 
 	/* grab and fixup the RPN */
 	mfspr	r6,SPRN_MAS1	/* extract MAS1[SIZE] */
-	rlwinm	r6,r6,25,27,30
+	rlwinm	r6,r6,25,27,31
 	li	r8,-1
 	addi	r6,r6,10
 	slw	r6,r8,r6	/* convert to mask */
arch/powerpc/mm/fsl_booke_mmu.c +1 -1
index 0b9ba6b..54f3631 100644
@@ -111,7 +111,7 @@ void settlbcam(int index, unsigned long virt, phys_addr_t phys,
 	unsigned int tsize, lz;
 
 	asm ("cntlzw %0,%1" : "=r" (lz) : "r" (size));
-	tsize = (21 - lz) / 2;
+	tsize = 21 - lz;
 
 #ifdef CONFIG_SMP
 	if ((flags & _PAGE_NO_CACHE) == 0)
Signature · 1 line
1.5.6.6
author
#1 lore raw
Quoted 9 lines · Kumar Gala

The Power ISA 2.06 added power of two page sizes to the embedded MMU architecture. Its done it such a way to be code compatiable with the existing HW. Made the minor code changes to support both power of two and power of four page sizes. Also added some new MAS bits and macros that are defined as part of the 2.06 ISA.

Note, its still invalid to try and use a page size that isn't supported by cpu.

Quoted 6 lines

---
* Fixed MAS6_ISIZE macro

arch/powerpc/include/asm/mmu-fsl-booke.h | 54 +++++++++++++++++++
+----------

Do you want to rename asm/mmu-fsl-booke.h => mmu-booke.h (per ISA 2.06 changes)?

- k

#2 lore raw
Quoted 17 lines · Kumar Gala
Quoted 14 lines · Kumar Gala

The Power ISA 2.06 added power of two page sizes to the embedded MMU architecture. Its done it such a way to be code compatiable with the existing HW. Made the minor code changes to support both power of two and power of four page sizes. Also added some new MAS bits and macros that are defined as part of the 2.06 ISA.

Note, its still invalid to try and use a page size that isn't supported
by cpu.

---
* Fixed MAS6_ISIZE macro

Quoted 5 lines
Quoted 2 lines

arch/powerpc/include/asm/mmu-fsl-booke.h | 54 +++++++++++++++++++
+----------

Do you want to rename asm/mmu-fsl-booke.h => mmu-booke.h (per ISA 2.06 changes)?

Misleading perhaps. ISA 2.06 is really new and we've been calling 4xx and FSL booke for a while now.

josh

author
#3 lore raw
Quoted 18 lines · Josh Boyer
Quoted 17 lines · Kumar Gala
Quoted 14 lines · Kumar Gala

The Power ISA 2.06 added power of two page sizes to the embedded MMU architecture. Its done it such a way to be code compatiable with the existing HW. Made the minor code changes to support both power of two and power of four page sizes. Also added some new MAS bits and macros that are defined as part of the 2.06 ISA.

Note, its still invalid to try and use a page size that isn't supported
by cpu.

---
* Fixed MAS6_ISIZE macro

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

arch/powerpc/include/asm/mmu-fsl-booke.h | 54 +++++++++++++++++++
+----------

Do you want to rename asm/mmu-fsl-booke.h => mmu-booke.h (per ISA 2.06 changes)?

Misleading perhaps. ISA 2.06 is really new and we've been calling 4xx and FSL booke for a while now.

I can call it mmu-book3e.h if you think that might enough different to convey the ISA 2.06 fact that the FSL style MMU is now part of the 3e architecture.

- k

#4 lore raw
Quoted 4 lines

I can call it mmu-book3e.h if you think that might enough different to convey the ISA 2.06 fact that the FSL style MMU is now part of the 3e architecture.

That's better. book3e is what I've been using internally...

Cheers,
Ben.

#5 lore raw
In reply to Kumar Gala
Quoted 31 lines · Kumar Gala
Quoted 28 lines · Josh Boyer
Quoted 26 lines · Kumar Gala
Quoted 13 lines · Kumar Gala

The Power ISA 2.06 added power of two page sizes to the embedded MMU architecture. Its done it such a way to be code compatiable with the
existing HW. Made the minor code changes to support both power of two
and power of four page sizes. Also added some new MAS bits and macros
that are defined as part of the 2.06 ISA.

Note, its still invalid to try and use a page size that isn't supported
by cpu.

Quoted 6 lines

---
* Fixed MAS6_ISIZE macro

arch/powerpc/include/asm/mmu-fsl-booke.h | 54 +++++++++++++++++++
+----------

Do you want to rename asm/mmu-fsl-booke.h => mmu-booke.h (per ISA 2.06
changes)?

Quoted 6 lines
Quoted 2 lines

Misleading perhaps. ISA 2.06 is really new and we've been calling 4xx and FSL booke for a while now.

I can call it mmu-book3e.h if you think that might enough different to convey the ISA 2.06 fact that the FSL style MMU is now part of the 3e architecture.

Yep, sounds great. "What's in a name..", right? :)

josh

#6 lore raw
In reply to Kumar Gala
Quoted 16 lines · Kumar Gala
Quoted 14 lines · Kumar Gala

The Power ISA 2.06 added power of two page sizes to the embedded MMU architecture. Its done it such a way to be code compatiable with the existing HW. Made the minor code changes to support both power of two and power of four page sizes. Also added some new MAS bits and macros that are defined as part of the 2.06 ISA.

Note, its still invalid to try and use a page size that isn't supported
by cpu.

---
* Fixed MAS6_ISIZE macro

Quoted 5 lines
Quoted 2 lines

arch/powerpc/include/asm/mmu-fsl-booke.h | 54 +++++++++++++++++++
+----------

Do you want to rename asm/mmu-fsl-booke.h => mmu-booke.h (per ISA 2.06 changes)?

I've actually been wondering about that indeed ... No objection if you want to move forward with that !

Cheers,
Ben.