aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2016-04-29 09:25:36 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-05-01 04:32:30 -0400
commite58e87adc8bf92e9c6abb1dc1f4af2500aa07ff3 (patch)
treec4af711ba617e4646735f695d2f79e9e975e1f66 /arch/powerpc/mm
parent96270b1fc25d527b015c73533119f6c85df2e0ff (diff)
powerpc/mm: Update _PAGE_KERNEL_RO
PS3 had used a PPP bit hack to implement a read only mapping in the kernel area. Since we are bolting the ioremap area, it used the pte flags _PAGE_PRESENT | _PAGE_USER to get a PPP value of 0x3 there by resulting in a read only mapping. This means the area can be accessed by user space, but kernel will never return such an address to user space. But we can do better by implementing a read only kernel mapping using PPP bits 0b110. This also allows us to do read only kernel mapping for radix in later patches. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/hash_utils_64.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index dc0f6a00ccbd..38ed869c119e 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -167,14 +167,19 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)
167 if ((pteflags & _PAGE_EXEC) == 0) 167 if ((pteflags & _PAGE_EXEC) == 0)
168 rflags |= HPTE_R_N; 168 rflags |= HPTE_R_N;
169 /* 169 /*
170 * PP bits: 170 * PPP bits:
171 * Linux uses slb key 0 for kernel and 1 for user. 171 * Linux uses slb key 0 for kernel and 1 for user.
172 * kernel areas are mapped with PP=00 172 * kernel RW areas are mapped with PPP=0b000
173 * and there is no kernel RO (_PAGE_KERNEL_RO). 173 * User area is mapped with PPP=0b010 for read/write
174 * User area is mapped with PP=0x2 for read/write 174 * or PPP=0b011 for read-only (including writeable but clean pages).
175 * or PP=0x3 for read-only (including writeable but clean pages).
176 */ 175 */
177 if (!(pteflags & _PAGE_PRIVILEGED)) { 176 if (pteflags & _PAGE_PRIVILEGED) {
177 /*
178 * Kernel read only mapped with ppp bits 0b110
179 */
180 if (!(pteflags & _PAGE_WRITE))
181 rflags |= (HPTE_R_PP0 | 0x2);
182 } else {
178 if (pteflags & _PAGE_RWX) 183 if (pteflags & _PAGE_RWX)
179 rflags |= 0x2; 184 rflags |= 0x2;
180 if (!((pteflags & _PAGE_WRITE) && (pteflags & _PAGE_DIRTY))) 185 if (!((pteflags & _PAGE_WRITE) && (pteflags & _PAGE_DIRTY)))