summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/pkeys.h
diff options
context:
space:
mode:
authorRam Pai <linuxram@us.ibm.com>2018-01-18 17:50:33 -0800
committerMichael Ellerman <mpe@ellerman.id.au>2018-01-20 22:59:01 +1100
commit013a91b39c2d5158cdc5529803f245bbb0526c7c (patch)
treedd2f86dc2e39316ea4f1bb2e689ec41fbf695480 /arch/powerpc/include/asm/pkeys.h
parent5586cf61e108019565bb936daeb296e53df1c1d6 (diff)
downloadtalos-op-linux-013a91b39c2d5158cdc5529803f245bbb0526c7c.tar.gz
talos-op-linux-013a91b39c2d5158cdc5529803f245bbb0526c7c.zip
powerpc: ability to associate pkey to a vma
arch-independent code expects the arch to map a pkey into the vma's protection bit setting. The patch provides that ability. Signed-off-by: Ram Pai <linuxram@us.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/pkeys.h')
-rw-r--r--arch/powerpc/include/asm/pkeys.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h
index b8d2a8e3f2e1..df372557ec33 100644
--- a/arch/powerpc/include/asm/pkeys.h
+++ b/arch/powerpc/include/asm/pkeys.h
@@ -30,6 +30,17 @@ extern u32 initial_allocation_mask; /* bits set for reserved keys */
#define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \
VM_PKEY_BIT3 | VM_PKEY_BIT4)
+/* Override any generic PKEY permission defines */
+#define PKEY_DISABLE_EXECUTE 0x4
+#define PKEY_ACCESS_MASK (PKEY_DISABLE_ACCESS | \
+ PKEY_DISABLE_WRITE | \
+ PKEY_DISABLE_EXECUTE)
+
+static inline u64 pkey_to_vmflag_bits(u16 pkey)
+{
+ return (((u64)pkey << VM_PKEY_SHIFT) & ARCH_VM_PKEY_FLAGS);
+}
+
#define arch_max_pkey() pkeys_total
#define pkey_alloc_mask(pkey) (0x1 << pkey)
OpenPOWER on IntegriCloud