selftests: vm: pkeys: Some powerpc fixes
Subsystems (2)
cover selftests: vm: pkeys: Some powerpc fixes
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(-)
Signature · 1 line
2.17.1
PATCH 1/2 selftests: vm: pkeys: Fix powerpc access right definitions
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.
--- tools/testing/selftests/vm/pkey-powerpc.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
tools/testing/selftests/vm/pkey-powerpc.h +2 -6
@@ -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
Signature · 1 line
2.17.1
PATCH 2/2 selftests: vm: pkeys: Fix powerpc access right updates
In reply to Sandipan DasThe 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.
--- tools/testing/selftests/vm/pkey-powerpc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/vm/pkey-powerpc.h +2 -1
@@ -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); - asmvolatile ("mtspr 0xd, %0" : :"r" ((unsigned long )(amr)) :"memory" ); + asmvolatile ("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);
Signature · 1 line
2.17.1
Re: [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates
* Sandipan Das:
Quoted 5 lines
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.
Ugh. Do you have a reference for that?
We need to fix this in glibc.
Thanks,
Florian
Re: [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates
Hi Florian,
Quoted 8 lines · Florian Weimer
* Sandipan Das:
Quoted 5 lines
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.
Quoted 4 lines
Ugh. Do you have a reference for that?
We need to fix this in glibc.
This is from Table 6 of Chapter 11 in page 1134 of Power ISA 3.0B. The document can be found here:
https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv
- Sandipan
Re: [PATCH 2/2] selftests: vm: pkeys: Fix powerpc access right updates
* Sandipan Das:
Quoted 11 lines
Hi Florian,
Quoted 8 lines · Florian Weimer
* Sandipan Das:
Quoted 5 lines
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.
Quoted 8 lines
Quoted 4 lines
Ugh. Do you have a reference for that?
We need to fix this in glibc.
This is from Table 6 of Chapter 11 in page 1134 of Power ISA 3.0B. The document can be found here:
https://ibm.ent.box.com/s/1hzcwkwf8rbju5h9iyf44wm94amnlcrv
Thanks a lot! I filed:
<https://sourceware.org/bugzilla/show_bug.cgi?id=25954>
Florian