qemu/tests/tcg
Peter Maydell 49727560c7 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>
(cherry picked from commit 8d37a1425b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2023-12-05 12:32:36 +03:00
..
aarch64 target/arm: Handle overflow in calculation of next timer tick 2023-12-05 12:32:36 +03:00
alpha tests/tcg/alpha: Add test for cvttq 2023-07-01 08:26:54 +02:00
arm tests/tcg: Add -fno-stack-protector 2023-11-01 12:59:22 +03:00
cris tests/tcg: Add -fno-stack-protector 2023-11-01 12:59:22 +03:00
hexagon tests/tcg: Add -fno-stack-protector 2023-11-01 12:59:22 +03:00
hppa tests/tcg: limit the scope of the plugin tests 2023-04-27 14:58:23 +01:00
i386 tests/tcg: Add -fno-stack-protector 2023-11-01 12:59:22 +03:00
loongarch64 target/loongarch: Remove cpu_fcsr0 2022-08-08 19:42:53 -07:00
m68k tests/tcg/m68k: Add trap.c 2022-06-02 09:35:03 +02:00
minilib tests/tcg: Add -fno-stack-protector 2023-11-01 12:59:22 +03:00
mips tests/tcg: Add -fno-stack-protector 2023-11-01 12:59:22 +03:00
multiarch tests/tcg: Disable filename test for info proc mappings 2023-08-09 07:19:41 -07:00
nios2 tests/tcg/nios2: Tweak 10m50-ghrd.ld 2022-10-31 20:37:58 +00:00
openrisc
ppc
ppc64 tests/multiarch: Add test-aes 2023-07-08 07:30:17 +01:00
ppc64le tests/tcg: unify ppc64 and ppc64le Makefiles 2022-10-06 11:53:40 +01:00
riscv64 riscv: Add support for the Zfa extension 2023-07-10 22:29:20 +10:00
s390x tests/tcg/s390x: Test LAALG with negative cc_src 2023-11-19 21:15:06 +03:00
sh4 tests/tcg: re-enable threadcount for sh4 2022-10-31 20:37:59 +00:00
sparc64 tests/tcg/sparc64: Re-enable linux-test 2021-05-15 21:43:23 +02:00
tricore target/tricore: Fix RCPW/RRPW_INSERT insns for width = 0 2023-10-03 02:05:55 +03:00
x86_64 other architectures: spelling fixes 2023-07-25 17:14:07 +03:00
xtensa tests/tcg: limit the scope of the plugin tests 2023-04-27 14:58:23 +01:00
xtensaeb tests/tcg/xtensa: allow testing big-endian cores 2023-03-15 05:08:04 -07:00
Makefile.target tests/tcg: Add -fno-stack-protector 2023-11-01 12:59:22 +03:00
README Drop the deprecated lm32 target 2021-05-12 18:20:25 +02:00

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".