tools/testing/selftests/powerpc: Add check for power11 pvr for pmu selfests

Some of the tests depends on pvr value to choose
the event. Example:
- event_alternatives_tests_p10: alternative event depends
  on registered PMU driver which is based on pvr
- generic_events_valid_test varies based on platform
- bhrb_filter_map_test: again its dependent on pmu to
  decide which bhrb filter to use
- reserved_bits_mmcra_sample_elig_mode: randome sampling
  mode reserved bits is also varies based on platform

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: Disha Goel <disgoel@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250113075858.45137-2-atrajeev@linux.vnet.ibm.com
This commit is contained in:
Athira Rajeev 2025-01-13 13:28:55 +05:30 committed by Madhavan Srinivasan
parent fd4d2f3251
commit 520ee327c5
4 changed files with 11 additions and 5 deletions

View File

@ -26,6 +26,7 @@ static int event_alternatives_tests_p10(void)
{
struct event *e, events[5];
int i;
int pvr = PVR_VER(mfspr(SPRN_PVR));
/* Check for platform support for the test */
SKIP_IF(platform_check_for_tests());
@ -36,7 +37,7 @@ static int event_alternatives_tests_p10(void)
* code and using PVR will work correctly for all cases
* including generic compat mode.
*/
SKIP_IF(PVR_VER(mfspr(SPRN_PVR)) != POWER10);
SKIP_IF((pvr != POWER10) && (pvr != POWER11));
SKIP_IF(check_for_generic_compat_pmu());

View File

@ -17,6 +17,7 @@
static int generic_events_valid_test(void)
{
struct event event;
int pvr = mfspr(SPRN_PVR);
/* Check for platform support for the test */
SKIP_IF(platform_check_for_tests());
@ -31,7 +32,7 @@ static int generic_events_valid_test(void)
* - PERF_COUNT_HW_STALLED_CYCLES_BACKEND
* - PERF_COUNT_HW_REF_CPU_CYCLES
*/
if (PVR_VER(mfspr(SPRN_PVR)) == POWER10) {
if ((pvr == POWER10) || (pvr == POWER11)) {
event_init_opts(&event, PERF_COUNT_HW_CPU_CYCLES, PERF_TYPE_HARDWARE, "event");
FAIL_IF(event_open(&event));
event_close(&event);

View File

@ -21,6 +21,7 @@
static int reserved_bits_mmcra_sample_elig_mode(void)
{
struct event event;
int pvr = PVR_VER(mfspr(SPRN_PVR));
/* Check for platform support for the test */
SKIP_IF(platform_check_for_tests());
@ -59,7 +60,7 @@ static int reserved_bits_mmcra_sample_elig_mode(void)
* is reserved in power10 and 0xC is reserved in
* power9.
*/
if (PVR_VER(mfspr(SPRN_PVR)) == POWER10) {
if ((pvr == POWER10) || (pvr == POWER11)) {
event_init(&event, 0x100401e0);
FAIL_IF(!event_open(&event));
} else if (PVR_VER(mfspr(SPRN_PVR)) == POWER9) {

View File

@ -83,13 +83,16 @@ static int bhrb_filter_map_test(void)
* using PVR will work correctly for all cases including generic
* compat mode.
*/
if (PVR_VER(mfspr(SPRN_PVR)) == POWER10) {
switch (PVR_VER(mfspr(SPRN_PVR))) {
case POWER11:
case POWER10:
for (i = 0; i < ARRAY_SIZE(bhrb_filter_map_valid_p10); i++) {
event.attr.branch_sample_type = bhrb_filter_map_valid_p10[i];
FAIL_IF(event_open(&event));
event_close(&event);
}
} else {
break;
default:
for (i = 0; i < ARRAY_SIZE(bhrb_filter_map_valid_p10); i++) {
event.attr.branch_sample_type = bhrb_filter_map_valid_p10[i];
FAIL_IF(!event_open(&event));