aboutsummaryrefslogtreecommitdiff
path: root/qemu-keymap.c
diff options
context:
space:
mode:
authorJoel Holdsworth <jholdsworth@nvidia.com>2024-06-07 15:29:33 -0700
committerStafford Horne <shorne@gmail.com>2024-12-03 10:59:25 +0000
commit3eb43aeb164f1f83c97ff693c7d464b49755110c (patch)
tree610ee4e06705e4716197555d68b254fffe809ed5 /qemu-keymap.c
parent26dcf2be7e153defa289d20317707af034aca692 (diff)
downloadqemu-3eb43aeb164f1f83c97ff693c7d464b49755110c.zip
qemu-3eb43aeb164f1f83c97ff693c7d464b49755110c.tar.gz
qemu-3eb43aeb164f1f83c97ff693c7d464b49755110c.tar.bz2
hw/openrisc: Fixed undercounting of TTCR in continuous mode
In the existing design, TTCR is prone to undercounting when running in continuous mode. This manifests as a timer interrupt appearing to trigger a few cycles prior to the deadline set in SPR_TTMR_TP. When the timer triggers, the virtual time delta in nanoseconds between the time when the timer was set, and when it triggers is calculated. This nanoseconds value is then divided by TIMER_PERIOD (50) to compute an increment of cycles to apply to TTCR. However, this calculation rounds down the number of cycles causing the undercounting. A simplistic solution would be to instead round up the number of cycles, however this will result in the accumulation of timing error over time. This patch corrects the issue by calculating the time delta in nanoseconds between when the timer was last reset and the timer event. This approach allows the TTCR value to be rounded up, but without accumulating error over time. Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com> [stafford: Incremented version in vmstate_or1k_timer, checkpatch fixes] Signed-off-by: Stafford Horne <shorne@gmail.com>
Diffstat (limited to 'qemu-keymap.c')
0 files changed, 0 insertions, 0 deletions