Skip to content

Commit f829ee7

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Improve SBI definitions
Fixed few typos and bit fields not aligned with the spec. Define other related macros that will be useful in the future. Signed-off-by: Atish Patra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 63ba67e commit f829ee7

File tree

1 file changed

+16
-2
lines changed
  • arch/riscv/include/asm

1 file changed

+16
-2
lines changed

arch/riscv/include/asm/sbi.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ union sbi_pmu_ctr_info {
136136
};
137137
};
138138

139-
#define RISCV_PMU_RAW_EVENT_MASK GENMASK_ULL(55, 0)
139+
#define RISCV_PMU_RAW_EVENT_MASK GENMASK_ULL(47, 0)
140140
#define RISCV_PMU_RAW_EVENT_IDX 0x20000
141141

142142
/** General pmu event codes specified in SBI PMU extension */
@@ -203,12 +203,26 @@ enum sbi_pmu_ctr_type {
203203
SBI_PMU_CTR_TYPE_FW,
204204
};
205205

206+
/* Helper macros to decode event idx */
207+
#define SBI_PMU_EVENT_IDX_OFFSET 20
208+
#define SBI_PMU_EVENT_IDX_MASK 0xFFFFF
209+
#define SBI_PMU_EVENT_IDX_CODE_MASK 0xFFFF
210+
#define SBI_PMU_EVENT_IDX_TYPE_MASK 0xF0000
211+
#define SBI_PMU_EVENT_RAW_IDX 0x20000
212+
#define SBI_PMU_FIXED_CTR_MASK 0x07
213+
214+
#define SBI_PMU_EVENT_CACHE_ID_CODE_MASK 0xFFF8
215+
#define SBI_PMU_EVENT_CACHE_OP_ID_CODE_MASK 0x06
216+
#define SBI_PMU_EVENT_CACHE_RESULT_ID_CODE_MASK 0x01
217+
218+
#define SBI_PMU_EVENT_IDX_INVALID 0xFFFFFFFF
219+
206220
/* Flags defined for config matching function */
207221
#define SBI_PMU_CFG_FLAG_SKIP_MATCH (1 << 0)
208222
#define SBI_PMU_CFG_FLAG_CLEAR_VALUE (1 << 1)
209223
#define SBI_PMU_CFG_FLAG_AUTO_START (1 << 2)
210224
#define SBI_PMU_CFG_FLAG_SET_VUINH (1 << 3)
211-
#define SBI_PMU_CFG_FLAG_SET_VSNH (1 << 4)
225+
#define SBI_PMU_CFG_FLAG_SET_VSINH (1 << 4)
212226
#define SBI_PMU_CFG_FLAG_SET_UINH (1 << 5)
213227
#define SBI_PMU_CFG_FLAG_SET_SINH (1 << 6)
214228
#define SBI_PMU_CFG_FLAG_SET_MINH (1 << 7)

0 commit comments

Comments
 (0)