[PATCH 0/2] selftests: vm: pkeys: Some powerpc fixes

STALE2285d

3 messages, 1 author, 2020-05-08 · open the first message on its own page

[PATCH 0/2] selftests: vm: pkeys: Some powerpc fixes

From: Sandipan Das <hidden>
Date: 2020-05-08 17:49:28

Some fixes for the powerpc bits w.r.t to the way the pkey
access rights are defined and how the permission register
is updated.

Sandipan Das (2):
  selftests: vm: pkeys: Fix powerpc access right definitions
  selftests: vm: pkeys: Fix powerpc access right updates

 tools/testing/selftests/vm/pkey-powerpc.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

-- 
2.17.1

[PATCH 1/2] selftests: vm: pkeys: Fix powerpc access right definitions

From: Sandipan Das <hidden>
Date: 2020-05-08 17:49:29

For powerpc, PKEY_DISABLE_WRITE and PKEY_DISABLE_ACCESS are
redefined only if the system headers already define them.
Otherwise, the test fails to compile due to their absence.
This makes sure that they are always defined irrespective of
them being present in the system headers.

Fixes: 130f573c2a79 ("selftests/vm/pkeys: introduce powerpc support")
Reported-by: Aneesh Kumar K.V <redacted>
Signed-off-by: Sandipan Das <redacted>
---
 tools/testing/selftests/vm/pkey-powerpc.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/vm/pkey-powerpc.h b/tools/testing/selftests/vm/pkey-powerpc.h
index 3a761e51a587..eb5077de8f1e 100644
--- a/tools/testing/selftests/vm/pkey-powerpc.h
+++ b/tools/testing/selftests/vm/pkey-powerpc.h
@@ -16,15 +16,11 @@
 #define fpregs			fp_regs
 #define si_pkey_offset		0x20
 
-#ifdef PKEY_DISABLE_ACCESS
 #undef PKEY_DISABLE_ACCESS
-# define PKEY_DISABLE_ACCESS	0x3  /* disable read and write */
-#endif
+#define PKEY_DISABLE_ACCESS	0x3  /* disable read and write */
 
-#ifdef PKEY_DISABLE_WRITE
 #undef PKEY_DISABLE_WRITE
-# define PKEY_DISABLE_WRITE	0x2
-#endif
+#define PKEY_DISABLE_WRITE	0x2
 
 #define NR_PKEYS		32
 #define NR_RESERVED_PKEYS_4K	27 /* pkey-0, pkey-1, exec-only-pkey
-- 
2.17.1

[PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates

From: Sandipan Das <hidden>
Date: 2020-05-08 17:49:31

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
applies to both the privileged and unprivileged variants
of the Move To AMR instruction.

Fixes: 130f573c2a79 ("selftests/vm/pkeys: introduce powerpc support")
Reported-by: Aneesh Kumar K.V <redacted>
Suggested-by: Aneesh Kumar K.V <redacted>
Signed-off-by: Sandipan Das <redacted>
---
 tools/testing/selftests/vm/pkey-powerpc.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vm/pkey-powerpc.h b/tools/testing/selftests/vm/pkey-powerpc.h
index eb5077de8f1e..1ebb586b2fbc 100644
--- a/tools/testing/selftests/vm/pkey-powerpc.h
+++ b/tools/testing/selftests/vm/pkey-powerpc.h
@@ -55,7 +55,8 @@ static inline void __write_pkey_reg(u64 pkey_reg)
 	dprintf4("%s() changing %016llx to %016llx\n",
 			 __func__, __read_pkey_reg(), pkey_reg);
 
-	asm volatile("mtspr 0xd, %0" : : "r" ((unsigned long)(amr)) : "memory");
+	asm volatile("isync; mtspr 0xd, %0; isync"
+		     : : "r" ((unsigned long)(amr)) : "memory");
 
 	dprintf4("%s() pkey register after changing %016llx to %016llx\n",
 			__func__, __read_pkey_reg(), pkey_reg);
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help