]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/mm: Introduce _PAGE_NA
authorChristophe Leroy <christophe.leroy@c-s.fr>
Fri, 12 Jan 2018 12:45:29 +0000 (13:45 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 16 Jan 2018 12:47:14 +0000 (23:47 +1100)
Today, PAGE_NONE is defined as a page not having _PAGE_USER.
In some circunstances, when the CPU supports it, it might be
better to be able to flag a page with NO ACCESS.

In a following patch, the 8xx will switch user access being flagged
in the PMD, therefore it will not be possible anymore to use
_PAGE_USER as a way to flag a page with no access.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/book3s/64/pgtable.h
arch/powerpc/include/asm/nohash/32/pgtable.h
arch/powerpc/include/asm/pte-common.h
arch/powerpc/mm/dump_linuxpagetables.c

index 8e28febedac36da6c96436a794014fec16b913fc..60a0d7fd82bc5328f6e8bf4db5f6e96982d91c59 100644 (file)
@@ -14,6 +14,7 @@
  */
 #define _PAGE_BIT_SWAP_TYPE    0
 
+#define _PAGE_NA               0
 #define _PAGE_RO               0
 #define _PAGE_USER             0
 
index cc2bfec3aa3b9b540e92c1f5008229b7351e6195..504a3c36ce5c9b311a9c8864d112792ae60fab9f 100644 (file)
@@ -282,7 +282,7 @@ static inline void __ptep_set_access_flags(struct mm_struct *mm,
 {
        unsigned long set = pte_val(entry) &
                (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
-       unsigned long clr = ~pte_val(entry) & _PAGE_RO;
+       unsigned long clr = ~pte_val(entry) & (_PAGE_RO | _PAGE_NA);
 
        pte_update(ptep, clr, set);
 }
index 0e6595a1b9d89ceb46a4be555ad695d915408d3d..426a902816c5575f05a2bdb3c17d010755d87769 100644 (file)
@@ -50,6 +50,9 @@
 #define _PAGE_USER 0
 #endif
 #endif
+#ifndef _PAGE_NA
+#define _PAGE_NA 0
+#endif
 
 #ifndef _PMD_PRESENT_MASK
 #define _PMD_PRESENT_MASK      _PMD_PRESENT
@@ -122,7 +125,7 @@ static inline bool pte_user(pte_t pte)
 /* Mask of bits returned by pte_pgprot() */
 #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \
                         _PAGE_WRITETHRU | _PAGE_ENDIAN | _PAGE_4K_PFN | \
-                        _PAGE_USER | _PAGE_ACCESSED | _PAGE_RO | \
+                        _PAGE_USER | _PAGE_ACCESSED | _PAGE_RO | _PAGE_NA | \
                         _PAGE_PRIVILEGED | \
                         _PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC)
 
@@ -150,7 +153,7 @@ static inline bool pte_user(pte_t pte)
  *
  * Note due to the way vm flags are laid out, the bits are XWR
  */
-#define PAGE_NONE      __pgprot(_PAGE_BASE)
+#define PAGE_NONE      __pgprot(_PAGE_BASE | _PAGE_NA)
 #define PAGE_SHARED    __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW)
 #define PAGE_SHARED_X  __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW | \
                                 _PAGE_EXEC)
index d87ab2cabaa6068ed7cce1fa6025f63e867c66e5..876e2a3c79f201eb1a86187814efdf35d911e00b 100644 (file)
@@ -117,16 +117,20 @@ static const struct flag_info flag_array[] = {
                .set    = "user",
                .clear  = "    ",
        }, {
-#if _PAGE_RO == 0
-               .mask   = _PAGE_RW,
+               .mask   = _PAGE_RW | _PAGE_RO | _PAGE_NA,
                .val    = _PAGE_RW,
-#else
-               .mask   = _PAGE_RO,
-               .val    = 0,
-#endif
                .set    = "rw",
-               .clear  = "ro",
        }, {
+               .mask   = _PAGE_RW | _PAGE_RO | _PAGE_NA,
+               .val    = _PAGE_RO,
+               .set    = "ro",
+       }, {
+#if _PAGE_NA != 0
+               .mask   = _PAGE_RW | _PAGE_RO | _PAGE_NA,
+               .val    = _PAGE_RO,
+               .set    = "na",
+       }, {
+#endif
                .mask   = _PAGE_EXEC,
                .val    = _PAGE_EXEC,
                .set    = " X ",