Skip to content

Commit acc1b91

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Fix counter restart during overflow for RV32
Pass the upper half of the initial value of the counter correctly for RV32. Fixes: 4905ec2 ("RISC-V: Add sscofpmf extension support") Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Guo Ren <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent f2906aa commit acc1b91

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/perf/riscv_pmu_sbi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,13 @@ static inline void pmu_sbi_start_overflow_mask(struct riscv_pmu *pmu,
525525
hwc = &event->hw;
526526
max_period = riscv_pmu_ctr_get_width_mask(event);
527527
init_val = local64_read(&hwc->prev_count) & max_period;
528+
#if defined(CONFIG_32BIT)
529+
sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1,
530+
flag, init_val, init_val >> 32, 0);
531+
#else
528532
sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_START, idx, 1,
529533
flag, init_val, 0, 0);
534+
#endif
530535
}
531536
ctr_ovf_mask = ctr_ovf_mask >> 1;
532537
idx++;

0 commit comments

Comments
 (0)