Skip to content

Commit 57990ab

Browse files
atishp04avpatel
authored andcommitted
RISC-V: KVM: Fix the initial sample period value
The initial sample period value when counter value is not assigned should be set to maximum value supported by the counter width. Otherwise, it may result in spurious interrupts. Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20240420151741.962500-11-atishp@rivosinc.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent a862521 commit 57990ab

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/riscv/kvm/vcpu_pmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static u64 kvm_pmu_get_sample_period(struct kvm_pmc *pmc)
3939
u64 sample_period;
4040

4141
if (!pmc->counter_val)
42-
sample_period = counter_val_mask + 1;
42+
sample_period = counter_val_mask;
4343
else
4444
sample_period = (-pmc->counter_val) & counter_val_mask;
4545

0 commit comments

Comments
 (0)