summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2020-08-19 11:57:24 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2020-09-08 22:24:05 +1000
commit3a31518a242dcb262b008d3bb5d4b1cf50cf4026 (patch)
treed3ae6255ae2d8eb7efa97c0cfb8780f75281889d
parent4c3c3c502575556c4bc1b401235e641863b1bce6 (diff)
downloadlinux-3a31518a242dcb262b008d3bb5d4b1cf50cf4026.tar.gz
linux-3a31518a242dcb262b008d3bb5d4b1cf50cf4026.tar.bz2
linux-3a31518a242dcb262b008d3bb5d4b1cf50cf4026.zip
selftests/powerpc: Skip security tests on older CPUs
Both these tests use PMU events that only work on newer CPUs, so skip them on older CPUs. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200819015727.1977134-6-mpe@ellerman.id.au
-rw-r--r--tools/testing/selftests/powerpc/security/rfi_flush.c3
-rw-r--r--tools/testing/selftests/powerpc/security/spectre_v2.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/security/rfi_flush.c b/tools/testing/selftests/powerpc/security/rfi_flush.c
index fd37ff9b1c45..93a65bd1f231 100644
--- a/tools/testing/selftests/powerpc/security/rfi_flush.c
+++ b/tools/testing/selftests/powerpc/security/rfi_flush.c
@@ -89,6 +89,9 @@ int rfi_flush_test(void)
SKIP_IF(geteuid() != 0);
+ // The PMU event we use only works on Power7 or later
+ SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06));
+
if (read_debugfs_file("powerpc/rfi_flush", &rfi_flush_org)) {
perror("Unable to read powerpc/rfi_flush debugfs file");
SKIP_IF(1);
diff --git a/tools/testing/selftests/powerpc/security/spectre_v2.c b/tools/testing/selftests/powerpc/security/spectre_v2.c
index c8d82b784102..adc2b7294e5f 100644
--- a/tools/testing/selftests/powerpc/security/spectre_v2.c
+++ b/tools/testing/selftests/powerpc/security/spectre_v2.c
@@ -134,6 +134,9 @@ int spectre_v2_test(void)
s64 miss_percent;
bool is_p9;
+ // The PMU events we use only work on Power8 or later
+ SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_2_07));
+
state = get_sysfs_state();
if (state == UNKNOWN) {
printf("Error: couldn't determine spectre_v2 mitigation state?\n");