Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/powerpc: Skip PROT_SAO test in guests/LPARS

In commit 9b725a90a8f1 ("powerpc/64s: Disallow PROT_SAO in LPARs by
default") PROT_SAO was disabled in guests/LPARs by default. So skip
the test if we are running in a guest to avoid a spurious failure.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200901124653.523182-1-mpe@ellerman.id.au

+7 -2
+7 -2
tools/testing/selftests/powerpc/mm/prot_sao.c
··· 7 7 #include <stdlib.h> 8 8 #include <string.h> 9 9 #include <sys/mman.h> 10 + #include <unistd.h> 10 11 11 12 #include <asm/cputable.h> 12 13 ··· 19 18 { 20 19 char *p; 21 20 22 - /* SAO was introduced in 2.06 and removed in 3.1 */ 21 + /* 22 + * SAO was introduced in 2.06 and removed in 3.1. It's disabled in 23 + * guests/LPARs by default, so also skip if we are running in a guest. 24 + */ 23 25 SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) || 24 - have_hwcap2(PPC_FEATURE2_ARCH_3_1)); 26 + have_hwcap2(PPC_FEATURE2_ARCH_3_1) || 27 + access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0); 25 28 26 29 /* 27 30 * Ensure we can ask for PROT_SAO.