qemu/tests/tcg/aarch64
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
..
gdbstub tests/tcg: clean-up gdb confirm/pagination settings 2023-08-30 14:57:50 +01:00
system target/arm: Handle overflow in calculation of next timer tick 2023-11-27 15:27:36 +00:00
bti-1.c tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc 2023-08-31 19:47:43 +02:00
bti-2.c tests/tcg/aarch64: Add bti smoke tests 2020-10-27 10:44:03 +00:00
bti-3.c tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc 2023-08-31 19:47:43 +02:00
bti-crt.c.inc tests/tcg/aarch64: Rename bti-crt.inc.c -> bti-crt.c.inc 2023-08-31 19:47:43 +02:00
dcpodp.c tests/tcg/aarch64: add DC CVA[D]P tests 2023-06-06 10:19:40 +01:00
dcpop.c tests/tcg/aarch64: add DC CVA[D]P tests 2023-06-06 10:19:40 +01:00
fcvt.ref
float_convd.ref tests/tcg: add float_convd test 2022-04-20 16:04:20 +01:00
float_convs.ref
float_madds.ref
lse2-fault.c accel/tcg: Avoid reading too much in load_atom_{2,4} 2023-08-10 10:59:24 -07:00
Makefile.softmmu-target target/arm: Handle overflow in calculation of next timer tick 2023-11-27 15:27:36 +00:00
Makefile.target target/arm: Fix SVE STR increment 2023-11-02 13:36:45 +00:00
mte-1.c tests/tcg/aarch64: Add mte smoke tests 2021-02-16 13:17:28 +00:00
mte-2.c tests/tcg/aarch64: Add mte smoke tests 2021-02-16 13:17:28 +00:00
mte-3.c tests/tcg/aarch64: Add mte smoke tests 2021-02-16 13:17:28 +00:00
mte-4.c tests/tcg/aarch64: Add mte smoke tests 2021-02-16 13:17:28 +00:00
mte-5.c test/tcg/aarch64: Add mte-5 2021-04-30 11:16:49 +01:00
mte-6.c accel/tcg: Preserve PAGE_ANON when changing page permissions 2021-04-12 11:06:24 +01:00
mte-7.c tests/tcg/aarch64: Use stz2g in mte-7.c 2023-06-06 10:19:39 +01:00
mte.h accel/tcg: Preserve PAGE_ANON when changing page permissions 2021-04-12 11:06:24 +01:00
pauth-1.c tests/tcg/aarch64: Add newline in pauth-1 printf 2020-03-05 16:09:19 +00:00
pauth-2.c tests/tcg/aarch64: Adjust pauth tests for FEAT_FPAC 2023-09-08 12:50:44 +01:00
pauth-4.c tests/tcg/aarch64: Adjust pauth tests for FEAT_FPAC 2023-09-08 12:50:44 +01:00
pauth-5.c tests/tcg/aarch64: Adjust pauth tests for FEAT_FPAC 2023-09-08 12:50:44 +01:00
pauth.h tests/tcg/aarch64: Adjust pauth tests for FEAT_FPAC 2023-09-08 12:50:44 +01:00
pcalign-a64.c tests/tcg: Add arm and aarch64 pc alignment tests 2021-12-15 10:35:26 +00:00
semicall.h semihosting: move semihosting tests to multiarch 2021-03-24 14:25:03 +00:00
sme-outprod1.c arm: spelling fixes 2023-07-25 17:13:53 +03:00
sve-ioctls.c tests/tcg/aarch64: add SVE iotcl test 2020-03-17 17:38:47 +00:00
sve-str.c target/arm: Fix SVE STR increment 2023-11-02 13:36:45 +00:00
sysregs.c target/arm: Update user-mode ID reg mask values 2023-09-21 14:45:58 +01:00
test-826.c target/arm: Fix sve2 ldnt1 and stnt1 2022-03-18 10:55:15 +00:00
test-aes.c tests/multiarch: Add test-aes 2023-07-08 07:30:17 +01:00