summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2020-08-03 04:07:19 +0200
committerMichael Ellerman <mpe@ellerman.id.au>2020-08-03 14:12:41 +0200
commit872d11bca9c29ed19595c993b9f552ffe9b63dcb (patch)
tree101f33625913e951cad50b2ea693162014d6efb0 /tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
parentpowerpc/40x: Fix assembler warning about r0 (diff)
downloadlinux-872d11bca9c29ed19595c993b9f552ffe9b63dcb.tar.xz
linux-872d11bca9c29ed19595c993b9f552ffe9b63dcb.zip
selftests/powerpc: Skip vmx/vsx/tar/etc tests on older CPUs
Some of our tests use VSX or newer VMX instructions, so need to be skipped on older CPUs to avoid SIGILL'ing. Similarly TAR was added in v2.07, and the PMU event used in the stcx fail test only works on Power8 or later. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200803020719.96114-1-mpe@ellerman.id.au
Diffstat (limited to 'tools/testing/selftests/powerpc/pmu/count_stcx_fail.c')
-rw-r--r--tools/testing/selftests/powerpc/pmu/count_stcx_fail.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c b/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
index 7b4ac4537702..2980abca31e0 100644
--- a/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
+++ b/tools/testing/selftests/powerpc/pmu/count_stcx_fail.c
@@ -9,6 +9,7 @@
#include <stdbool.h>
#include <string.h>
#include <sys/prctl.h>
+#include <asm/cputable.h>
#include "event.h"
#include "utils.h"
@@ -104,6 +105,9 @@ static int test_body(void)
struct event events[3];
u64 overhead;
+ // The STCX_FAIL event we use works on Power8 or later
+ SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_2_07));
+
setup_event(&events[0], PERF_COUNT_HW_INSTRUCTIONS, PERF_TYPE_HARDWARE, "instructions");
setup_event(&events[1], PERF_COUNT_HW_CPU_CYCLES, PERF_TYPE_HARDWARE, "cycles");
setup_event(&events[2], PM_STCX_FAIL, PERF_TYPE_RAW, "stcx_fail");