diff options
| author | David E. Garcia Porras <[email protected]> | 2026-08-18 15:00:21 -0600 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2026-09-03 13:27:45 +0530 |
| commit | d97cfb33ae1ac0d9eebce1a03c96497a1f8f4c67 (patch) | |
| tree | 7671e94c1364a6e3bb578a8380580d9b6a5377c8 /include | |
| parent | 35511bc6ee1c9c17b6a89b44c52e2044bb51b979 (diff) | |
lib: sbi_pmu: Return invalid param error for reserved event_idx bits
As per section 11.14 of the SBI specification (Function: Get PMU Event
Info, FID #8), Table 47, the event_idx word of an event info entry
only uses BIT[0:19]; BIT[20:31] are reserved for the future purpose
and must be zero. Table 48 further requires the SBI implementation to
return SBI_ERR_INVALID_PARAM if any reserved bit in an event_idx word
is set.
sbi_pmu_event_get_info() does not check the reserved bits, so a
malformed event_idx is silently passed on to pmu_event_validate()
instead of failing the call. Add SBI_PMU_EVENT_IDX_MBZ_MASK covering
the must-be-zero bits and return SBI_ERR_INVALID_PARAM when any of
them are set.
Fixes: e4345842168b ("lib: sbi_pmu: Implement SBI PMU event info function")
Signed-off-by: David E. Garcia Porras <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi/sbi_ecall_interface.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h index acb91a01..bfde25d0 100644 --- a/include/sbi/sbi_ecall_interface.h +++ b/include/sbi/sbi_ecall_interface.h @@ -271,6 +271,8 @@ struct sbi_pmu_event_info { #define SBI_PMU_EVENT_IDX_TYPE_OFFSET 16 #define SBI_PMU_EVENT_IDX_TYPE_MASK (0xF << SBI_PMU_EVENT_IDX_TYPE_OFFSET) #define SBI_PMU_EVENT_IDX_CODE_MASK 0xFFFF +#define SBI_PMU_EVENT_IDX_MBZ_OFFSET 20 +#define SBI_PMU_EVENT_IDX_MBZ_MASK (0xFFF << SBI_PMU_EVENT_IDX_MBZ_OFFSET) #define SBI_PMU_EVENT_RAW_IDX 0x20000 #define SBI_PMU_EVENT_RAW_V2_IDX 0x30000 |
