lib: sbi: Implement SBI PMU extension

RISC-V SBI specfication 0.3 defines a PMU extension that allows supervisor
mode to start/stop/configure pmu related events. This patch implements
all of the functionality defined in the specification.

Reviewed-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Atish Patra
2021-07-10 09:18:13 -07:00
committed by Anup Patel
parent ae72ec0915
commit 37f9b0f2f2
5 changed files with 99 additions and 1 deletions

View File

@@ -375,7 +375,7 @@ static int pmu_update_hw_mhpmevent(struct sbi_pmu_hw_event *hw_evt, int ctr_idx,
if (!mhpmevent_val || ctr_idx < 3 || ctr_idx >= SBI_PMU_HW_CTR_MAX)
return SBI_EFAIL;
/* TODO: The upper 8 bits of mhpmevent is reserved by sscofpmf extension.
/* TODO: The upper 16 bits of mhpmevent is reserved by sscofpmf extension.
* Update those bits based on the flags received from supervisor.
* The OVF bit also should be cleared here in case it was not cleared
* during event stop.