Skip to content

Commit 6529870

Browse files
Madhavan Srinivasanmpe
authored andcommitted
powerpc/perf: Update perf_regs structure to include MMCRA
On each sample, Monitor Mode Control Register A (MMCRA) content is saved in pt_regs. MMCRA does not have a entry as-is in the pt_regs but instead, MMCRA content is saved in the "dsisr" register of pt_regs. Patch adds another entry to the perf_regs structure to include the "MMCRA" printing which internally maps to the "dsisr" of pt_regs. It also check for the MMCRA availability in the platform and present value accordingly mpe: This was the 2nd patch in a series with commit 333804d ("powerpc/perf: Update perf_regs structure to include SIER") but I accidentally only merged the 1st patch, so merge this one now. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent bfeffd1 commit 6529870

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum perf_event_powerpc_regs {
4747
PERF_REG_POWERPC_DAR,
4848
PERF_REG_POWERPC_DSISR,
4949
PERF_REG_POWERPC_SIER,
50+
PERF_REG_POWERPC_MMCRA,
5051
PERF_REG_POWERPC_MAX,
5152
};
5253
#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */

arch/powerpc/perf/perf_regs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
7070
PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar),
7171
PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr),
7272
PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar),
73+
PT_REGS_OFFSET(PERF_REG_POWERPC_MMCRA, dsisr),
7374
};
7475

7576
u64 perf_reg_value(struct pt_regs *regs, int idx)
@@ -83,6 +84,11 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
8384
!is_sier_available()))
8485
return 0;
8586

87+
if (idx == PERF_REG_POWERPC_MMCRA &&
88+
(IS_ENABLED(CONFIG_FSL_EMB_PERF_EVENT) ||
89+
IS_ENABLED(CONFIG_PPC32)))
90+
return 0;
91+
8692
return regs_get_register(regs, pt_regs_offset[idx]);
8793
}
8894

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum perf_event_powerpc_regs {
4747
PERF_REG_POWERPC_DAR,
4848
PERF_REG_POWERPC_DSISR,
4949
PERF_REG_POWERPC_SIER,
50+
PERF_REG_POWERPC_MMCRA,
5051
PERF_REG_POWERPC_MAX,
5152
};
5253
#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ static const char *reg_names[] = {
6363
[PERF_REG_POWERPC_TRAP] = "trap",
6464
[PERF_REG_POWERPC_DAR] = "dar",
6565
[PERF_REG_POWERPC_DSISR] = "dsisr",
66-
[PERF_REG_POWERPC_SIER] = "sier"
66+
[PERF_REG_POWERPC_SIER] = "sier",
67+
[PERF_REG_POWERPC_MMCRA] = "mmcra"
6768
};
6869

6970
static inline const char *perf_reg_name(int id)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const struct sample_reg sample_reg_masks[] = {
5353
SMPL_REG(dar, PERF_REG_POWERPC_DAR),
5454
SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR),
5555
SMPL_REG(sier, PERF_REG_POWERPC_SIER),
56+
SMPL_REG(mmcra, PERF_REG_POWERPC_MMCRA),
5657
SMPL_REG_END
5758
};
5859

0 commit comments

Comments
 (0)