aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/include
diff options
context:
space:
mode:
authorSandipan Das2020-06-04 18:26:08 +0530
committerMichael Ellerman2020-06-30 14:37:47 +1000
commit828ca4320d130bbe1d12866152600c49ff6a9f79 (patch)
tree19669711fd35c984590e4e6cb434cdbf11474ff8 /tools/testing/selftests/powerpc/include
parent105fb38124a490f38e9c1e23bb4c4a0b6ba12fdb (diff)
selftests/powerpc: Fix pkey access right updates
The Power ISA mandates that all writes to the Authority Mask Register (AMR) must always be preceded as well as succeeded by a context synchronizing instruction. This makes sure that the tests follow this requirement when attempting to update a pkey's access rights. Signed-off-by: Sandipan Das <sandipan@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200604125610.649668-2-sandipan@linux.ibm.com
Diffstat (limited to 'tools/testing/selftests/powerpc/include')
-rw-r--r--tools/testing/selftests/powerpc/include/reg.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/include/reg.h b/tools/testing/selftests/powerpc/include/reg.h
index 022c5076b2c5..c0f2742a3a59 100644
--- a/tools/testing/selftests/powerpc/include/reg.h
+++ b/tools/testing/selftests/powerpc/include/reg.h
@@ -57,6 +57,12 @@
#define SPRN_PPR 896 /* Program Priority Register */
#define SPRN_AMR 13 /* Authority Mask Register - problem state */
+#define set_amr(v) asm volatile("isync;" \
+ "mtspr " __stringify(SPRN_AMR) ",%0;" \
+ "isync" : \
+ : "r" ((unsigned long)(v)) \
+ : "memory")
+
/* TEXASR register bits */
#define TEXASR_FC 0xFE00000000000000
#define TEXASR_FP 0x0100000000000000