You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/hw/openrisc
Joel Holdsworth 3eb43aeb16 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>
1 day ago
..
Kconfig hw/char: Extract serial-mm 2 months ago
boot.c *: Add missing includes of qemu/error-report.h 2 years ago
cputimer.c hw/openrisc: Fixed undercounting of TTCR in continuous mode 1 day ago
meson.build meson: pick libfdt from common_ss when building target-specific files 7 months ago
openrisc_sim.c hw/openrisc/openrisc_sim: keep serial@90000000 as default 1 day ago
virt.c hw/char: Extract serial-mm 2 months ago