xen: enable settime in Xen dom0
Subsystems (3)
cover xen: enable settime in Xen dom0
From: Jeremy Fitzhardinge <[email protected]>
Proposed patch for the v3.2 merge window, but it should be probably be put into v3.0 and v3.1 stable branches too (but not important enough to burn any of my "Linus, merge this in late -rc karma").
This series implements the time-setting pvops for Xen dom0 so that a privileged kernel can set the system time via Xen. This had previously been a no-op, because upstream Linux only supported non-privieged operation, and so there was no point in trying to set the system time.
Also available at:
git://github.com/jsgf/linux-xen.git upstream/xen-settime
Thanks,
J
Jeremy Fitzhardinge (2):
xen: add dom0_op hypercall
xen/dom0: set wallclock time in Xen
Yu Ke (1):
xen/acpi: Domain0 acpi parser related platform hypercall
arch/ia64/include/asm/xen/interface.h | 1 + arch/x86/include/asm/xen/hypercall.h | 8 + arch/x86/include/asm/xen/interface.h | 1 + arch/x86/xen/time.c | 16 ++- include/xen/interface/platform.h | 320 +++++++++++++++++++++++++++++++++ include/xen/interface/xen.h | 1 + 6 files changed, 346 insertions(+), 1 deletions(-) create mode 100644 include/xen/interface/platform.h
Signature · 1 line
1.7.6.2
PATCH 1/3 xen/acpi: Domain0 acpi parser related platform hypercall
From: Yu Ke <[email protected]>
This patches implements the xen_platform_op hypercall, to pass the parsed ACPI info to hypervisor.
--- arch/ia64/include/asm/xen/interface.h | 1 + arch/x86/include/asm/xen/interface.h | 1 + include/xen/interface/platform.h | 320 +++++++++++++++++++++++++++++++++ include/xen/interface/xen.h | 1 + 4 files changed, 323 insertions(+), 0 deletions(-) create mode 100644 include/xen/interface/platform.h
arch/ia64/include/asm/xen/interface.h +1 -0
@@ -76,6 +76,7 @@ DEFINE_GUEST_HANDLE(char);DEFINE_GUEST_HANDLE (int);DEFINE_GUEST_HANDLE (long);DEFINE_GUEST_HANDLE (void); +DEFINE_GUEST_HANDLE (uint64_t);typedef unsigned long xen_pfn_t ;DEFINE_GUEST_HANDLE (xen_pfn_t);
arch/x86/include/asm/xen/interface.h +1 -0
@@ -55,6 +55,7 @@ DEFINE_GUEST_HANDLE(char);DEFINE_GUEST_HANDLE (int);DEFINE_GUEST_HANDLE (long);DEFINE_GUEST_HANDLE (void); +DEFINE_GUEST_HANDLE (uint64_t);#endif #ifndef HYPERVISOR_VIRT_START
include/xen/interface/platform.h new file +320 -0
320 lines not on this page · raw message
include/xen/interface/xen.h +1 -0
@@ -453,6 +453,7 @@ struct start_info {/* These flags are passed in the 'flags' field of start_info_t. */ #define SIF_PRIVILEGED (1<<0)/* Is the domain privileged? */ #define SIF_INITDOMAIN (1<<1)/* Is this the initial control domain? */ +#define SIF_PM_MASK (0xFF<<8)/* reserve 1 byte for xen-pm options */ typedef uint64_t cpumap_t ;
Signature · 1 line
1.7.6.2
Re: [Xen-devel] [PATCH 1/3] xen/acpi: Domain0 acpi parser related platform hypercall
Quoted 1 line · Jeremy Fitzhardinge
+#define
XENPF_INTERFACE_VERSION0x03000001
May I assume that this interface is now fixed at this value?
Bastian
Signature · 3 lines
It is a human characteristic to love little animals, especially if they're attractive in some way. -- McCoy, "The Trouble with Tribbles", stardate 4525.6
PATCH 2/3 xen: add dom0_op hypercall
In reply to Jeremy FitzhardingeFrom: Jeremy Fitzhardinge <[email protected]>
--- arch/x86/include/asm/xen/hypercall.h | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/x86/include/asm/xen/hypercall.h +8 -0
@@ -45,6 +45,7 @@#include <xen/interface/xen.h> #include <xen/interface/sched.h> #include <xen/interface/physdev.h> +#include <xen/interface/platform.h> /* * The hypercall asms have to meet several constraints:
@@ -299,6 +300,13 @@ HYPERVISOR_set_timer_op(u64 timeout) }static inline int +HYPERVISOR_dom0_op (struct xen_platform_op *platform_op) +{ + platform_op->interface_version =XENPF_INTERFACE_VERSION ; +return _hypercall1 (int, dom0_op, platform_op); +} + +static inline int HYPERVISOR_set_debugreg (int reg,unsigned long value) {return _hypercall2 (int, set_debugreg, reg, value);
Signature · 1 line
1.7.6.2
PATCH 3/3 xen/dom0: set wallclock time in Xen
In reply to Jeremy FitzhardingeFrom: Jeremy Fitzhardinge <[email protected]>
--- arch/x86/xen/time.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
arch/x86/xen/time.c +15 -1
@@ -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 = {
Signature · 1 line
1.7.6.2