Skip to content

Commit

Permalink
powerpc/perf: Update perf_regs structure to include MMCRA
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Madhavan Srinivasan authored and Michael Ellerman committed Jan 8, 2019
1 parent bfeffd1 commit 6529870
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions arch/powerpc/include/uapi/asm/perf_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum perf_event_powerpc_regs {
PERF_REG_POWERPC_DAR,
PERF_REG_POWERPC_DSISR,
PERF_REG_POWERPC_SIER,
PERF_REG_POWERPC_MMCRA,
PERF_REG_POWERPC_MAX,
};
#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
6 changes: 6 additions & 0 deletions arch/powerpc/perf/perf_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar),
PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr),
PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar),
PT_REGS_OFFSET(PERF_REG_POWERPC_MMCRA, dsisr),
};

u64 perf_reg_value(struct pt_regs *regs, int idx)
Expand All @@ -83,6 +84,11 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
!is_sier_available()))
return 0;

if (idx == PERF_REG_POWERPC_MMCRA &&
(IS_ENABLED(CONFIG_FSL_EMB_PERF_EVENT) ||
IS_ENABLED(CONFIG_PPC32)))
return 0;

return regs_get_register(regs, pt_regs_offset[idx]);
}

Expand Down
1 change: 1 addition & 0 deletions tools/arch/powerpc/include/uapi/asm/perf_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum perf_event_powerpc_regs {
PERF_REG_POWERPC_DAR,
PERF_REG_POWERPC_DSISR,
PERF_REG_POWERPC_SIER,
PERF_REG_POWERPC_MMCRA,
PERF_REG_POWERPC_MAX,
};
#endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
3 changes: 2 additions & 1 deletion tools/perf/arch/powerpc/include/perf_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ static const char *reg_names[] = {
[PERF_REG_POWERPC_TRAP] = "trap",
[PERF_REG_POWERPC_DAR] = "dar",
[PERF_REG_POWERPC_DSISR] = "dsisr",
[PERF_REG_POWERPC_SIER] = "sier"
[PERF_REG_POWERPC_SIER] = "sier",
[PERF_REG_POWERPC_MMCRA] = "mmcra"
};

static inline const char *perf_reg_name(int id)
Expand Down
1 change: 1 addition & 0 deletions tools/perf/arch/powerpc/util/perf_regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const struct sample_reg sample_reg_masks[] = {
SMPL_REG(dar, PERF_REG_POWERPC_DAR),
SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR),
SMPL_REG(sier, PERF_REG_POWERPC_SIER),
SMPL_REG(mmcra, PERF_REG_POWERPC_MMCRA),
SMPL_REG_END
};

Expand Down

0 comments on commit 6529870

Please sign in to comment.