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

[Xen-changelog] [xen-unstable] x86/hvm: fix RTC setting.


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 21 Jan 2013 22:33:14 +0000
  • Delivery-date: Mon, 21 Jan 2013 22:33:21 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1358508717 -3600
# Node ID 9e8c39bdc1fedd5dfc5aa7209cc5f77f813476c7
# Parent  8f6dd5dc5d6cdd56050ed917a0c30903bbddcbf0
x86/hvm: fix RTC setting.

When the guest writes one field of the RTC time, we must bring all the
other fields up to date for the current second before calculating the
new RTC time.

Signed-off-by: Tim Deegan <tim@xxxxxxx>
Tested-by: Phil Evans <Phil.Evans@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 8f6dd5dc5d6c -r 9e8c39bdc1fe xen/arch/x86/hvm/rtc.c
--- a/xen/arch/x86/hvm/rtc.c    Fri Jan 18 12:20:58 2013 +0100
+++ b/xen/arch/x86/hvm/rtc.c    Fri Jan 18 12:31:57 2013 +0100
@@ -399,10 +399,17 @@ static int rtc_ioport_write(void *opaque
     case RTC_DAY_OF_MONTH:
     case RTC_MONTH:
     case RTC_YEAR:
-        s->hw.cmos_data[s->hw.cmos_index] = data;
-        /* if in set mode, do not update the time */
-        if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_SET) )
+        /* if in set mode, just write the register */
+        if ( (s->hw.cmos_data[RTC_REG_B] & RTC_SET) )
+            s->hw.cmos_data[s->hw.cmos_index] = data;
+        else
+        {
+            /* Fetch the current time and update just this field. */
+            s->current_tm = gmtime(get_localtime(d));
+            rtc_copy_date(s);
+            s->hw.cmos_data[s->hw.cmos_index] = data;
             rtc_set_time(s);
+        }
         alarm_timer_update(s);
         break;
     case RTC_REG_A:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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