[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] xen: sync the CMOS RTC as well as the Xen wallclock

From: David Vrabel <david.vrabel@xxxxxxxxxx>

If NTP is used in dom0 and it is synchronized to its clock source,
then the kernel will periodically synchronize the Xen wallclock with
the system time.  Updates to the Xen wallclock do not persist across
reboots, so also synchronize the CMOS RTC (as on bare metal).

Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
 arch/x86/xen/time.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 0296a95..5e7f536 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -14,6 +14,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/math64.h>
 #include <linux/gfp.h>
+#include <linux/mc146818rtc.h>
 #include <asm/pvclock.h>
 #include <asm/xen/hypervisor.h>
@@ -208,6 +209,10 @@ static int xen_set_wallclock(unsigned long now)
        if (!xen_initial_domain())
                return -1;
+       /* Set the hardware RTC. */
+       mach_set_rtc_mmss(now);
+       /* Set the Xen wallclock. */
        op.cmd = XENPF_settime;
        op.u.settime.secs = now;
        op.u.settime.nsecs = 0;

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.