]> xenbits.xensource.com Git - people/aperard/linux-arndale.git/commitdiff
ARM: mm: introduce L_PTE_VALID for page table entries
authorWill Deacon <will.deacon@arm.com>
Thu, 19 Jul 2012 10:51:05 +0000 (11:51 +0100)
committerVasanth Ananthan <vasanthananthan@gmail.com>
Tue, 8 Jan 2013 10:34:46 +0000 (16:04 +0530)
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>
Signed-off-by: Steve Capper <steve.capper@arm.com>
arch/arm/include/asm/pgtable-2level.h
arch/arm/include/asm/pgtable-3level.h
arch/arm/include/asm/pgtable.h
arch/arm/mm/proc-v7-2level.S
arch/arm/mm/proc-v7-3level.S

index 2317a71c8f8ec4c2cbc5404d96d1c3953877eda8..c44a1ecfc28aa706e4e9e2ec9808eed4aee5defa 100644 (file)
  * The PTE table pointer refers to the hardware entries; the "Linux"
  * entries are stored 1024 bytes below.
  */
+#define L_PTE_VALID            (_AT(pteval_t, 1) << 0)         /* Valid */
 #define L_PTE_PRESENT          (_AT(pteval_t, 1) << 0)
 #define L_PTE_YOUNG            (_AT(pteval_t, 1) << 1)
 #define L_PTE_FILE             (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
index ae39d111e89797c8344ba84bec5afdc0120670f5..b49d272f34e45d0ef49fd1e3236a355f54432758 100644 (file)
@@ -67,7 +67,8 @@
  * These bits overlap with the hardware bits but the naming is preserved for
  * consistency with the classic page table format.
  */
-#define L_PTE_PRESENT          (_AT(pteval_t, 3) << 0)         /* Valid */
+#define L_PTE_VALID            (_AT(pteval_t, 1) << 0)         /* Valid */
+#define L_PTE_PRESENT          (_AT(pteval_t, 3) << 0)         /* Present */
 #define L_PTE_FILE             (_AT(pteval_t, 1) << 2)         /* only when !PRESENT */
 #define L_PTE_USER             (_AT(pteval_t, 1) << 6)         /* AP[1] */
 #define L_PTE_RDONLY           (_AT(pteval_t, 1) << 7)         /* AP[2] */
index 08c12312a1f9c97ca2cf4e5480197d68c657cdd0..ccf34b6e990383966bf81a59d5411a2b5a2a4fde 100644 (file)
@@ -203,9 +203,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
 #define pte_exec(pte)          (!(pte_val(pte) & L_PTE_XN))
 #define pte_special(pte)       (0)
 
-#define pte_present_user(pte) \
-       ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \
-        (L_PTE_PRESENT | L_PTE_USER))
+#define pte_present_user(pte)  (pte_present(pte) && (pte_val(pte) & L_PTE_USER))
 
 #if __LINUX_ARM_ARCH__ < 6
 static inline void __sync_icache_dcache(pte_t pteval)
index fd045e706390dc0ddafb0560d2be66b1568cd69f..8307eeabc658a5fbfa038fe08974b7bf2ac1355a 100644 (file)
@@ -100,7 +100,7 @@ ENTRY(cpu_v7_set_pte_ext)
        orrne   r3, r3, #PTE_EXT_XN
 
        tst     r1, #L_PTE_YOUNG
-       tstne   r1, #L_PTE_PRESENT
+       tstne   r1, #L_PTE_VALID
        moveq   r3, #0
 
  ARM(  str     r3, [r0, #2048]! )
index 55fb93082c378a8cf358205621114395123de1a7..5dc5e20cabbd59e8d2d19cbc23d49182296fd910 100644 (file)
@@ -74,7 +74,7 @@ ENDPROC(cpu_v7_switch_mm)
  */
 ENTRY(cpu_v7_set_pte_ext)
 #ifdef CONFIG_MMU
-       tst     r2, #L_PTE_PRESENT
+       tst     r2, #L_PTE_VALID
        beq     1f
        tst     r3, #1 << (55 - 32)             @ L_PTE_DIRTY
        orreq   r2, #L_PTE_RDONLY