selftests/powerpc/pmu: Add selftest for event alternatives for power10
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Fri, 10 Jun 2022 13:41:05 +0000 (19:11 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 28 Jun 2022 22:57:44 +0000 (08:57 +1000)
commit3f1a87425f8c2f9af745923865a4765e36a2ed3c
tree5acb7f054760024d6f3a758b2feddf1985682fcf
parent5958ad4392b0f437605ade8bab42447b0d97ad8c
selftests/powerpc/pmu: Add selftest for event alternatives for power10

Platform specific PMU supports alternative event for some of the event
codes. During perf_event_open, it any event group doesn't match
constraint check criteria, further lookup is done to find alternative
event. Code checks to see if it is possible to schedule event as group
using alternative events.

Testcase exercises the alternative event find code for power10. Example,
Using PMC1 to PMC4 in a group and again trying to schedule
PM_CYC_ALT (0x0001e) will fail since this exceeds number of programmable
events in group. But since 0x600f4 is an alternative event for 0x0001e,
it is possible to use 0x0001e in the group. Testcase uses such
combination all events in power10 which has alternative event.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220610134113.62991-28-atrajeev@linux.vnet.ibm.com
tools/testing/selftests/powerpc/pmu/event_code_tests/Makefile
tools/testing/selftests/powerpc/pmu/event_code_tests/event_alternatives_tests_p10.c [new file with mode: 0644]