Skip to content

Commit 3517503

Browse files
chleroympe
authored andcommitted
powerpc/mm: Introduce _PAGE_NA
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 <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 812fadc commit 3517503

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

arch/powerpc/include/asm/book3s/64/pgtable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515
#define _PAGE_BIT_SWAP_TYPE 0
1616

17+
#define _PAGE_NA 0
1718
#define _PAGE_RO 0
1819
#define _PAGE_USER 0
1920

arch/powerpc/include/asm/nohash/32/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static inline void __ptep_set_access_flags(struct mm_struct *mm,
282282
{
283283
unsigned long set = pte_val(entry) &
284284
(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC);
285-
unsigned long clr = ~pte_val(entry) & _PAGE_RO;
285+
unsigned long clr = ~pte_val(entry) & (_PAGE_RO | _PAGE_NA);
286286

287287
pte_update(ptep, clr, set);
288288
}

arch/powerpc/include/asm/pte-common.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
#define _PAGE_USER 0
5151
#endif
5252
#endif
53+
#ifndef _PAGE_NA
54+
#define _PAGE_NA 0
55+
#endif
5356

5457
#ifndef _PMD_PRESENT_MASK
5558
#define _PMD_PRESENT_MASK _PMD_PRESENT
@@ -122,7 +125,7 @@ static inline bool pte_user(pte_t pte)
122125
/* Mask of bits returned by pte_pgprot() */
123126
#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \
124127
_PAGE_WRITETHRU | _PAGE_ENDIAN | _PAGE_4K_PFN | \
125-
_PAGE_USER | _PAGE_ACCESSED | _PAGE_RO | \
128+
_PAGE_USER | _PAGE_ACCESSED | _PAGE_RO | _PAGE_NA | \
126129
_PAGE_PRIVILEGED | \
127130
_PAGE_RW | _PAGE_HWWRITE | _PAGE_DIRTY | _PAGE_EXEC)
128131

@@ -150,7 +153,7 @@ static inline bool pte_user(pte_t pte)
150153
*
151154
* Note due to the way vm flags are laid out, the bits are XWR
152155
*/
153-
#define PAGE_NONE __pgprot(_PAGE_BASE)
156+
#define PAGE_NONE __pgprot(_PAGE_BASE | _PAGE_NA)
154157
#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW)
155158
#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW | \
156159
_PAGE_EXEC)

arch/powerpc/mm/dump_linuxpagetables.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,20 @@ static const struct flag_info flag_array[] = {
117117
.set = "user",
118118
.clear = " ",
119119
}, {
120-
#if _PAGE_RO == 0
121-
.mask = _PAGE_RW,
120+
.mask = _PAGE_RW | _PAGE_RO | _PAGE_NA,
122121
.val = _PAGE_RW,
123-
#else
124-
.mask = _PAGE_RO,
125-
.val = 0,
126-
#endif
127122
.set = "rw",
128-
.clear = "ro",
129123
}, {
124+
.mask = _PAGE_RW | _PAGE_RO | _PAGE_NA,
125+
.val = _PAGE_RO,
126+
.set = "ro",
127+
}, {
128+
#if _PAGE_NA != 0
129+
.mask = _PAGE_RW | _PAGE_RO | _PAGE_NA,
130+
.val = _PAGE_RO,
131+
.set = "na",
132+
}, {
133+
#endif
130134
.mask = _PAGE_EXEC,
131135
.val = _PAGE_EXEC,
132136
.set = " X ",

0 commit comments

Comments
 (0)