Skip to contentSkip to conversation

selftests/powerpc: Fix "no_handler" EBB selftest for ISA v3.1

PATCH Superseded Athira Rajeev 1 participant 1 message May 20, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/powerpc: Fix "no_handler" EBB selftest for ISA v3.1

The "no_handler_test" in ebb selftests attempts to read the PMU registers after closing of the event via helper function "dump_ebb_state". With the MMCR0 control bit (PMCCEXT) in ISA v3.1, read access to group B registers is restricted when MMCR0 PMCC=0b00. Hence the call to dump_ebb_state after closing of event will generate a SIGILL, which is expected.

Test has below in logs:

<<>>
!! child died by signal 4
failure: no_handler_test
<<>>

In other platforms (like power9), the older behaviour works where group B PMU SPRs are readable. Patch fixes the selftest to handle the sigill for ISA v3.1.

---
 tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c +11 -1
index fc5bf48..5f57a9d 100644
@@ -50,7 +50,17 @@ static int no_handler_test(void)
 
 	event_close(&event);
 
-	dump_ebb_state();
+	/*
+	 * For ISA v3.1, verify the test takes a SIGILL when reading
+	 * PMU regs after the event is closed. With the control bit
+	 * in MMCR0 (PMCCEXT) restricting access to group B PMU regs,
+	 * sigill is expected.
+	 */
+
+	if (have_hwcap2(PPC_FEATURE2_ARCH_3_1))
+		FAIL_IF(catch_sigill(dump_ebb_state));
+	else
+		dump_ebb_state();
 
 	/* The real test is that we never took an EBB at 0x0 */
 
Signature · 1 line
1.8.3.1