Skip to content

Commit 6665598

Browse files
athira-rajeevacmel
authored andcommitted
perf tools powerpc: Add support for extended regs in power10
Added support for supported regs which are new in power10 ( MMCR3, SIER2, SIER3 ) to sample_reg_mask in the tool side to use with `-I?` option. Also added PVR check to send extended mask for power10 at kernel while capturing extended regs in each sample. Signed-off-by: Athira Jajeev <[email protected]> Reviewed-by: Kajol Jain <[email protected]> Reviewed-by: Ravi Bangoria <[email protected]> Tested-by: Ravi Bangoria <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Michael Neuling <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: [email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 33583e6 commit 6665598

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

tools/arch/powerpc/include/uapi/asm/perf_regs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ enum perf_event_powerpc_regs {
5252
PERF_REG_POWERPC_MMCR0,
5353
PERF_REG_POWERPC_MMCR1,
5454
PERF_REG_POWERPC_MMCR2,
55+
PERF_REG_POWERPC_MMCR3,
56+
PERF_REG_POWERPC_SIER2,
57+
PERF_REG_POWERPC_SIER3,
5558
/* Max regs without the extended regs */
5659
PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
5760
};
@@ -60,6 +63,9 @@ enum perf_event_powerpc_regs {
6063

6164
/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300 */
6265
#define PERF_REG_PMU_MASK_300 (((1ULL << (PERF_REG_POWERPC_MMCR2 + 1)) - 1) - PERF_REG_PMU_MASK)
66+
/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31 */
67+
#define PERF_REG_PMU_MASK_31 (((1ULL << (PERF_REG_POWERPC_SIER3 + 1)) - 1) - PERF_REG_PMU_MASK)
6368

6469
#define PERF_REG_MAX_ISA_300 (PERF_REG_POWERPC_MMCR2 + 1)
70+
#define PERF_REG_MAX_ISA_31 (PERF_REG_POWERPC_SIER3 + 1)
6571
#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */

tools/perf/arch/powerpc/include/perf_regs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ static const char *reg_names[] = {
6868
[PERF_REG_POWERPC_MMCR0] = "mmcr0",
6969
[PERF_REG_POWERPC_MMCR1] = "mmcr1",
7070
[PERF_REG_POWERPC_MMCR2] = "mmcr2",
71+
[PERF_REG_POWERPC_MMCR3] = "mmcr3",
72+
[PERF_REG_POWERPC_SIER2] = "sier2",
73+
[PERF_REG_POWERPC_SIER3] = "sier3",
7174
};
7275

7376
static inline const char *perf_reg_name(int id)

tools/perf/arch/powerpc/util/perf_regs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/kernel.h>
1515

1616
#define PVR_POWER9 0x004E
17+
#define PVR_POWER10 0x0080
1718

1819
const struct sample_reg sample_reg_masks[] = {
1920
SMPL_REG(r0, PERF_REG_POWERPC_R0),
@@ -64,6 +65,9 @@ const struct sample_reg sample_reg_masks[] = {
6465
SMPL_REG(mmcr0, PERF_REG_POWERPC_MMCR0),
6566
SMPL_REG(mmcr1, PERF_REG_POWERPC_MMCR1),
6667
SMPL_REG(mmcr2, PERF_REG_POWERPC_MMCR2),
68+
SMPL_REG(mmcr3, PERF_REG_POWERPC_MMCR3),
69+
SMPL_REG(sier2, PERF_REG_POWERPC_SIER2),
70+
SMPL_REG(sier3, PERF_REG_POWERPC_SIER3),
6771
SMPL_REG_END
6872
};
6973

@@ -194,6 +198,8 @@ uint64_t arch__intr_reg_mask(void)
194198
version = (((mfspr(SPRN_PVR)) >> 16) & 0xFFFF);
195199
if (version == PVR_POWER9)
196200
extended_mask = PERF_REG_PMU_MASK_300;
201+
else if (version == PVR_POWER10)
202+
extended_mask = PERF_REG_PMU_MASK_31;
197203
else
198204
return mask;
199205

0 commit comments

Comments
 (0)