qemu-e2k/target/arm
Peter Maydell 8d37a1425b target/arm: Handle overflow in calculation of next timer tick
In commit edac4d8a16 back in 2015 when we added support for
the virtual timer offset CNTVOFF_EL2, we didn't correctly update
the timer-recalculation code that figures out when the timer
interrupt is next going to change state. We got it wrong in
two ways:
 * for the 0->1 transition, we didn't notice that gt->cval + offset
   can overflow a uint64_t
 * for the 1->0 transition, we didn't notice that the transition
   might now happen before the count rolls over, if offset > count

In the former case, we end up trying to set the next interrupt
for a time in the past, which results in QEMU hanging as the
timer fires continuously.

In the latter case, we would fail to update the interrupt
status when we are supposed to.

Fix the calculations in both cases.

The test case is Alex Bennée's from the bug report, and tests
the 0->1 transition overflow case.

Fixes: edac4d8a16 ("target-arm: Add CNTVOFF_EL2")
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/60
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20231120173506.3729884-1-peter.maydell@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2023-11-27 15:27:36 +00:00
..
hvf target/arm/hvf: Clean up local variable shadowing 2023-09-29 10:07:14 +02:00
tcg target/arm: Fix SME FMOPA (16-bit), BFMOPA 2023-11-20 15:17:00 +00:00
arch_dump.c target/arm: Move feature test functions to their own header 2023-10-27 11:44:32 +01:00
arm-powerctl.c target/arm/arm-powerctl: Correctly init CPUs when powered on to lower EL 2023-10-19 14:32:13 +01:00
arm-powerctl.h
arm-qmp-cmds.c target/arm: Implement FEAT_PACQARMA3 2023-09-08 12:50:44 +01:00
common-semi-target.h target/arm/common-semi-target.h: Remove unnecessary boot.h include 2023-10-19 14:32:13 +01:00
cortex-regs.c target/arm: Saturate L2CTLR_EL1 core count field rather than overflowing 2023-05-18 11:39:33 +01:00
cpregs.h target/arm: Apply access checks to neoverse-n1 special registers 2023-08-31 09:45:15 +01:00
cpu64.c target/arm: Move feature test functions to their own header 2023-10-27 11:44:32 +01:00
cpu-features.h linux-user/elfload: Add missing arm64 hwcap values 2023-11-02 12:52:06 +00:00
cpu-param.h target/arm: Replace TARGET_PAGE_ENTRY_EXTRA 2023-10-03 08:01:02 -07:00
cpu-qom.h target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
cpu.c hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name() 2023-11-07 13:08:48 +01:00
cpu.h target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
debug_helper.c target/arm: hide all versions of DBGD[RS]AR from gdbstub 2023-11-08 15:15:23 +00:00
gdbstub64.c target/arm: Correct AArch64.S2MinTxSZ 32-bit EL1 input size check 2023-05-12 16:01:25 +01:00
gdbstub.c target/arm: Move feature test functions to their own header 2023-10-27 11:44:32 +01:00
helper.c target/arm: Handle overflow in calculation of next timer tick 2023-11-27 15:27:36 +00:00
helper.h target/arm: Implement FEAT_TIDCP1 2023-09-08 16:41:35 +01:00
hvf_arm.h hvf: add guest debugging handlers for Apple Silicon hosts 2023-06-06 10:19:30 +01:00
hyp_gdbstub.c arm: move KVM breakpoints helpers 2023-06-06 10:19:29 +01:00
idau.h
internals.h target/arm: Move internal declarations from 'cpu-qom.h' to 'cpu.h' 2023-11-07 12:13:27 +01:00
Kconfig target/arm: Explain why we need to select ARM_V7M 2023-05-30 15:50:17 +01:00
kvm64.c target/arm: Move feature test functions to their own header 2023-10-27 11:44:32 +01:00
kvm_arm.h hw/intc/arm_gic: Un-inline GIC*/ITS class_name() helpers 2023-06-28 14:27:59 +02:00
kvm-consts.h target/arm: Remove KVM AArch32 CPU definitions 2023-04-20 10:21:15 +01:00
kvm-stub.c target/arm: Avoid bare abort() or assert(0) 2022-05-05 09:35:51 +01:00
kvm.c arm/kvm: convert to kvm_get_one_reg 2023-10-19 14:32:13 +01:00
machine.c target/arm: Move feature test functions to their own header 2023-10-27 11:44:32 +01:00
meson.build meson: Rename target_softmmu_arch -> target_system_arch 2023-10-07 19:03:07 +02:00
op_addsub.h
ptw.c target/arm: Correctly propagate stage 1 BTI guarded bit in a two-stage walk 2023-11-02 13:36:45 +00:00
syndrome.h target/arm: Set IL bit for pauth, SVE access, BTI trap syndromes 2023-11-27 14:50:13 +00:00
tcg-stubs.c target/arm: Move hflags code into the tcg directory 2023-02-27 13:27:04 +00:00
trace-events target/arm/helper: Implement CNTHCTL_EL2.CNT[VP]MASK 2023-08-22 17:31:13 +01:00
trace.h
vfp_helper.c target/arm: Move feature test functions to their own header 2023-10-27 11:44:32 +01:00