qemu-e2k/tests/tcg
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
..
aarch64 target/arm: Handle overflow in calculation of next timer tick 2023-11-27 15:27:36 +00:00
alpha
arm tests/tcg: enable semiconsole test for Arm 2023-11-23 14:10:06 +00:00
cris tests/tcg: Add -fno-stack-protector 2023-10-31 13:28:19 +00:00
hexagon tests/tcg: Add -fno-stack-protector 2023-10-31 13:28:19 +00:00
hppa
i386 tests/tcg: Add -fno-stack-protector 2023-10-31 13:28:19 +00:00
loongarch64
m68k
minilib tests/tcg: Add -fno-stack-protector 2023-10-31 13:28:19 +00:00
mips tests/tcg: Add -fno-stack-protector 2023-10-31 13:28:19 +00:00
multiarch tests/tcg: finesse the registers check for "hidden" regs 2023-11-23 14:10:06 +00:00
nios2 Revert "tests/tcg/nios2: Re-enable linux-user tests" 2023-11-08 15:15:23 +00:00
openrisc
ppc
ppc64 tests/tcg: finesse the registers check for "hidden" regs 2023-11-23 14:10:06 +00:00
ppc64le
riscv64
s390x tests/tcg: finesse the registers check for "hidden" regs 2023-11-23 14:10:06 +00:00
sh4
sparc64
tricore
x86_64
xtensa
xtensaeb
Makefile.target tests/tcg: Add -fno-stack-protector 2023-10-31 13:28:19 +00:00
README

This directory contains various interesting guest programs for
regression testing. Tests are either multi-arch, meaning they can be
built for all guest architectures that support linux-user executable,
or they are architecture specific.

CRIS
====
The testsuite for CRIS is in tests/tcg/cris.  You can run it
with "make test-cris".