On 12/15/20 4:09 PM, Peter Maydell wrote: > This patchseries makes some changes to the clock API: > * Remove clock_get_ns() > * Add clock_ticks_to_ns() to return number of nanoseconds > it will take the clock to tick N times > * clock_display_freq() to return prettily-formatted string > for showing humans the approximate clock frequency > > This is based on discussions we had about these APIs a little while > back. The core driver here is that the clock objects internally > store the period in units of 2^-32 ns, so both clock_get_ns() and > clock_get_hz() are inherently returning a rounded-off result, which > can be badly inaccurate for fast clocks or if you want to multiply it > by a large tick count. > > Ideally I'd like to get rid of clock_get_hz() as well, but > that looks trickier than handling clock_get_ns(). > > Patch 4 borrows a lot of the concept from one of Philippe's that he > sent out previously. > > NB: tested with 'make check' and 'make check-acceptance' only.
Tested using loongson3-virt @2GHz https://lists.gnu.org/archive/html/qemu-devel/2020-12/msg04036.html Without your series: qemu-system-mips64el: target/mips/cpu.c:385: mips_cp0_period_set: Assertion `env->cp0_count_ns' failed. Aborted (core dumped) With: OK (cpu are not displayed in 'info qtree). Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> Thanks! Phil.