summaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/time.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2010-03-26 19:21:22 +0100
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2011-09-26 20:04:39 +0200
commitfdb9eb9f155bfc0f8dc2fc88f90448b30c78ad97 (patch)
treea15dbe3b58afcbe3b0b947e8aa9bf272597380f1 /arch/x86/xen/time.c
parentxen: add dom0_op hypercall (diff)
downloadlinux-fdb9eb9f155bfc0f8dc2fc88f90448b30c78ad97.tar.xz
linux-fdb9eb9f155bfc0f8dc2fc88f90448b30c78ad97.zip
xen/dom0: set wallclock time in Xen
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'arch/x86/xen/time.c')
-rw-r--r--arch/x86/xen/time.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 5158c505bef9..8c9cdfa24657 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -200,8 +200,22 @@ static unsigned long xen_get_wallclock(void)
static int xen_set_wallclock(unsigned long now)
{
+ struct xen_platform_op op;
+ int rc;
+
/* do nothing for domU */
- return -1;
+ if (!xen_initial_domain())
+ return -1;
+
+ op.cmd = XENPF_settime;
+ op.u.settime.secs = now;
+ op.u.settime.nsecs = 0;
+ op.u.settime.system_time = xen_clocksource_read();
+
+ rc = HYPERVISOR_dom0_op(&op);
+ WARN(rc != 0, "XENPF_settime failed: now=%ld\n", now);
+
+ return rc;
}
static struct clocksource xen_clocksource __read_mostly = {