aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/pkeys.c
diff options
context:
space:
mode:
authorRam Pai <linuxram@us.ibm.com>2018-01-18 17:50:26 -0800
committerMichael Ellerman <mpe@ellerman.id.au>2018-01-20 22:58:58 +1100
commit1b4037deadb64e3a26c02f0e9852c257ee92a6e3 (patch)
tree9a5ed445bca466f499750ffe6976a4a97fd89456 /arch/powerpc/mm/pkeys.c
parentpowerpc: track allocation status of all pkeys (diff)
downloadlinux-dev-1b4037deadb64e3a26c02f0e9852c257ee92a6e3.tar.xz
linux-dev-1b4037deadb64e3a26c02f0e9852c257ee92a6e3.zip
powerpc: helper function to read, write AMR, IAMR, UAMOR registers
Implements helper functions to read and write the key related registers; AMR, IAMR, UAMOR. AMR register tracks the read,write permission of a key IAMR register tracks the execute permission of a key UAMOR register enables and disables a key Acked-by: Balbir Singh <bsingharora@gmail.com> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> Signed-off-by: Ram Pai <linuxram@us.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm/pkeys.c')
-rw-r--r--arch/powerpc/mm/pkeys.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
index e68e367dcdd7..afa6d0d63f32 100644
--- a/arch/powerpc/mm/pkeys.c
+++ b/arch/powerpc/mm/pkeys.c
@@ -67,3 +67,39 @@ void pkey_mm_init(struct mm_struct *mm)
return;
mm_pkey_allocation_map(mm) = initial_allocation_mask;
}
+
+static inline u64 read_amr(void)
+{
+ return mfspr(SPRN_AMR);
+}
+
+static inline void write_amr(u64 value)
+{
+ mtspr(SPRN_AMR, value);
+}
+
+static inline u64 read_iamr(void)
+{
+ if (!likely(pkey_execute_disable_supported))
+ return 0x0UL;
+
+ return mfspr(SPRN_IAMR);
+}
+
+static inline void write_iamr(u64 value)
+{
+ if (!likely(pkey_execute_disable_supported))
+ return;
+
+ mtspr(SPRN_IAMR, value);
+}
+
+static inline u64 read_uamor(void)
+{
+ return mfspr(SPRN_UAMOR);
+}
+
+static inline void write_uamor(u64 value)
+{
+ mtspr(SPRN_UAMOR, value);
+}