From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH 1/3] xen: sync the CMOS RTC as well as the Xen wallclock Date: Fri, 12 Oct 2012 17:13:24 +0100 Message-ID: <507841A4.8090108@citrix.com> References: <1350046634-2462-1-git-send-email-david.vrabel@citrix.com> <1350046634-2462-2-git-send-email-david.vrabel@citrix.com> <20121012145716.GA20842@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20121012145716.GA20842@phenom.dumpdata.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: Konrad Rzeszutek Wilk Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 12/10/12 15:57, Konrad Rzeszutek Wilk wrote: > On Fri, Oct 12, 2012 at 01:57:12PM +0100, David Vrabel wrote: >> 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); > > So how does this work? Is the hypervisor traping on the RTC CMOS clock? It's works the same as with the RTC driver. I think the hypervisor allows dom0 access to the relevant I/O ports. It's worth pointing out that mach_set_rtc_mmss() only sets the minutes and seconds so it doesn't handle big step changes which is why update_persistent_clock() is only called once NTP is synchronized. David