diff options
author | Jeremy Fitzhardinge <jeremy@xensource.com> | 2007-07-17 21:37:05 -0400 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy@goop.org> | 2007-07-18 11:47:43 -0400 |
commit | 15c84731d647c34d1491793fa6be96f5de3432eb (patch) | |
tree | 861d2e6864e87a5860e0998395a65eb977e5b721 /arch/i386/xen/enlighten.c | |
parent | e46cdb66c8fc1c8d61cfae0f219ff47ac4b9d531 (diff) |
xen: time implementation
Xen maintains a base clock which measures nanoseconds since system
boot. This is provided to guests via a shared page which contains a
base time in ns, a tsc timestamp at that point and tsc frequency
parameters. Guests can compute the current time by reading the tsc
and using it to extrapolate the current time from the basetime. The
hypervisor makes sure that the frequency parameters are updated
regularly, paricularly if the tsc changes rate or stops.
This is implemented as a clocksource, so the interface to the rest of
the kernel is a simple clocksource which simply returns the current
time directly in nanoseconds.
Xen also provides a simple timer mechanism, which allows a timeout to
be set in the future. When that time arrives, a timer event is sent
to the guest. There are two timer interfaces:
- An old one which also delivers a stream of (unused) ticks at 100Hz,
and on the same event, the actual timer events. The 100Hz ticks
cause a lot of spurious wakeups, but are basically harmless.
- The new timer interface doesn't have the 100Hz ticks, and can also
fail if the specified time is in the past.
This code presents the Xen timer as a clockevent driver, and uses the
new interface by preference.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/i386/xen/enlighten.c')
-rw-r--r-- | arch/i386/xen/enlighten.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/i386/xen/enlighten.c b/arch/i386/xen/enlighten.c index 6417dfdccb4c..25eb3592f11d 100644 --- a/arch/i386/xen/enlighten.c +++ b/arch/i386/xen/enlighten.c | |||
@@ -609,6 +609,12 @@ static const struct paravirt_ops xen_paravirt_ops __initdata = { | |||
609 | .arch_setup = xen_arch_setup, | 609 | .arch_setup = xen_arch_setup, |
610 | .init_IRQ = xen_init_IRQ, | 610 | .init_IRQ = xen_init_IRQ, |
611 | 611 | ||
612 | .time_init = xen_time_init, | ||
613 | .set_wallclock = xen_set_wallclock, | ||
614 | .get_wallclock = xen_get_wallclock, | ||
615 | .get_cpu_khz = xen_cpu_khz, | ||
616 | .sched_clock = xen_clocksource_read, | ||
617 | |||
612 | .cpuid = xen_cpuid, | 618 | .cpuid = xen_cpuid, |
613 | 619 | ||
614 | .set_debugreg = xen_set_debugreg, | 620 | .set_debugreg = xen_set_debugreg, |