ia64/xen-unstable

changeset 16688:4fcc8b64c2b5

x86: Fixes for S3 suspend resume:
- Fix wallclock resume by remembering the offset from CMOS time to
UTC time
- Restore dom0's CPU affinity (lost during
continue_hypercall_on_cpu())

Signed-off-by: Xu Dongxiao <dongxiao.xu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 08 10:13:11 2008 +0000 (2008-01-08)
parents 25771a7c2907
children 66db23ecd562
files xen/arch/x86/domain.c xen/arch/x86/time.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Tue Jan 08 09:57:59 2008 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Tue Jan 08 10:13:11 2008 +0000
     1.3 @@ -1420,6 +1420,7 @@ static void continue_hypercall_on_cpu_he
     1.4      regs->eax = info->func(info->data);
     1.5  
     1.6      v->arch.schedule_tail = info->saved_schedule_tail;
     1.7 +    v->cpu_affinity = info->saved_affinity;
     1.8      v->arch.continue_info = NULL;
     1.9  
    1.10      xfree(info);
     2.1 --- a/xen/arch/x86/time.c	Tue Jan 08 09:57:59 2008 +0000
     2.2 +++ b/xen/arch/x86/time.c	Tue Jan 08 10:13:11 2008 +0000
     2.3 @@ -971,8 +971,14 @@ unsigned long get_localtime(struct domai
     2.4          + d->time_offset_seconds;
     2.5  }
     2.6  
     2.7 +/* "cmos_utc_offset" is the difference between UTC time and CMOS time. */
     2.8 +static long cmos_utc_offset; /* in seconds */
     2.9 +
    2.10  int time_suspend(void)
    2.11  {
    2.12 +    cmos_utc_offset = (wc_sec + (wc_nsec + NOW()) / 1000000000ULL)
    2.13 +        - get_cmos_time();
    2.14 +
    2.15      /* Better to cancel calibration timer for accuracy. */
    2.16      kill_timer(&this_cpu(cpu_time).calibration_timer);
    2.17  
    2.18 @@ -986,7 +992,8 @@ int time_resume(void)
    2.19      set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);
    2.20  
    2.21      resume_platform_timer();
    2.22 -    do_settime(get_cmos_time(), 0, read_platform_stime());
    2.23 +
    2.24 +    do_settime(get_cmos_time() + cmos_utc_offset, 0, read_platform_stime());
    2.25  
    2.26      init_percpu_time();
    2.27