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). Signed-off-by: Jan Beulich --- 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 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) )