Skip to content

Commit c631121

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Add CSR encodings for all HPMCOUNTERS
Linux kernel can directly read these counters as the HPMCOUNTERS CSRs are accessible in S-mode. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 9dc6ce8 commit c631121

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

  • arch/riscv/include/asm

arch/riscv/include/asm/csr.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,67 @@
150150
#define CSR_CYCLE 0xc00
151151
#define CSR_TIME 0xc01
152152
#define CSR_INSTRET 0xc02
153+
#define CSR_HPMCOUNTER3 0xc03
154+
#define CSR_HPMCOUNTER4 0xc04
155+
#define CSR_HPMCOUNTER5 0xc05
156+
#define CSR_HPMCOUNTER6 0xc06
157+
#define CSR_HPMCOUNTER7 0xc07
158+
#define CSR_HPMCOUNTER8 0xc08
159+
#define CSR_HPMCOUNTER9 0xc09
160+
#define CSR_HPMCOUNTER10 0xc0a
161+
#define CSR_HPMCOUNTER11 0xc0b
162+
#define CSR_HPMCOUNTER12 0xc0c
163+
#define CSR_HPMCOUNTER13 0xc0d
164+
#define CSR_HPMCOUNTER14 0xc0e
165+
#define CSR_HPMCOUNTER15 0xc0f
166+
#define CSR_HPMCOUNTER16 0xc10
167+
#define CSR_HPMCOUNTER17 0xc11
168+
#define CSR_HPMCOUNTER18 0xc12
169+
#define CSR_HPMCOUNTER19 0xc13
170+
#define CSR_HPMCOUNTER20 0xc14
171+
#define CSR_HPMCOUNTER21 0xc15
172+
#define CSR_HPMCOUNTER22 0xc16
173+
#define CSR_HPMCOUNTER23 0xc17
174+
#define CSR_HPMCOUNTER24 0xc18
175+
#define CSR_HPMCOUNTER25 0xc19
176+
#define CSR_HPMCOUNTER26 0xc1a
177+
#define CSR_HPMCOUNTER27 0xc1b
178+
#define CSR_HPMCOUNTER28 0xc1c
179+
#define CSR_HPMCOUNTER29 0xc1d
180+
#define CSR_HPMCOUNTER30 0xc1e
181+
#define CSR_HPMCOUNTER31 0xc1f
153182
#define CSR_CYCLEH 0xc80
154183
#define CSR_TIMEH 0xc81
155184
#define CSR_INSTRETH 0xc82
185+
#define CSR_HPMCOUNTER3H 0xc83
186+
#define CSR_HPMCOUNTER4H 0xc84
187+
#define CSR_HPMCOUNTER5H 0xc85
188+
#define CSR_HPMCOUNTER6H 0xc86
189+
#define CSR_HPMCOUNTER7H 0xc87
190+
#define CSR_HPMCOUNTER8H 0xc88
191+
#define CSR_HPMCOUNTER9H 0xc89
192+
#define CSR_HPMCOUNTER10H 0xc8a
193+
#define CSR_HPMCOUNTER11H 0xc8b
194+
#define CSR_HPMCOUNTER12H 0xc8c
195+
#define CSR_HPMCOUNTER13H 0xc8d
196+
#define CSR_HPMCOUNTER14H 0xc8e
197+
#define CSR_HPMCOUNTER15H 0xc8f
198+
#define CSR_HPMCOUNTER16H 0xc90
199+
#define CSR_HPMCOUNTER17H 0xc91
200+
#define CSR_HPMCOUNTER18H 0xc92
201+
#define CSR_HPMCOUNTER19H 0xc93
202+
#define CSR_HPMCOUNTER20H 0xc94
203+
#define CSR_HPMCOUNTER21H 0xc95
204+
#define CSR_HPMCOUNTER22H 0xc96
205+
#define CSR_HPMCOUNTER23H 0xc97
206+
#define CSR_HPMCOUNTER24H 0xc98
207+
#define CSR_HPMCOUNTER25H 0xc99
208+
#define CSR_HPMCOUNTER26H 0xc9a
209+
#define CSR_HPMCOUNTER27H 0xc9b
210+
#define CSR_HPMCOUNTER28H 0xc9c
211+
#define CSR_HPMCOUNTER29H 0xc9d
212+
#define CSR_HPMCOUNTER30H 0xc9e
213+
#define CSR_HPMCOUNTER31H 0xc9f
156214

157215
#define CSR_SSTATUS 0x100
158216
#define CSR_SIE 0x104

0 commit comments

Comments
 (0)