[PATCH v1 0/2] perf: RISC-V: fix SBI PMU masks for RV32

From: Xixin Liu

Date: Fri Aug 07 2026 - 04:57:09 EST


Hi,

This series fixes two RV32 mask-width issues in the SBI PMU driver:

1) Overflow status / restart tracking is u64 but used BIT(), which is
an unsigned long shift and breaks for indices >= 32 on RV32
2) The available-counter mask was a single unsigned long while
iteration uses RISCV_MAX_COUNTERS (64), so RV32 can read past the
object; store it as a DECLARE_BITMAP

Patches are independent. Please review.

Thanks,
Xixin Liu

---

Xixin Liu (2):
perf: RISC-V: use BIT_ULL for u64 overflow masks
perf: RISC-V: store available counter mask as bitmap

drivers/perf/riscv_pmu_legacy.c | 5 +++--
drivers/perf/riscv_pmu_sbi.c | 35 ++++++++++++++++++++++------------
include/linux/perf/riscv_pmu.h | 2 +-
3 files changed, 27 insertions(+), 15 deletions(-)

--
2.43.0