diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2009-08-24 11:52:48 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-08-28 00:24:12 -0400 |
commit | df5d6ecf8157245ef733db87597adb2c6e2510da (patch) | |
tree | 9b1df8a76713d55ca08d11bd212281b11f6af652 /arch | |
parent | 23e55f92d4fd733365dd572ea6e9e211387123c2 (diff) |
powerpc/mm: Add MMU features for TLB reservation & Paired MAS registers
Support for TLB reservation (or TLB Write Conditional) and Paired MAS
registers are optional for a processor implementation so we handle
them via MMU feature sections.
We currently only used paired MAS registers to access the full RPN + perm
bits that are kept in MAS7||MAS3. We assume that if an implementation has
hardware page table at this time it also implements in TLB reservations.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/mmu.h | 9 | ||||
-rw-r--r-- | arch/powerpc/mm/tlb_low_64e.S | 38 |
2 files changed, 46 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index 2fcfefc60894..7ffbb65ff7a9 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
@@ -58,6 +58,15 @@ | |||
58 | */ | 58 | */ |
59 | #define MMU_FTR_TLBIE_206 ASM_CONST(0x00400000) | 59 | #define MMU_FTR_TLBIE_206 ASM_CONST(0x00400000) |
60 | 60 | ||
61 | /* Enable use of TLB reservation. Processor should support tlbsrx. | ||
62 | * instruction and MAS0[WQ]. | ||
63 | */ | ||
64 | #define MMU_FTR_USE_TLBRSRV ASM_CONST(0x00800000) | ||
65 | |||
66 | /* Use paired MAS registers (MAS7||MAS3, etc.) | ||
67 | */ | ||
68 | #define MMU_FTR_USE_PAIRED_MAS ASM_CONST(0x01000000) | ||
69 | |||
61 | #ifndef __ASSEMBLY__ | 70 | #ifndef __ASSEMBLY__ |
62 | #include <asm/cputable.h> | 71 | #include <asm/cputable.h> |
63 | 72 | ||
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S index cd92f62f9cf5..ef1cccf71173 100644 --- a/arch/powerpc/mm/tlb_low_64e.S +++ b/arch/powerpc/mm/tlb_low_64e.S | |||
@@ -189,12 +189,16 @@ normal_tlb_miss: | |||
189 | clrrdi r14,r14,3 | 189 | clrrdi r14,r14,3 |
190 | or r10,r15,r14 | 190 | or r10,r15,r14 |
191 | 191 | ||
192 | BEGIN_MMU_FTR_SECTION | ||
192 | /* Set the TLB reservation and seach for existing entry. Then load | 193 | /* Set the TLB reservation and seach for existing entry. Then load |
193 | * the entry. | 194 | * the entry. |
194 | */ | 195 | */ |
195 | PPC_TLBSRX_DOT(0,r16) | 196 | PPC_TLBSRX_DOT(0,r16) |
196 | ld r14,0(r10) | 197 | ld r14,0(r10) |
197 | beq normal_tlb_miss_done | 198 | beq normal_tlb_miss_done |
199 | MMU_FTR_SECTION_ELSE | ||
200 | ld r14,0(r10) | ||
201 | ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV) | ||
198 | 202 | ||
199 | finish_normal_tlb_miss: | 203 | finish_normal_tlb_miss: |
200 | /* Check if required permissions are met */ | 204 | /* Check if required permissions are met */ |
@@ -241,7 +245,14 @@ finish_normal_tlb_miss: | |||
241 | bne 1f | 245 | bne 1f |
242 | li r11,MAS3_SW|MAS3_UW | 246 | li r11,MAS3_SW|MAS3_UW |
243 | andc r15,r15,r11 | 247 | andc r15,r15,r11 |
244 | 1: mtspr SPRN_MAS7_MAS3,r15 | 248 | 1: |
249 | BEGIN_MMU_FTR_SECTION | ||
250 | srdi r16,r15,32 | ||
251 | mtspr SPRN_MAS3,r15 | ||
252 | mtspr SPRN_MAS7,r16 | ||
253 | MMU_FTR_SECTION_ELSE | ||
254 | mtspr SPRN_MAS7_MAS3,r15 | ||
255 | ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_PAIRED_MAS) | ||
245 | 256 | ||
246 | tlbwe | 257 | tlbwe |
247 | 258 | ||
@@ -311,11 +322,13 @@ virt_page_table_tlb_miss: | |||
311 | rlwinm r10,r10,0,16,1 /* Clear TID */ | 322 | rlwinm r10,r10,0,16,1 /* Clear TID */ |
312 | mtspr SPRN_MAS1,r10 | 323 | mtspr SPRN_MAS1,r10 |
313 | 1: | 324 | 1: |
325 | BEGIN_MMU_FTR_SECTION | ||
314 | /* Search if we already have a TLB entry for that virtual address, and | 326 | /* Search if we already have a TLB entry for that virtual address, and |
315 | * if we do, bail out. | 327 | * if we do, bail out. |
316 | */ | 328 | */ |
317 | PPC_TLBSRX_DOT(0,r16) | 329 | PPC_TLBSRX_DOT(0,r16) |
318 | beq virt_page_table_tlb_miss_done | 330 | beq virt_page_table_tlb_miss_done |
331 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_TLBRSRV) | ||
319 | 332 | ||
320 | /* Now, we need to walk the page tables. First check if we are in | 333 | /* Now, we need to walk the page tables. First check if we are in |
321 | * range. | 334 | * range. |
@@ -367,10 +380,18 @@ virt_page_table_tlb_miss: | |||
367 | */ | 380 | */ |
368 | clrldi r11,r15,4 /* remove region ID from RPN */ | 381 | clrldi r11,r15,4 /* remove region ID from RPN */ |
369 | ori r10,r11,1 /* Or-in SR */ | 382 | ori r10,r11,1 /* Or-in SR */ |
383 | |||
384 | BEGIN_MMU_FTR_SECTION | ||
385 | srdi r16,r10,32 | ||
386 | mtspr SPRN_MAS3,r10 | ||
387 | mtspr SPRN_MAS7,r16 | ||
388 | MMU_FTR_SECTION_ELSE | ||
370 | mtspr SPRN_MAS7_MAS3,r10 | 389 | mtspr SPRN_MAS7_MAS3,r10 |
390 | ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_PAIRED_MAS) | ||
371 | 391 | ||
372 | tlbwe | 392 | tlbwe |
373 | 393 | ||
394 | BEGIN_MMU_FTR_SECTION | ||
374 | virt_page_table_tlb_miss_done: | 395 | virt_page_table_tlb_miss_done: |
375 | 396 | ||
376 | /* We have overriden MAS2:EPN but currently our primary TLB miss | 397 | /* We have overriden MAS2:EPN but currently our primary TLB miss |
@@ -394,6 +415,7 @@ virt_page_table_tlb_miss_done: | |||
394 | addi r10,r11,-4 | 415 | addi r10,r11,-4 |
395 | std r10,PACA_EXTLB+EX_TLB_SIZE+EX_TLB_SRR0(r13) | 416 | std r10,PACA_EXTLB+EX_TLB_SIZE+EX_TLB_SRR0(r13) |
396 | 1: | 417 | 1: |
418 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_TLBRSRV) | ||
397 | /* Return to caller, normal case */ | 419 | /* Return to caller, normal case */ |
398 | TLB_MISS_STATS_X(MMSTAT_TLB_MISS_PT_OK); | 420 | TLB_MISS_STATS_X(MMSTAT_TLB_MISS_PT_OK); |
399 | TLB_MISS_EPILOG_SUCCESS | 421 | TLB_MISS_EPILOG_SUCCESS |
@@ -618,7 +640,14 @@ htw_tlb_miss: | |||
618 | #else | 640 | #else |
619 | ori r10,r15,(BOOK3E_PAGESZ_4K << MAS3_SPSIZE_SHIFT) | 641 | ori r10,r15,(BOOK3E_PAGESZ_4K << MAS3_SPSIZE_SHIFT) |
620 | #endif | 642 | #endif |
643 | |||
644 | BEGIN_MMU_FTR_SECTION | ||
645 | srdi r16,r10,32 | ||
646 | mtspr SPRN_MAS3,r10 | ||
647 | mtspr SPRN_MAS7,r16 | ||
648 | MMU_FTR_SECTION_ELSE | ||
621 | mtspr SPRN_MAS7_MAS3,r10 | 649 | mtspr SPRN_MAS7_MAS3,r10 |
650 | ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_PAIRED_MAS) | ||
622 | 651 | ||
623 | tlbwe | 652 | tlbwe |
624 | 653 | ||
@@ -700,7 +729,14 @@ tlb_load_linear: | |||
700 | clrrdi r10,r16,30 /* 1G page index */ | 729 | clrrdi r10,r16,30 /* 1G page index */ |
701 | clrldi r10,r10,4 /* clear region bits */ | 730 | clrldi r10,r10,4 /* clear region bits */ |
702 | ori r10,r10,MAS3_SR|MAS3_SW|MAS3_SX | 731 | ori r10,r10,MAS3_SR|MAS3_SW|MAS3_SX |
732 | |||
733 | BEGIN_MMU_FTR_SECTION | ||
734 | srdi r16,r10,32 | ||
735 | mtspr SPRN_MAS3,r10 | ||
736 | mtspr SPRN_MAS7,r16 | ||
737 | MMU_FTR_SECTION_ELSE | ||
703 | mtspr SPRN_MAS7_MAS3,r10 | 738 | mtspr SPRN_MAS7_MAS3,r10 |
739 | ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_PAIRED_MAS) | ||
704 | 740 | ||
705 | tlbwe | 741 | tlbwe |
706 | 742 | ||