drivers/perf: riscv: Fix counter mask iteration for RV32
authorAtish Patra <atishp@rivosinc.com>
Sat, 20 Apr 2024 15:17:24 +0000 (08:17 -0700)
committerAnup Patel <anup@brainfault.org>
Mon, 22 Apr 2024 05:43:58 +0000 (11:13 +0530)
commitb994cdfcdf7b9681d3986538d0aa37835cc0a285
tree824e192c5909f00b89dc88c7cac465a58e8c1582
parentb737fc24a12ceb6c393d9d68def6a6608fdf11cc
drivers/perf: riscv: Fix counter mask iteration for RV32

For RV32, used_hw_ctrs can have more than 1 word if the firmware chooses
to interleave firmware/hardware counters indicies. Even though it's a
unlikely scenario, handle that case by iterating over all the words
instead of just using the first word.

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20240420151741.962500-9-atishp@rivosinc.com
Signed-off-by: Anup Patel <anup@brainfault.org>
drivers/perf/riscv_pmu_sbi.c