aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2009-09-01 11:48:42 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-09-02 02:20:41 -0400
commit76acc2c1a7a9a8c2cae7e9cf8d0a8b374a48aa94 (patch)
tree3d65ea23c18d4a73ce55724de66ae9eb7eb2358d /arch
parent1d5d9527d8ed8d87beb22a4fd954366aeabd12c7 (diff)
powerpc/fsl-booke: Use HW PTE format if CONFIG_PTE_64BIT
Switch to using the Power ISA defined PTE format when we have a 64-bit PTE. This makes the code handling between fsl-booke and book3e-64 similiar for TLB faults. Additionally this lets use take advantage of the page size encodings and full permissions that the HW PTE defines. Also defined _PMD_PRESENT, _PMD_PRESENT_MASK, and _PMD_BAD since the 32-bit ppc arch code expects them. 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/pgtable-ppc32.h2
-rw-r--r--arch/powerpc/include/asm/pte-book3e.h3
-rw-r--r--arch/powerpc/include/asm/pte-fsl-booke.h7
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S36
4 files changed, 30 insertions, 18 deletions
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index f2c52e253956..55646adfa843 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -111,6 +111,8 @@ extern int icache_44x_need_flush;
111#include <asm/pte-40x.h> 111#include <asm/pte-40x.h>
112#elif defined(CONFIG_44x) 112#elif defined(CONFIG_44x)
113#include <asm/pte-44x.h> 113#include <asm/pte-44x.h>
114#elif defined(CONFIG_FSL_BOOKE) && defined(CONFIG_PTE_64BIT)
115#include <asm/pte-book3e.h>
114#elif defined(CONFIG_FSL_BOOKE) 116#elif defined(CONFIG_FSL_BOOKE)
115#include <asm/pte-fsl-booke.h> 117#include <asm/pte-fsl-booke.h>
116#elif defined(CONFIG_8xx) 118#elif defined(CONFIG_8xx)
diff --git a/arch/powerpc/include/asm/pte-book3e.h b/arch/powerpc/include/asm/pte-book3e.h
index b82b9dc91a7d..082d515930a2 100644
--- a/arch/powerpc/include/asm/pte-book3e.h
+++ b/arch/powerpc/include/asm/pte-book3e.h
@@ -75,6 +75,9 @@
75/* On 32-bit, we never clear the top part of the PTE */ 75/* On 32-bit, we never clear the top part of the PTE */
76#ifdef CONFIG_PPC32 76#ifdef CONFIG_PPC32
77#define _PTE_NONE_MASK 0xffffffff00000000ULL 77#define _PTE_NONE_MASK 0xffffffff00000000ULL
78#define _PMD_PRESENT 0
79#define _PMD_PRESENT_MASK (PAGE_MASK)
80#define _PMD_BAD (~PAGE_MASK)
78#endif 81#endif
79 82
80#endif /* __KERNEL__ */ 83#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/pte-fsl-booke.h b/arch/powerpc/include/asm/pte-fsl-booke.h
index ce8a9e94ce7f..2c12be5f677a 100644
--- a/arch/powerpc/include/asm/pte-fsl-booke.h
+++ b/arch/powerpc/include/asm/pte-fsl-booke.h
@@ -33,13 +33,6 @@
33#define _PAGE_WRITETHRU 0x00400 /* H: W bit */ 33#define _PAGE_WRITETHRU 0x00400 /* H: W bit */
34#define _PAGE_SPECIAL 0x00800 /* S: Special page */ 34#define _PAGE_SPECIAL 0x00800 /* S: Special page */
35 35
36#ifdef CONFIG_PTE_64BIT
37/* ERPN in a PTE never gets cleared, ignore it */
38#define _PTE_NONE_MASK 0xffffffffffff0000ULL
39/* We extend the size of the PTE flags area when using 64-bit PTEs */
40#define PTE_RPN_SHIFT (PAGE_SHIFT + 8)
41#endif
42
43#define _PMD_PRESENT 0 36#define _PMD_PRESENT 0
44#define _PMD_PRESENT_MASK (PAGE_MASK) 37#define _PMD_PRESENT_MASK (PAGE_MASK)
45#define _PMD_BAD (~PAGE_MASK) 38#define _PMD_BAD (~PAGE_MASK)
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 2c5af5256479..975788ca05d2 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -575,7 +575,12 @@ interrupt_base:
575 * place or can we save a couple of instructions here ? 575 * place or can we save a couple of instructions here ?
576 */ 576 */
577 mfspr r12,SPRN_ESR 577 mfspr r12,SPRN_ESR
578#ifdef CONFIG_PTE_64BIT
579 li r13,_PAGE_PRESENT
580 oris r13,r13,_PAGE_ACCESSED@h
581#else
578 li r13,_PAGE_PRESENT|_PAGE_ACCESSED 582 li r13,_PAGE_PRESENT|_PAGE_ACCESSED
583#endif
579 rlwimi r13,r12,11,29,29 584 rlwimi r13,r12,11,29,29
580 585
581 FIND_PTE 586 FIND_PTE
@@ -643,7 +648,12 @@ interrupt_base:
643 648
6444: 6494:
645 /* Make up the required permissions */ 650 /* Make up the required permissions */
651#ifdef CONFIG_PTE_64BIT
652 li r13,_PAGE_PRESENT | _PAGE_EXEC
653 oris r13,r13,_PAGE_ACCESSED@h
654#else
646 li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC 655 li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
656#endif
647 657
648 FIND_PTE 658 FIND_PTE
649 andc. r13,r13,r11 /* Check permission */ 659 andc. r13,r13,r11 /* Check permission */
@@ -733,7 +743,7 @@ finish_tlb_load:
733 743
734 mfspr r12, SPRN_MAS2 744 mfspr r12, SPRN_MAS2
735#ifdef CONFIG_PTE_64BIT 745#ifdef CONFIG_PTE_64BIT
736 rlwimi r12, r11, 26, 24, 31 /* extract ...WIMGE from pte */ 746 rlwimi r12, r11, 32-19, 27, 31 /* extract WIMGE from pte */
737#else 747#else
738 rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */ 748 rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */
739#endif 749#endif
@@ -742,6 +752,20 @@ finish_tlb_load:
742#endif 752#endif
743 mtspr SPRN_MAS2, r12 753 mtspr SPRN_MAS2, r12
744 754
755#ifdef CONFIG_PTE_64BIT
756 rlwinm r12, r11, 32-2, 26, 31 /* Move in perm bits */
757 andi. r10, r11, _PAGE_DIRTY
758 bne 1f
759 li r10, MAS3_SW | MAS3_UW
760 andc r12, r12, r10
7611: rlwimi r12, r13, 20, 0, 11 /* grab RPN[32:43] */
762 rlwimi r12, r11, 20, 12, 19 /* grab RPN[44:51] */
763 mtspr SPRN_MAS3, r12
764BEGIN_MMU_FTR_SECTION
765 srwi r10, r13, 12 /* grab RPN[12:31] */
766 mtspr SPRN_MAS7, r10
767END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
768#else
745 li r10, (_PAGE_EXEC | _PAGE_PRESENT) 769 li r10, (_PAGE_EXEC | _PAGE_PRESENT)
746 rlwimi r10, r11, 31, 29, 29 /* extract _PAGE_DIRTY into SW */ 770 rlwimi r10, r11, 31, 29, 29 /* extract _PAGE_DIRTY into SW */
747 and r12, r11, r10 771 and r12, r11, r10
@@ -749,16 +773,6 @@ finish_tlb_load:
749 slwi r10, r12, 1 773 slwi r10, r12, 1
750 or r10, r10, r12 774 or r10, r10, r12
751 iseleq r12, r12, r10 775 iseleq r12, r12, r10
752
753#ifdef CONFIG_PTE_64BIT
754 rlwimi r12, r13, 24, 0, 7 /* grab RPN[32:39] */
755 rlwimi r12, r11, 24, 8, 19 /* grab RPN[40:51] */
756 mtspr SPRN_MAS3, r12
757BEGIN_MMU_FTR_SECTION
758 srwi r10, r13, 8 /* grab RPN[8:31] */
759 mtspr SPRN_MAS7, r10
760END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS)
761#else
762 rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */ 776 rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */
763 mtspr SPRN_MAS3, r11 777 mtspr SPRN_MAS3, r11
764#endif 778#endif