From: David Vrabel Subject: [PATCH 1/3] xen: sync the CMOS RTC as well as the Xen wallclock Date: Fri, 12 Oct 2012 13:57:12 +0100 Message-ID: <1350046634-2462-2-git-send-email-david.vrabel@citrix.com> References: <1350046634-2462-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1350046634-2462-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: David Vrabel , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org From: David Vrabel 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 --- 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 #include #include +#include #include #include @@ -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; -- 1.7.2.5