1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. */
4 #ifndef ARCH_PERF_REGS_H
5 #define ARCH_PERF_REGS_H
8 #include <linux/types.h>
9 #include <asm/perf_regs.h>
11 #define PERF_REGS_MASK ((1ULL << PERF_REG_RISCV_MAX) - 1)
12 #define PERF_REGS_MAX PERF_REG_RISCV_MAX
13 #if __riscv_xlen == 64
14 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64
16 #define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
19 #define PERF_REG_IP PERF_REG_RISCV_PC
20 #define PERF_REG_SP PERF_REG_RISCV_SP
22 static inline const char *__perf_reg_name(int id)
25 case PERF_REG_RISCV_PC:
27 case PERF_REG_RISCV_RA:
29 case PERF_REG_RISCV_SP:
31 case PERF_REG_RISCV_GP:
33 case PERF_REG_RISCV_TP:
35 case PERF_REG_RISCV_T0:
37 case PERF_REG_RISCV_T1:
39 case PERF_REG_RISCV_T2:
41 case PERF_REG_RISCV_S0:
43 case PERF_REG_RISCV_S1:
45 case PERF_REG_RISCV_A0:
47 case PERF_REG_RISCV_A1:
49 case PERF_REG_RISCV_A2:
51 case PERF_REG_RISCV_A3:
53 case PERF_REG_RISCV_A4:
55 case PERF_REG_RISCV_A5:
57 case PERF_REG_RISCV_A6:
59 case PERF_REG_RISCV_A7:
61 case PERF_REG_RISCV_S2:
63 case PERF_REG_RISCV_S3:
65 case PERF_REG_RISCV_S4:
67 case PERF_REG_RISCV_S5:
69 case PERF_REG_RISCV_S6:
71 case PERF_REG_RISCV_S7:
73 case PERF_REG_RISCV_S8:
75 case PERF_REG_RISCV_S9:
77 case PERF_REG_RISCV_S10:
79 case PERF_REG_RISCV_S11:
81 case PERF_REG_RISCV_T3:
83 case PERF_REG_RISCV_T4:
85 case PERF_REG_RISCV_T5:
87 case PERF_REG_RISCV_T6:
96 #endif /* ARCH_PERF_REGS_H */