powerpc/64s: Use generic permission masks
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 25 Sep 2023 18:31:41 +0000 (20:31 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 19 Oct 2023 06:12:46 +0000 (17:12 +1100)
book3s64 need specific masks because it needs _PAGE_PRIVILEGED
for PAGE_NONE.

book3s64 already has _PAGE_RW and _PAGE_RWX.
So add _PAGE_NA, _PAGE_RO and _PAGE_ROX and remove specific
permission masks.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/d37a418de52e2c950cad6797e81663b56991366f.1695659959.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/book3s/64/pgtable.h

index c3b9217..0fd12bd 100644 (file)
@@ -17,6 +17,9 @@
 #define _PAGE_EXEC             0x00001 /* execute permission */
 #define _PAGE_WRITE            0x00002 /* write access allowed */
 #define _PAGE_READ             0x00004 /* read access allowed */
+#define _PAGE_NA               _PAGE_PRIVILEGED
+#define _PAGE_RO               _PAGE_READ
+#define _PAGE_ROX              (_PAGE_READ | _PAGE_EXEC)
 #define _PAGE_RW               (_PAGE_READ | _PAGE_WRITE)
 #define _PAGE_RWX              (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)
 #define _PAGE_PRIVILEGED       0x00008 /* kernel access only */
 #define _PAGE_BASE_NC  (_PAGE_PRESENT | _PAGE_ACCESSED)
 #define _PAGE_BASE     (_PAGE_BASE_NC)
 
-/* Permission masks used to generate the __P and __S table,
- *
- * Note:__pgprot is defined in arch/powerpc/include/asm/page.h
- *
- * Write permissions imply read permissions for now (we could make write-only
- * pages on BookE but we don't bother for now). Execute permission control is
- * possible on platforms that define _PAGE_EXEC
- */
-#define PAGE_NONE      __pgprot(_PAGE_BASE | _PAGE_PRIVILEGED)
-#define PAGE_SHARED    __pgprot(_PAGE_BASE | _PAGE_RW)
-#define PAGE_SHARED_X  __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_EXEC)
-#define PAGE_COPY      __pgprot(_PAGE_BASE | _PAGE_READ)
-#define PAGE_COPY_X    __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_EXEC)
-#define PAGE_READONLY  __pgprot(_PAGE_BASE | _PAGE_READ)
-#define PAGE_READONLY_X        __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_EXEC)
+#include <asm/pgtable-masks.h>
+
 /* Radix only, Hash uses PAGE_READONLY_X + execute-only pkey instead */
 #define PAGE_EXECONLY  __pgprot(_PAGE_BASE | _PAGE_EXEC)