diff options
author | Marc Zyngier <maz@kernel.org> | 2022-11-13 16:38:21 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2022-11-17 15:39:51 +0000 |
commit | 001d85bd6c039d3662a4f33a5d212ef3e0438b27 (patch) | |
tree | 015ec842d0754c3a0212173e70b6d5b80f0449fb /arch/arm64/kvm | |
parent | c82d28cbf1d4f9fe174041b4485c635cb970afa7 (diff) | |
download | linux-stable-001d85bd6c039d3662a4f33a5d212ef3e0438b27.tar.gz linux-stable-001d85bd6c039d3662a4f33a5d212ef3e0438b27.tar.bz2 linux-stable-001d85bd6c039d3662a4f33a5d212ef3e0438b27.zip |
KVM: arm64: PMU: Narrow the overflow checking when required
For 64bit counters that overflow on a 32bit boundary, make
sure we only check the bottom 32bit to generate a CHAIN event.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Reiji Watanabe <reijiw@google.com>
Link: https://lore.kernel.org/r/20221113163832.3154370-6-maz@kernel.org
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r-- | arch/arm64/kvm/pmu-emul.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c index d050143326b5..9e6bc7edc4de 100644 --- a/arch/arm64/kvm/pmu-emul.c +++ b/arch/arm64/kvm/pmu-emul.c @@ -417,7 +417,8 @@ static void kvm_pmu_counter_increment(struct kvm_vcpu *vcpu, reg = lower_32_bits(reg); __vcpu_sys_reg(vcpu, PMEVCNTR0_EL0 + i) = reg; - if (reg) /* No overflow? move on */ + /* No overflow? move on */ + if (kvm_pmu_idx_has_64bit_overflow(vcpu, i) ? reg : lower_32_bits(reg)) continue; /* Mark overflow */ |