]> 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)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 7 Mar 2025 10:08:19 +0000 (10:08 +0000)
commitdb6c2192839ee0282d38f6f6666a87e0629fcd13
tree13f0b3938cd3a689682a40d2be8d2c76e7a950c6
parent5f6b9b0564b69bd9548860419a70e79579d64aeb
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
target/arm/helper.c