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

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



commit 9b372d46426ca5bfd4b428132455ef83b1f8892c
Author:     Tim Deegan <tim@xxxxxxx>
AuthorDate: Tue Feb 12 13:39:30 2013 +0100
Commit:     Tim Deegan <tim@xxxxxxx>
CommitDate: Tue Feb 12 13:39:30 2013 +0100

    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>
    xen-unstable changeset: 26428:9e8c39bdc1fe
    xen-unstable date: Fri Jan 18 11:31:57 UTC 2013
---
 xen/arch/x86/hvm/rtc.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index ea5179a..b994e99 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -399,10 +399,17 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, 
uint32_t data)
     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:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
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®.