mirror of
https://github.com/torvalds/linux.git
synced 2026-11-28 01:13:11 +00:00
util/perf_regs.h includes another perf_regs.h: #include <perf_regs.h> Here it includes architecture specific header, for example, if we build arm64 target, the header tools/perf/arch/arm64/include/perf_regs.h is included. We use this implicit way to include architecture specific header, which is not directive; furthermore, util/perf_regs.c is coupled with the architecture specific definitions. This patch moves out arch specific header from util/perf_regs.h for generalizing the 'util' folder, as a result, the source files in 'arch' folder explicitly include architecture's perf_regs.h. Signed-off-by: Leo Yan <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Albert Ou <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Eric Lin <[email protected]> Cc: Fangrui Song <[email protected]> Cc: Guo Ren <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ivan Babrou <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mike Leach <[email protected]> Cc: Ming Wang <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sandipan Das <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
101 lines
2.6 KiB
C
101 lines
2.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __PERF_REGS_H
|
|
#define __PERF_REGS_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/compiler.h>
|
|
|
|
struct regs_dump;
|
|
|
|
struct sample_reg {
|
|
const char *name;
|
|
uint64_t mask;
|
|
};
|
|
|
|
#define SMPL_REG_MASK(b) (1ULL << (b))
|
|
#define SMPL_REG(n, b) { .name = #n, .mask = SMPL_REG_MASK(b) }
|
|
#define SMPL_REG2_MASK(b) (3ULL << (b))
|
|
#define SMPL_REG2(n, b) { .name = #n, .mask = SMPL_REG2_MASK(b) }
|
|
#define SMPL_REG_END { .name = NULL }
|
|
|
|
enum {
|
|
SDT_ARG_VALID = 0,
|
|
SDT_ARG_SKIP,
|
|
};
|
|
|
|
int arch_sdt_arg_parse_op(char *old_op, char **new_op);
|
|
uint64_t arch__intr_reg_mask(void);
|
|
uint64_t arch__user_reg_mask(void);
|
|
|
|
#ifdef HAVE_PERF_REGS_SUPPORT
|
|
extern const struct sample_reg sample_reg_masks[];
|
|
|
|
const char *perf_reg_name(int id, const char *arch);
|
|
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
|
|
uint64_t perf_arch_reg_ip(const char *arch);
|
|
uint64_t perf_arch_reg_sp(const char *arch);
|
|
const char *__perf_reg_name_arm64(int id);
|
|
uint64_t __perf_reg_ip_arm64(void);
|
|
uint64_t __perf_reg_sp_arm64(void);
|
|
const char *__perf_reg_name_arm(int id);
|
|
uint64_t __perf_reg_ip_arm(void);
|
|
uint64_t __perf_reg_sp_arm(void);
|
|
const char *__perf_reg_name_csky(int id);
|
|
uint64_t __perf_reg_ip_csky(void);
|
|
uint64_t __perf_reg_sp_csky(void);
|
|
const char *__perf_reg_name_loongarch(int id);
|
|
uint64_t __perf_reg_ip_loongarch(void);
|
|
uint64_t __perf_reg_sp_loongarch(void);
|
|
const char *__perf_reg_name_mips(int id);
|
|
uint64_t __perf_reg_ip_mips(void);
|
|
uint64_t __perf_reg_sp_mips(void);
|
|
const char *__perf_reg_name_powerpc(int id);
|
|
uint64_t __perf_reg_ip_powerpc(void);
|
|
uint64_t __perf_reg_sp_powerpc(void);
|
|
const char *__perf_reg_name_riscv(int id);
|
|
uint64_t __perf_reg_ip_riscv(void);
|
|
uint64_t __perf_reg_sp_riscv(void);
|
|
const char *__perf_reg_name_s390(int id);
|
|
uint64_t __perf_reg_ip_s390(void);
|
|
uint64_t __perf_reg_sp_s390(void);
|
|
const char *__perf_reg_name_x86(int id);
|
|
uint64_t __perf_reg_ip_x86(void);
|
|
uint64_t __perf_reg_sp_x86(void);
|
|
|
|
static inline uint64_t DWARF_MINIMAL_REGS(const char *arch)
|
|
{
|
|
return (1ULL << perf_arch_reg_ip(arch)) | (1ULL << perf_arch_reg_sp(arch));
|
|
}
|
|
|
|
#else
|
|
|
|
static inline uint64_t DWARF_MINIMAL_REGS(const char *arch __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline const char *perf_reg_name(int id __maybe_unused, const char *arch __maybe_unused)
|
|
{
|
|
return "unknown";
|
|
}
|
|
|
|
static inline int perf_reg_value(u64 *valp __maybe_unused,
|
|
struct regs_dump *regs __maybe_unused,
|
|
int id __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline uint64_t perf_arch_reg_ip(const char *arch __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline uint64_t perf_arch_reg_sp(const char *arch __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#endif /* HAVE_PERF_REGS_SUPPORT */
|
|
#endif /* __PERF_REGS_H */
|