On 7/31/20 12:09 AM, Paolo Bonzini wrote: > On 30/07/20 18:33, Claudio Fontana wrote: >> One problem I noticed is that qemu_clock_get_ns is util/qemu-timer.c, >> which is tools _and_ softmmu, while I tried to extract the >> softmmu-only timer code in softmmu/cpu-timers.c, > > Not all of it, only the VIRTUAL clock which is > > if (use_icount) { > return cpu_get_icount(); > } else { > return cpu_get_clock(); > } > > and would be changed to something like > > return cpu_get_virtual_clock(); > > In turn cpu_get_virtual_clock() is > > return (accel_ops->cpu_get_virtual clock ?: cpu_get_clock)(); > > in the emulators, plus a stub that replaces stubs/cpu-get-icount.c and > is just > > return get_clock_realtime(); > > as in stubs/cpu-get-clock.c. > > Paolo > >
works, hooking up cpu_get_ticks() also works. qemu_start_warp_timer seems to make sense only for tcg/icount and not for qtest, which directly sets and warps the clock, is that right? Would you want a start_warp_timer cpu accel interface that is actually useful only for tcg, to avoid if (icount_enabled()) { qemu_start_warp_timer()? } Thanks, Claudio