]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/arm: Apply correct timer offset when calculating deadlines
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 7 Mar 2025 10:08:19 +0000 (10:08 +0000)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 18 Mar 2025 06:02:47 +0000 (09:02 +0300)
commitcefb009762737577b65da9304a0e91ed9df213b0
treeeb13c057087cc49f451734007fd8e16389b3c5e5
parent413f7ba6a863dd341a05efcd21ea06990bb43355
target/arm: Apply correct timer offset when calculating deadlines

When we are calculating timer deadlines, the correct definition of
whether or not to apply an offset to the physical count is described
in the Arm ARM DDI4087 rev L.a section D12.2.4.1.  This is different
from when the offset should be applied for a direct read of the
counter sysreg.

We got this right for the EL1 physical timer and for the EL1 virtual
timer, but got all the rest wrong: they should be using a zero offset
always.

Factor the offset calculation out into a function that has a comment
documenting exactly which offset it is calculating and which gets the
HYP, SEC, and HYPVIRT cases right.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20250204125009.2281315-2-peter.maydell@linaro.org
(cherry picked from commit db6c2192839ee0282d38f6f6666a87e0629fcd13)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/arm/helper.c