diff options
author | Will Deacon <will.deacon@arm.com> | 2012-07-19 06:51:05 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2012-11-09 09:13:19 -0500 |
commit | dbf62d50067e55a782583fe53c3d2a3d98b1f6f3 (patch) | |
tree | 1bca43e9824e79d97bc32445182fe91a6600e035 /arch/arm/include | |
parent | 0cbbbad63179652272cc5e18a68d69bfc8dd25ce (diff) |
ARM: mm: introduce L_PTE_VALID for page table entries
For long-descriptor translation table formats, the ARMv7 architecture
defines the last two bits of the second- and third-level descriptors to
be:
x0b - Invalid
01b - Block (second-level), Reserved (third-level)
11b - Table (second-level), Page (third-level)
This allows us to define L_PTE_PRESENT as (3 << 0) and use this value to
create ptes directly. However, when determining whether a given pte
value is present in the low-level page table accessors, we only need to
check the least significant bit of the descriptor, allowing us to write
faulting, present entries which are required for PROT_NONE mappings.
This patch introduces L_PTE_VALID, which can be used to test whether a
pte should fault, and updates the low-level page table accessors
accordingly.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/pgtable-2level.h | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/pgtable-3level.h | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h index 2317a71c8f8e..c44a1ecfc28a 100644 --- a/arch/arm/include/asm/pgtable-2level.h +++ b/arch/arm/include/asm/pgtable-2level.h | |||
@@ -115,6 +115,7 @@ | |||
115 | * The PTE table pointer refers to the hardware entries; the "Linux" | 115 | * The PTE table pointer refers to the hardware entries; the "Linux" |
116 | * entries are stored 1024 bytes below. | 116 | * entries are stored 1024 bytes below. |
117 | */ | 117 | */ |
118 | #define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */ | ||
118 | #define L_PTE_PRESENT (_AT(pteval_t, 1) << 0) | 119 | #define L_PTE_PRESENT (_AT(pteval_t, 1) << 0) |
119 | #define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) | 120 | #define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) |
120 | #define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ | 121 | #define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ |
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h index b24903549d1c..e32311a9abca 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h | |||
@@ -67,7 +67,8 @@ | |||
67 | * These bits overlap with the hardware bits but the naming is preserved for | 67 | * These bits overlap with the hardware bits but the naming is preserved for |
68 | * consistency with the classic page table format. | 68 | * consistency with the classic page table format. |
69 | */ | 69 | */ |
70 | #define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Valid */ | 70 | #define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */ |
71 | #define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Present */ | ||
71 | #define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ | 72 | #define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ |
72 | #define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ | 73 | #define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ |
73 | #define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */ | 74 | #define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */ |
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 08c12312a1f9..ccf34b6e9903 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -203,9 +203,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd) | |||
203 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) | 203 | #define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) |
204 | #define pte_special(pte) (0) | 204 | #define pte_special(pte) (0) |
205 | 205 | ||
206 | #define pte_present_user(pte) \ | 206 | #define pte_present_user(pte) (pte_present(pte) && (pte_val(pte) & L_PTE_USER)) |
207 | ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \ | ||
208 | (L_PTE_PRESENT | L_PTE_USER)) | ||
209 | 207 | ||
210 | #if __LINUX_ARM_ARCH__ < 6 | 208 | #if __LINUX_ARM_ARCH__ < 6 |
211 | static inline void __sync_icache_dcache(pte_t pteval) | 209 | static inline void __sync_icache_dcache(pte_t pteval) |