RISC-V: KVM: Fix the initial sample period value
BugLink: https://bugs.launchpad.net/bugs/2077600 [ Upstream commit 57990ab90ce31aadac0d5a6293f5582e24ff7521 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Portia Stephens <portia.stephens@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
committed by
Stefan Bader
parent
91a8401abb
commit
cf3b431d20
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user