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

[Xen-changelog] [xen master] x86/HVM: fix processing of RTC REG_B writes



commit c2f79c464849e5f796aa9d1d0f26fe356abd1a1a
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu May 2 16:47:32 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu May 2 16:47:32 2013 +0200

    x86/HVM: fix processing of RTC REG_B writes
    
    We must store the new values before calling rtc_update_irq(), and we
    need to call rtc_timer_update() when PIE transitions from 0 to 1 (as we
    may have previously turned off the periodic timer due to the guest not
    reading REG_C, and hence may have to re-enable it in order to start
    IRQs getting delivered to the guest).
    
    Note that the timer is being kept running if PIE transitions from 1 to
    0, to match the behavior of keeping it running for a brief period of
    time if the guest doesn't clear PF in time (in order to avoid
    permanently destroying and re-creating the periodic timer).
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Tested-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> (FreeBSD guest)
    Reviewed-by: Tim Deegan <tim@xxxxxxx>
---
 xen/arch/x86/hvm/rtc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index 26ab12c..b728d5e 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -468,12 +468,14 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, 
uint32_t data)
             if ( orig & RTC_SET )
                 rtc_set_time(s);
         }
+        s->hw.cmos_data[RTC_REG_B] = data;
         /*
          * If the interrupt is already set when the interrupt becomes
          * enabled, raise an interrupt immediately.
          */
         rtc_update_irq(s);
-        s->hw.cmos_data[RTC_REG_B] = data;
+        if ( (data & RTC_PIE) && !(orig & RTC_PIE) )
+            rtc_timer_update(s);
         if ( (data ^ orig) & RTC_SET )
             check_update_timer(s);
         if ( (data ^ orig) & (RTC_24H | RTC_DM_BINARY | RTC_SET) )
--
generated by git-patchbot for /home/xen/git/xen.git#master

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