selftests/powerpc: Skip security tests on older CPUs
[linux-2.6-microblaze.git] / tools / testing / selftests / powerpc / security / spectre_v2.c
index c8d82b7..adc2b72 100644 (file)
@@ -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");