aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-01-08 10:13:11 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-01-08 10:13:11 +0000
commitd3f057861094611207862770fac4dcc6a140dd1e (patch)
treeb57f3ddb27a3da08db7961b912e82929de668cc7
parentc741a6246754635ac808b74ee5b0bd51bdfccaa8 (diff)
downloadxen-d3f057861094611207862770fac4dcc6a140dd1e.tar.gz
xen-d3f057861094611207862770fac4dcc6a140dd1e.tar.bz2
xen-d3f057861094611207862770fac4dcc6a140dd1e.zip
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>
-rw-r--r--xen/arch/x86/domain.c1
-rw-r--r--xen/arch/x86/time.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 588a7fb1f7..957e33ef57 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1420,6 +1420,7 @@ static void continue_hypercall_on_cpu_helper(struct vcpu *v)
regs->eax = info->func(info->data);
v->arch.schedule_tail = info->saved_schedule_tail;
+ v->cpu_affinity = info->saved_affinity;
v->arch.continue_info = NULL;
xfree(info);
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a9e2b5b735..6d4946245b 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -971,8 +971,14 @@ unsigned long get_localtime(struct domain *d)
+ d->time_offset_seconds;
}
+/* "cmos_utc_offset" is the difference between UTC time and CMOS time. */
+static long cmos_utc_offset; /* in seconds */
+
int time_suspend(void)
{
+ cmos_utc_offset = (wc_sec + (wc_nsec + NOW()) / 1000000000ULL)
+ - get_cmos_time();
+
/* Better to cancel calibration timer for accuracy. */
kill_timer(&this_cpu(cpu_time).calibration_timer);
@@ -986,7 +992,8 @@ int time_resume(void)
set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);
resume_platform_timer();
- do_settime(get_cmos_time(), 0, read_platform_stime());
+
+ do_settime(get_cmos_time() + cmos_utc_offset, 0, read_platform_stime());
init_percpu_time();