diff options
author | Atish Patra <atishp@rivosinc.com> | 2024-04-20 08:17:26 -0700 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2024-04-26 13:13:42 +0530 |
commit | 57990ab90ce31aadac0d5a6293f5582e24ff7521 (patch) | |
tree | e6fe6a9574a32f7b55d0def4f18670634c7e21be | |
parent | a8625217a054ca058cf74742e58c2c88460eb202 (diff) |
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>
-rw-r--r-- | arch/riscv/kvm/vcpu_pmu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c index 86391a5061dd..cee1b9ca4ec4 100644 --- a/arch/riscv/kvm/vcpu_pmu.c +++ b/arch/riscv/kvm/vcpu_pmu.c @@ -39,7 +39,7 @@ static u64 kvm_pmu_get_sample_period(struct kvm_pmc *pmc) u64 sample_period; if (!pmc->counter_val) - sample_period = counter_val_mask + 1; + sample_period = counter_val_mask; else sample_period = (-pmc->counter_val) & counter_val_mask; |