summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInochi Amaoto <[email protected]>2023-08-15 17:40:33 +0800
committerAnup Patel <[email protected]>2023-09-10 11:05:01 +0530
commit901d3d7bff5a511b5f320aad8a0d65e79c95d09c (patch)
treee07df10caf85902080a7a7d208a197a18ac33009
parentc9a296d0edc9cb64638c026949ef091d7d9e01e9 (diff)
lib: sbi_pmu: keep overflow interrupt of stopped hpm counter disabled
After the hardware hpm counter is stopped, it should not raise any new interrupt as it is already stopped. So add the hw_counter_disable_irq callback to allow the custom pmu device to control this behavior. Signed-off-by: Inochi Amaoto <[email protected]> Reviewed-by: Guo Ren <[email protected]> Reviewed-by: Anup Patel <[email protected]> Tested-by: Samuel Holland <[email protected]>
-rw-r--r--lib/sbi/sbi_pmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
index c52e8a29..9694aae4 100644
--- a/lib/sbi/sbi_pmu.c
+++ b/lib/sbi/sbi_pmu.c
@@ -482,6 +482,9 @@ static int pmu_ctr_stop_hw(uint32_t cidx)
if (!__test_bit(cidx, &mctr_inhbt)) {
__set_bit(cidx, &mctr_inhbt);
csr_write(CSR_MCOUNTINHIBIT, mctr_inhbt);
+ if (pmu_dev && pmu_dev->hw_counter_disable_irq) {
+ pmu_dev->hw_counter_disable_irq(cidx);
+ }
return 0;
} else
return SBI_EALREADY_STOPPED;