Blue Swirl wrote: > On Wed, Sep 9, 2009 at 6:11 PM, Jan Kiszka wrote: >> The aim of this series is to allow using the emulated PC RTC (MC146818) >> as a reliable time source for guests. This is particularly useful if the >> host runs NTP or has otherwise access to an accurate clock while the >> guest has not (no network, impossible to add an NTP implementation >> etc.). > > What I meant in the earlier thread is that m48t59 port read for time > or date gets the data directly from host using qemu_get_timedate(). > PC RTC instead uses a timer: the timer callback updates the cmos_data > structure. It seems that you just replace the timer with a new one. > I'd remove the timer altogether and change the cmos_ioport_read to > call qemu_get_timedate(). That was my first idea as well, but the timer is there to emulate real hardware behavior: Updates only take place while the UIP flag is set in register A, and they take a few hundred microseconds. Guests actually wait for this to happen and only read out after such a change. Moreover, updates can trigger interrupts. For sure one could avoid these update timers. But as they are so rare (1 HZ...), I didn't want to prematurely optimize the code here, risking regressions while trying to fix our problems. Jan