lib: sbi: Map only the counters enabled in hardware
authorAtish Patra <atishp@rivosinc.com>
Fri, 7 Jan 2022 18:54:07 +0000 (10:54 -0800)
committerAnup Patel <anup@brainfault.org>
Fri, 4 Feb 2022 04:37:07 +0000 (10:07 +0530)
commit632f59392bbaa05176376b7d7a9f77f611816614
tree05bb7435d4374cc07fdabfa72a049f9fa352a2f9
parent5d025eb2353550eadbd2fa9b8083a92fe9b07bd9
lib: sbi: Map only the counters enabled in hardware

The counter mapping in DT may be incorrect if all the counters specified
in the mapping are actually not physically present in the hardware.
OpenSBI should only keep a mapping of counters enabled in hardware and
defined in DT. This assume that all the programmable hpmcounters are
consecutive as it doesn't make sense to build a system with sparse
hpmcounters.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
lib/sbi/sbi_pmu.c