drivers/perf: riscv: Reset the counter to hpmevent mapping while starting cpus

Currently, we stop all the counters while a new cpu is brought online.
However, the hpmevent to counter mappings are not reset. The firmware may
have some stale encoding in their mapping structure which may lead to
undesirable results. We have not encountered such scenario though.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20240628-misc_perf_fixes-v4-2-e01cfddcf035@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
Samuel Holland 2024-06-28 00:51:42 -07:00 committed by Palmer Dabbelt
parent a3f24e83d1
commit 7dd646cf74
No known key found for this signature in database
GPG Key ID: 2E1319F35FBB1889

View File

@ -762,7 +762,7 @@ static inline void pmu_sbi_stop_all(struct riscv_pmu *pmu)
* which may include counters that are not enabled yet. * which may include counters that are not enabled yet.
*/ */
sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP, sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP,
0, pmu->cmask, 0, 0, 0, 0); 0, pmu->cmask, SBI_PMU_STOP_FLAG_RESET, 0, 0, 0);
} }
static inline void pmu_sbi_stop_hw_ctrs(struct riscv_pmu *pmu) static inline void pmu_sbi_stop_hw_ctrs(struct riscv_pmu *pmu)