Skip to contentSkip to conversation

RTC_UIE/RTC_SET fix

PATCH New Trolle Selander 1 participant 1 message Nov 16, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RTC_UIE/RTC_SET fix

This patch fixes a bug in the RTC code which appears to originate in having written the emuated device following an incorrect specification. VMware has (or had, at least, at the time we were still testing on both VMWare and Xen) the same issue. In the current code, when RTC_SET is set, RTC_UIE is cleared. This does not match the behavior of real hardware, where the case is simply that no update ended interrupts are sent as long as RTC_SET is set, but the UE ints will resume as soon as RTC_SET is cleared and the clock update is done. This little patch fixes this issue. In practicality, this means OS/2 can now set the time without having the clock stop. I don't know if any other guests have been affected by this issue.

xen/arch/x86/hvm/rtc.c +1 -2
diff -uNr xen-unstable.hg-orig/xen/arch/x86/hvm/rtc.c xen-unstable.hg-rtcfix/xen/arch/x86/hvm/rtc.c
@@ -128,7 +128,6 @@
         {
             /* set mode: reset UIP mode */
             s->hw.cmos_data[RTC_REG_A] &= ~RTC_UIP;
-            data &= ~RTC_UIE;
         }
         else
         {
@@ -350,7 +349,7 @@
     }
 
     /* update ended interrupt */
-    if ( s->hw.cmos_data[RTC_REG_B] & RTC_UIE )
+    if ( ( s->hw.cmos_data[RTC_REG_B] & RTC_UIE ) && !(s->hw.cmos_data[RTC_REG_B] & RTC_SET) )
     {
         s->hw.cmos_data[RTC_REG_C] |= 0x90; 
         hvm_isa_irq_deassert(d, RTC_IRQ);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel