diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2013-04-28 05:37:39 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-04-30 02:00:29 -0400 |
commit | 1f6aaaccb1b3af8613fe45781c1aefee2ae8c6b3 (patch) | |
tree | ad89dd4948e2a8b5df9466387583fa456d2261ca /arch/powerpc/mm | |
parent | 3dc4feca4bf39d12f35a0e8c6997a8e188ab6cb8 (diff) |
powerpc: Update tlbie/tlbiel as per ISA doc
Encode the actual page correctly in tlbie/tlbiel. This make sure we handle
multiple page size segment correctly.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/hash_native_64.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c index bb920ee15627..6a2aead5b0e5 100644 --- a/arch/powerpc/mm/hash_native_64.c +++ b/arch/powerpc/mm/hash_native_64.c | |||
@@ -61,7 +61,10 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize) | |||
61 | 61 | ||
62 | switch (psize) { | 62 | switch (psize) { |
63 | case MMU_PAGE_4K: | 63 | case MMU_PAGE_4K: |
64 | /* clear out bits after (52) [0....52.....63] */ | ||
65 | va &= ~((1ul << (64 - 52)) - 1); | ||
64 | va |= ssize << 8; | 66 | va |= ssize << 8; |
67 | va |= mmu_psize_defs[apsize].sllp << 6; | ||
65 | asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2) | 68 | asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2) |
66 | : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) | 69 | : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) |
67 | : "memory"); | 70 | : "memory"); |
@@ -69,9 +72,20 @@ static inline void __tlbie(unsigned long vpn, int psize, int apsize, int ssize) | |||
69 | default: | 72 | default: |
70 | /* We need 14 to 14 + i bits of va */ | 73 | /* We need 14 to 14 + i bits of va */ |
71 | penc = mmu_psize_defs[psize].penc[apsize]; | 74 | penc = mmu_psize_defs[psize].penc[apsize]; |
72 | va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); | 75 | va &= ~((1ul << mmu_psize_defs[apsize].shift) - 1); |
73 | va |= penc << 12; | 76 | va |= penc << 12; |
74 | va |= ssize << 8; | 77 | va |= ssize << 8; |
78 | /* Add AVAL part */ | ||
79 | if (psize != apsize) { | ||
80 | /* | ||
81 | * MPSS, 64K base page size and 16MB parge page size | ||
82 | * We don't need all the bits, but rest of the bits | ||
83 | * must be ignored by the processor. | ||
84 | * vpn cover upto 65 bits of va. (0...65) and we need | ||
85 | * 58..64 bits of va. | ||
86 | */ | ||
87 | va |= (vpn & 0xfe); | ||
88 | } | ||
75 | va |= 1; /* L */ | 89 | va |= 1; /* L */ |
76 | asm volatile(ASM_FTR_IFCLR("tlbie %0,1", PPC_TLBIE(%1,%0), %2) | 90 | asm volatile(ASM_FTR_IFCLR("tlbie %0,1", PPC_TLBIE(%1,%0), %2) |
77 | : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) | 91 | : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) |
@@ -96,16 +110,30 @@ static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize) | |||
96 | 110 | ||
97 | switch (psize) { | 111 | switch (psize) { |
98 | case MMU_PAGE_4K: | 112 | case MMU_PAGE_4K: |
113 | /* clear out bits after(52) [0....52.....63] */ | ||
114 | va &= ~((1ul << (64 - 52)) - 1); | ||
99 | va |= ssize << 8; | 115 | va |= ssize << 8; |
116 | va |= mmu_psize_defs[apsize].sllp << 6; | ||
100 | asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)" | 117 | asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)" |
101 | : : "r"(va) : "memory"); | 118 | : : "r"(va) : "memory"); |
102 | break; | 119 | break; |
103 | default: | 120 | default: |
104 | /* We need 14 to 14 + i bits of va */ | 121 | /* We need 14 to 14 + i bits of va */ |
105 | penc = mmu_psize_defs[psize].penc[apsize]; | 122 | penc = mmu_psize_defs[psize].penc[apsize]; |
106 | va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); | 123 | va &= ~((1ul << mmu_psize_defs[apsize].shift) - 1); |
107 | va |= penc << 12; | 124 | va |= penc << 12; |
108 | va |= ssize << 8; | 125 | va |= ssize << 8; |
126 | /* Add AVAL part */ | ||
127 | if (psize != apsize) { | ||
128 | /* | ||
129 | * MPSS, 64K base page size and 16MB parge page size | ||
130 | * We don't need all the bits, but rest of the bits | ||
131 | * must be ignored by the processor. | ||
132 | * vpn cover upto 65 bits of va. (0...65) and we need | ||
133 | * 58..64 bits of va. | ||
134 | */ | ||
135 | va |= (vpn & 0xfe); | ||
136 | } | ||
109 | va |= 1; /* L */ | 137 | va |= 1; /* L */ |
110 | asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)" | 138 | asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)" |
111 | : : "r"(va) : "memory"); | 139 | : : "r"(va) : "memory"); |