direct-io.hg
changeset 14289:345effaf2258
[xen] Update the hvm rtc clock state if the domain's time offset is changed.
The settimeoffset domctl had no effect on hvm domains since the offset
was only read in rtc_init which is done when the domain is created.
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
The settimeoffset domctl had no effect on hvm domains since the offset
was only read in rtc_init which is done when the domain is created.
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author | Christian Limpach <Christian.Limpach@xensource.com> |
---|---|
date | Thu Mar 08 15:51:32 2007 +0000 (2007-03-08) |
parents | 7e2f7e8b63d3 |
children | f78b4aad353e |
files | xen/arch/x86/hvm/rtc.c xen/include/asm-x86/hvm/vpt.h |
line diff
1.1 --- a/xen/arch/x86/hvm/rtc.c Thu Mar 08 15:35:28 2007 +0000 1.2 +++ b/xen/arch/x86/hvm/rtc.c Thu Mar 08 15:51:32 2007 +0000 1.3 @@ -174,6 +174,11 @@ static void rtc_copy_date(RTCState *s) 1.4 { 1.5 const struct tm *tm = &s->current_tm; 1.6 1.7 + if (s->time_offset_seconds != s->pt.vcpu->domain->time_offset_seconds) { 1.8 + s->current_tm = gmtime(get_localtime(s->pt.vcpu->domain)); 1.9 + s->time_offset_seconds = s->pt.vcpu->domain->time_offset_seconds; 1.10 + } 1.11 + 1.12 s->hw.cmos_data[RTC_SECONDS] = to_bcd(s, tm->tm_sec); 1.13 s->hw.cmos_data[RTC_MINUTES] = to_bcd(s, tm->tm_min); 1.14 if ( s->hw.cmos_data[RTC_REG_B] & RTC_24H ) 1.15 @@ -211,10 +216,16 @@ static int get_days_in_month(int month, 1.16 } 1.17 1.18 /* update 'tm' to the next second */ 1.19 -static void rtc_next_second(struct tm *tm) 1.20 +static void rtc_next_second(RTCState *s) 1.21 { 1.22 + struct tm *tm = &s->current_tm; 1.23 int days_in_month; 1.24 1.25 + if (s->time_offset_seconds != s->pt.vcpu->domain->time_offset_seconds) { 1.26 + s->current_tm = gmtime(get_localtime(s->pt.vcpu->domain)); 1.27 + s->time_offset_seconds = s->pt.vcpu->domain->time_offset_seconds; 1.28 + } 1.29 + 1.30 tm->tm_sec++; 1.31 if ((unsigned)tm->tm_sec >= 60) { 1.32 tm->tm_sec = 0; 1.33 @@ -258,7 +269,7 @@ static void rtc_update_second(void *opaq 1.34 } 1.35 else 1.36 { 1.37 - rtc_next_second(&s->current_tm); 1.38 + rtc_next_second(s); 1.39 1.40 if ( !(s->hw.cmos_data[RTC_REG_B] & RTC_SET) ) 1.41 s->hw.cmos_data[RTC_REG_A] |= RTC_UIP;
2.1 --- a/xen/include/asm-x86/hvm/vpt.h Thu Mar 08 15:35:28 2007 +0000 2.2 +++ b/xen/include/asm-x86/hvm/vpt.h Thu Mar 08 15:51:32 2007 +0000 2.3 @@ -92,6 +92,7 @@ typedef struct RTCState { 2.4 struct timer second_timer; 2.5 struct timer second_timer2; 2.6 struct periodic_time pt; 2.7 + int32_t time_offset_seconds; 2.8 } RTCState; 2.9 2.10 #define FREQUENCE_PMTIMER 3579545 /* Timer should run at 3.579545 MHz */