Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/testing/selftests/powerpc: Enable pmu selftests for power11

Add check for power11 pvr in the selftest utility
functions. Selftests uses pvr value to check for platform
support inorder to run the tests. pvr is also used to
send the extended mask value to capture sampling registers.

Update some of the utility functions to use hwcap2 inorder
to return platform specific bits from sampling registers.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250113075858.45137-1-atrajeev@linux.vnet.ibm.com

authored by

Athira Rajeev and committed by
Madhavan Srinivasan
fd4d2f32 f848e7ee

+16 -5
+10 -1
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.c
··· 59 59 ev_shift_thd_stop = 32; 60 60 61 61 switch (pvr) { 62 + case POWER11: 62 63 case POWER10: 63 64 ev_mask_thd_cmp = 0x3ffff; 64 65 ev_shift_thd_cmp = 0; ··· 130 129 * Check for supported platforms 131 130 * for sampling test 132 131 */ 133 - if ((pvr != POWER10) && (pvr != POWER9)) 132 + switch (pvr) { 133 + case POWER11: 134 + case POWER10: 135 + case POWER9: 136 + break; 137 + default: 134 138 goto out; 139 + } 135 140 136 141 /* 137 142 * Check PMU driver registered by looking for ··· 506 499 base_pvr = POWER9; 507 500 else if (!strcmp(auxv_base_platform(), "power10")) 508 501 base_pvr = POWER10; 502 + else if (!strcmp(auxv_base_platform(), "power11")) 503 + base_pvr = POWER11; 509 504 510 505 return (!base_pvr); 511 506 }
+6 -4
tools/testing/selftests/powerpc/pmu/sampling_tests/misc.h
··· 8 8 #include <sys/stat.h> 9 9 #include "../event.h" 10 10 11 + #define POWER11 0x82 11 12 #define POWER10 0x80 12 13 #define POWER9 0x4e 13 14 #define PERF_POWER9_MASK 0x7f8ffffffffffff 14 15 #define PERF_POWER10_MASK 0x7ffffffffffffff 16 + #define PERF_POWER11_MASK PERF_POWER10_MASK 15 17 16 18 #define MMCR0_FC56 0x00000010UL /* freeze counters 5 and 6 */ 17 19 #define MMCR0_PMCCEXT 0x00000200UL /* PMCCEXT control */ ··· 167 165 168 166 static inline int get_mmcr2_l2l3(u64 mmcr2, int pmc) 169 167 { 170 - if (pvr == POWER10) 168 + if (have_hwcap2(PPC_FEATURE2_ARCH_3_1)) 171 169 return ((mmcr2 & 0xf8) >> 3); 172 170 return 0; 173 171 } 174 172 175 173 static inline int get_mmcr3_src(u64 mmcr3, int pmc) 176 174 { 177 - if (pvr != POWER10) 175 + if (!have_hwcap2(PPC_FEATURE2_ARCH_3_1)) 178 176 return 0; 179 177 return ((mmcr3 >> ((49 - (15 * ((pmc) - 1))))) & 0x7fff); 180 178 } 181 179 182 180 static inline int get_mmcra_thd_cmp(u64 mmcra, int pmc) 183 181 { 184 - if (pvr == POWER10) 182 + if (have_hwcap2(PPC_FEATURE2_ARCH_3_1)) 185 183 return ((mmcra >> 45) & 0x7ff); 186 184 return ((mmcra >> 45) & 0x3ff); 187 185 } ··· 193 191 194 192 static inline u64 get_mmcra_bhrb_disable(u64 mmcra, int pmc) 195 193 { 196 - if (pvr == POWER10) 194 + if (have_hwcap2(PPC_FEATURE2_ARCH_3_1)) 197 195 return mmcra & BHRB_DISABLE; 198 196 return 0; 199 197 }