lib: sbi: Fix sbi_pmu_exit() for systems not having MCOUNTINHIBIT csr
authorAnup Patel <anup.patel@wdc.com>
Sun, 11 Jul 2021 08:58:19 +0000 (14:28 +0530)
committerAnup Patel <anup@brainfault.org>
Sun, 11 Jul 2021 09:01:21 +0000 (14:31 +0530)
commita76ac4449bf2b67b899ebdb5085834e94987b690
treef1733139bb9d6c00c3240c213b6ffc5a332b463e
parentb88b3661d43760fbc06bc83de2c5b204a2bb03dd
lib: sbi: Fix sbi_pmu_exit() for systems not having MCOUNTINHIBIT csr

The sbi_pmu_exit() crashes on systems not having MCOUNTINHIBIT csr
so to fix this we check SBI_HART_HAS_MCOUNTINHIBIT feature in
sbi_pmu_exit() and do nothing if it is not available.

Fixes: 13d40f21d588 ("lib: sbi: Add PMU support")
Signed-off-by: Anup Patel <anup.patel@wdc.com>
lib/sbi/sbi_pmu.c