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
 {
        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());
         * 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());
 
 
 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());
         * - 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);
 
 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());
         * 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) {
 
         * 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));