aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-14 18:32:02 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-26 23:02:10 -0400
commitbd491781097f150687906008d639936a0c00ed90 (patch)
tree96a6926005c6765724fce93b0b27e504cd0172df
parent76b4eda866c4936af8d696f040abea56bf688e16 (diff)
powerpc: Add TLB size detection for TYPE_3E MMUs
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/mmu-book3e.h15
-rw-r--r--arch/powerpc/mm/mmu_context_nohash.c12
2 files changed, 26 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h
index 17194fcd4040..80d68afb0200 100644
--- a/arch/powerpc/include/asm/mmu-book3e.h
+++ b/arch/powerpc/include/asm/mmu-book3e.h
@@ -137,6 +137,21 @@
137#define MMUCSR0_TLB2PS 0x00078000 /* TLB2 Page Size */ 137#define MMUCSR0_TLB2PS 0x00078000 /* TLB2 Page Size */
138#define MMUCSR0_TLB3PS 0x00780000 /* TLB3 Page Size */ 138#define MMUCSR0_TLB3PS 0x00780000 /* TLB3 Page Size */
139 139
140/* MMUCFG bits */
141#define MMUCFG_MAVN_NASK 0x00000003
142#define MMUCFG_MAVN_V1_0 0x00000000
143#define MMUCFG_MAVN_V2_0 0x00000001
144#define MMUCFG_NTLB_MASK 0x0000000c
145#define MMUCFG_NTLB_SHIFT 2
146#define MMUCFG_PIDSIZE_MASK 0x000007c0
147#define MMUCFG_PIDSIZE_SHIFT 6
148#define MMUCFG_TWC 0x00008000
149#define MMUCFG_LRAT 0x00010000
150#define MMUCFG_RASIZE_MASK 0x00fe0000
151#define MMUCFG_RASIZE_SHIFT 17
152#define MMUCFG_LPIDSIZE_MASK 0x0f000000
153#define MMUCFG_LPIDSIZE_SHIFT 24
154
140/* TLBnCFG encoding */ 155/* TLBnCFG encoding */
141#define TLBnCFG_N_ENTRY 0x00000fff /* number of entries */ 156#define TLBnCFG_N_ENTRY 0x00000fff /* number of entries */
142#define TLBnCFG_HES 0x00002000 /* HW select supported */ 157#define TLBnCFG_HES 0x00002000 /* HW select supported */
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index 4d8fa911c73d..336807de550e 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -409,7 +409,17 @@ void __init mmu_context_init(void)
409 } else if (mmu_has_feature(MMU_FTR_TYPE_47x)) { 409 } else if (mmu_has_feature(MMU_FTR_TYPE_47x)) {
410 first_context = 1; 410 first_context = 1;
411 last_context = 65535; 411 last_context = 65535;
412 } else { 412 } else
413#ifdef CONFIG_PPC_BOOK3E_MMU
414 if (mmu_has_feature(MMU_FTR_TYPE_3E)) {
415 u32 mmucfg = mfspr(SPRN_MMUCFG);
416 u32 pid_bits = (mmucfg & MMUCFG_PIDSIZE_MASK)
417 >> MMUCFG_PIDSIZE_SHIFT;
418 first_context = 1;
419 last_context = (1UL << (pid_bits + 1)) - 1;
420 } else
421#endif
422 {
413 first_context = 1; 423 first_context = 1;
414 last_context = 255; 424 last_context = 255;
415 } 425 }