From 9a4e47ef98a3041f6d2869ba2cd3401701776275 Mon Sep 17 00:00:00 2001 From: Leo Yan Date: Wed, 14 Feb 2024 19:39:46 +0800 Subject: perf parse-regs: Introduce a weak function arch__sample_reg_masks() Every architecture can provide a register list for sampling. If an architecture doesn't support register sampling, it won't define the data structure 'sample_reg_masks'. Consequently, any code using this structure must be protected by the macro 'HAVE_PERF_REGS_SUPPORT'. This patch defines a weak function, arch__sample_reg_masks(), which will be replaced by an architecture-defined function for returning the architecture's register list. With this refactoring, the function always exists, the condition checking for 'HAVE_PERF_REGS_SUPPORT' is not needed anymore, so remove it. Signed-off-by: Leo Yan Reviewed-by: Ian Rogers Cc: James Clark Cc: Palmer Dabbelt Cc: Albert Ou Cc: Huacai Chen Cc: Guo Ren Cc: Will Deacon Cc: Mike Leach Cc: Kan Liang Cc: Ming Wang Cc: John Garry Cc: Paul Walmsley Cc: linux-csky@vger.kernel.org Cc: linux-riscv@lists.infradead.org Signed-off-by: Namhyung Kim Link: https://lore.kernel.org/r/20240214113947.240957-4-leo.yan@linux.dev --- tools/perf/arch/arm/util/perf_regs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools/perf/arch/arm') diff --git a/tools/perf/arch/arm/util/perf_regs.c b/tools/perf/arch/arm/util/perf_regs.c index 2c56e8b56ddf..f94a0210c7b7 100644 --- a/tools/perf/arch/arm/util/perf_regs.c +++ b/tools/perf/arch/arm/util/perf_regs.c @@ -2,7 +2,7 @@ #include "perf_regs.h" #include "../../../util/perf_regs.h" -const struct sample_reg sample_reg_masks[] = { +static const struct sample_reg sample_reg_masks[] = { SMPL_REG_END }; @@ -15,3 +15,8 @@ uint64_t arch__user_reg_mask(void) { return PERF_REGS_MASK; } + +const struct sample_reg *arch__sample_reg_masks(void) +{ + return sample_reg_masks; +} -- cgit v1.2.3