From: Michael Ellerman <mpe@ellerman.id.au>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 6/9] selftests/powerpc: Skip security tests on older CPUs
Date: Wed, 19 Aug 2020 11:57:24 +1000 [thread overview]
Message-ID: <20200819015727.1977134-6-mpe@ellerman.id.au> (raw)
In-Reply-To: <20200819015727.1977134-1-mpe@ellerman.id.au>
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>
---
tools/testing/selftests/powerpc/security/rfi_flush.c | 3 +++
tools/testing/selftests/powerpc/security/spectre_v2.c | 3 +++
2 files changed, 6 insertions(+)
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");
--
2.25.1
next prev parent reply other threads:[~2020-08-19 2:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 1:57 [PATCH 1/9] selftests/powerpc: Make using_hash_mmu() work on Cell & PowerMac Michael Ellerman
2020-08-19 1:57 ` [PATCH 2/9] selftests/powerpc: Give the bad_accesses test longer to run Michael Ellerman
2020-08-19 1:57 ` [PATCH 3/9] selftests/powerpc: Move set_dscr() into rfi_flush.c Michael Ellerman
2020-08-19 1:57 ` [PATCH 4/9] selftests/powerpc: Include asm/cputable.h from utils.h Michael Ellerman
2020-08-19 1:57 ` [PATCH 5/9] selftests/powerpc: Don't run DSCR tests on old systems Michael Ellerman
2020-08-19 1:57 ` Michael Ellerman [this message]
2020-08-19 1:57 ` [PATCH 7/9] selftests/powerpc: Skip L3 bank test on older CPUs Michael Ellerman
2020-08-19 1:57 ` [PATCH 8/9] selftests/powerpc: Don't touch VMX/VSX " Michael Ellerman
2020-08-19 1:57 ` [PATCH 9/9] selftests/powerpc: Properly handle failure in switch_endian_test Michael Ellerman
2020-09-09 13:27 ` [PATCH 1/9] selftests/powerpc: Make using_hash_mmu() work on Cell & PowerMac Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200819015727.1977134-6-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox