selftests/powerpc/dexcr: Attempt to enable NPHIE in hashchk selftest
authorBenjamin Gray <bgray@linux.ibm.com>
Wed, 17 Apr 2024 11:23:22 +0000 (21:23 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 6 May 2024 12:05:17 +0000 (22:05 +1000)
Now that a process can control its DEXCR to some extent, make the
hashchk tests more reliable by explicitly setting the local and onexec
NPHIE aspect.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240417112325.728010-7-bgray@linux.ibm.com
tools/testing/selftests/powerpc/dexcr/hashchk_test.c

index 7d5658c9ebe4f479734815f7e60e210354651a12..645224bdc142d7629d0579315f56618f34f1efad 100644 (file)
 static int require_nphie(void)
 {
        SKIP_IF_MSG(!dexcr_exists(), "DEXCR not supported");
+
+       pr_set_dexcr(PR_PPC_DEXCR_NPHIE, PR_PPC_DEXCR_CTRL_SET | PR_PPC_DEXCR_CTRL_SET_ONEXEC);
+
+       if (get_dexcr(EFFECTIVE) & DEXCR_PR_NPHIE)
+               return 0;
+
        SKIP_IF_MSG(!(get_dexcr(EFFECTIVE) & DEXCR_PR_NPHIE),
-                   "DEXCR[NPHIE] not enabled");
+                   "Failed to enable DEXCR[NPHIE]");
 
        return 0;
 }