summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Ghiti <[email protected]>2023-04-13 16:02:18 +0200
committerAnup Patel <[email protected]>2023-04-17 09:26:26 +0530
commitbdb3c42bca1c7fddd0c43f0be24c3a1590f02e50 (patch)
tree94fff47490edefc513a46e70d50c51b8bdba9eb5
parente41dbb507c422c52cf93228ca7157394d49ca9fe (diff)
lib: sbi: Do not clear active_events for cycle/instret when stopping
Those events are enabled by default and should not be reset afterwards since when using SBI_PMU_CFG_FLAG_SKIP_MATCH, it leads to unaccessible counters after the first use. Signed-off-by: Alexandre Ghiti <[email protected]> Reviewed-by: Atish Patra <[email protected]>
-rw-r--r--lib/sbi/sbi_pmu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
index 04259aeb..f28c9f5e 100644
--- a/lib/sbi/sbi_pmu.c
+++ b/lib/sbi/sbi_pmu.c
@@ -532,7 +532,7 @@ int sbi_pmu_ctr_stop(unsigned long cbase, unsigned long cmask,
else
ret = pmu_ctr_stop_hw(cidx);
- if (flag & SBI_PMU_STOP_FLAG_RESET) {
+ if (cidx > (CSR_INSTRET - CSR_CYCLE) && flag & SBI_PMU_STOP_FLAG_RESET) {
active_events[hartid][cidx] = SBI_PMU_EVENT_IDX_INVALID;
pmu_reset_hw_mhpmevent(cidx);
}