diff options
| -rw-r--r-- | arch/powerpc/include/asm/mmu.h | 14 | ||||
| -rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 8 |
2 files changed, 16 insertions, 6 deletions
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index e88368354e49..e311c25751a4 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
| @@ -29,6 +29,12 @@ | |||
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | /* | 31 | /* |
| 32 | * Kernel read only support. | ||
| 33 | * We added the ppp value 0b110 in ISA 2.04. | ||
| 34 | */ | ||
| 35 | #define MMU_FTR_KERNEL_RO ASM_CONST(0x00004000) | ||
| 36 | |||
| 37 | /* | ||
| 32 | * We need to clear top 16bits of va (from the remaining 64 bits )in | 38 | * We need to clear top 16bits of va (from the remaining 64 bits )in |
| 33 | * tlbie* instructions | 39 | * tlbie* instructions |
| 34 | */ | 40 | */ |
| @@ -103,10 +109,10 @@ | |||
| 103 | #define MMU_FTRS_POWER4 MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | 109 | #define MMU_FTRS_POWER4 MMU_FTRS_DEFAULT_HPTE_ARCH_V2 |
| 104 | #define MMU_FTRS_PPC970 MMU_FTRS_POWER4 | MMU_FTR_TLBIE_CROP_VA | 110 | #define MMU_FTRS_PPC970 MMU_FTRS_POWER4 | MMU_FTR_TLBIE_CROP_VA |
| 105 | #define MMU_FTRS_POWER5 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 111 | #define MMU_FTRS_POWER5 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE |
| 106 | #define MMU_FTRS_POWER6 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 112 | #define MMU_FTRS_POWER6 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
| 107 | #define MMU_FTRS_POWER7 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 113 | #define MMU_FTRS_POWER7 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
| 108 | #define MMU_FTRS_POWER8 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 114 | #define MMU_FTRS_POWER8 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
| 109 | #define MMU_FTRS_POWER9 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 115 | #define MMU_FTRS_POWER9 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
| 110 | #define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ | 116 | #define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ |
| 111 | MMU_FTR_CI_LARGE_PAGE | 117 | MMU_FTR_CI_LARGE_PAGE |
| 112 | #define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ | 118 | #define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 5503078090cd..78dabf065ba9 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
| @@ -193,8 +193,12 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags) | |||
| 193 | /* | 193 | /* |
| 194 | * Kernel read only mapped with ppp bits 0b110 | 194 | * Kernel read only mapped with ppp bits 0b110 |
| 195 | */ | 195 | */ |
| 196 | if (!(pteflags & _PAGE_WRITE)) | 196 | if (!(pteflags & _PAGE_WRITE)) { |
| 197 | rflags |= (HPTE_R_PP0 | 0x2); | 197 | if (mmu_has_feature(MMU_FTR_KERNEL_RO)) |
| 198 | rflags |= (HPTE_R_PP0 | 0x2); | ||
| 199 | else | ||
| 200 | rflags |= 0x3; | ||
| 201 | } | ||
| 198 | } else { | 202 | } else { |
| 199 | if (pteflags & _PAGE_RWX) | 203 | if (pteflags & _PAGE_RWX) |
| 200 | rflags |= 0x2; | 204 | rflags |= 0x2; |
