FreeBSD kernel /amd64 XEN device code
|
A timer driver for the Xen hypervisor's PV clock. More...
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/time.h>
#include <sys/timetc.h>
#include <sys/timeet.h>
#include <sys/smp.h>
#include <sys/limits.h>
#include <sys/clock.h>
#include <sys/proc.h>
#include <xen/xen-os.h>
#include <xen/features.h>
#include <xen/xen_intr.h>
#include <xen/hypervisor.h>
#include <contrib/xen/io/xenbus.h>
#include <contrib/xen/vcpu.h>
#include <xen/error.h>
#include <machine/cpu.h>
#include <machine/cpufunc.h>
#include <machine/clock.h>
#include <machine/_inttypes.h>
#include <machine/smp.h>
#include <machine/pvclock.h>
#include <dev/xen/timer/timer.h>
#include "clock_if.h"
Go to the source code of this file.
Data Structures | |
struct | xentimer_pcpu_data |
struct | xentimer_softc |
Macros | |
#define | NSEC_IN_SEC 1000000000ULL |
#define | NSEC_IN_USEC 1000ULL |
#define | FRAC_IN_NSEC 18446744073LL |
#define | XENTIMER_MIN_PERIOD_IN_NSEC 100*NSEC_IN_USEC |
#define | XENCLOCK_RESOLUTION 1 |
#define | XENTIMER_QUALITY 950 |
#define | XTREQUIRES(condition, reason...) |
Functions | |
__FBSDID ("$FreeBSD$") | |
DPCPU_DEFINE (struct xentimer_pcpu_data, xentimer_pcpu) | |
DPCPU_DECLARE (struct vcpu_info *, vcpu_info) | |
static void | xentimer_identify (driver_t *driver, device_t parent) |
static int | xentimer_probe (device_t dev) |
static uint64_t | xen_fetch_vcpu_time (struct vcpu_info *vcpu) |
Get the current time, in nanoseconds, since the hypervisor booted. More... | |
static uint32_t | xentimer_get_timecount (struct timecounter *tc) |
static void | xen_fetch_wallclock (struct timespec *ts) |
Fetch the hypervisor boot time, known as the "Xen wallclock". More... | |
static void | xen_fetch_uptime (struct timespec *ts) |
static int | xentimer_settime (device_t dev __unused, struct timespec *ts) |
static int | xentimer_gettime (device_t dev, struct timespec *ts) |
Return current time according to the Xen Hypervisor wallclock. More... | |
static int | xentimer_intr (void *arg) |
Handle a timer interrupt for the Xen PV timer driver. More... | |
static int | xentimer_vcpu_start_timer (int vcpu, uint64_t next_time) |
static int | xentimer_vcpu_stop_timer (int vcpu) |
static int | xentimer_et_start (struct eventtimer *et, sbintime_t first, sbintime_t period) |
Set the next oneshot time for the current CPU. More... | |
static int | xentimer_et_stop (struct eventtimer *et) |
Cancel the event timer's currently running timer, if any. More... | |
static int | xentimer_attach (device_t dev) |
Attach a Xen PV timer driver instance. More... | |
static int | xentimer_detach (device_t dev) |
static void | xentimer_percpu_resume (void *arg) |
static int | xentimer_resume (device_t dev) |
static int | xentimer_suspend (device_t dev) |
void | xen_clock_init (void) |
void | xen_delay (int n) |
DRIVER_MODULE (xentimer, xenpv, xentimer_driver, xentimer_devclass, 0, 0) | |
MODULE_DEPEND (xentimer, xenpv, 1, 1, 1) | |
Variables | |
static devclass_t | xentimer_devclass |
static device_method_t | xentimer_methods [] |
static driver_t | xentimer_driver |
A timer driver for the Xen hypervisor's PV clock.
Definition in file timer.c.
#define XENTIMER_MIN_PERIOD_IN_NSEC 100*NSEC_IN_USEC |
#define XTREQUIRES | ( | condition, | |
reason... | |||
) |
__FBSDID | ( | "$FreeBSD$" | ) |
DPCPU_DECLARE | ( | struct vcpu_info * | , |
vcpu_info | |||
) |
DPCPU_DEFINE | ( | struct xentimer_pcpu_data | , |
xentimer_pcpu | |||
) |
DRIVER_MODULE | ( | xentimer | , |
xenpv | , | ||
xentimer_driver | , | ||
xentimer_devclass | , | ||
0 | , | ||
0 | |||
) |
MODULE_DEPEND | ( | xentimer | , |
xenpv | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
void xen_delay | ( | int | n | ) |
Definition at line 523 of file timer.c.
References NSEC_IN_USEC, and xen_fetch_vcpu_time().
|
static |
Definition at line 209 of file timer.c.
References NSEC_IN_SEC, and xen_fetch_vcpu_time().
Referenced by xentimer_gettime().
|
static |
Get the current time, in nanoseconds, since the hypervisor booted.
vcpu | vcpu_info structure to fetch the time from. |
Definition at line 162 of file timer.c.
Referenced by xen_delay(), xen_fetch_uptime(), xentimer_et_start(), xentimer_get_timecount(), xentimer_intr(), and xentimer_settime().
|
static |
Fetch the hypervisor boot time, known as the "Xen wallclock".
ts | Timespec to store the current stable value. |
version | Pointer to store the corresponding wallclock version. |
Definition at line 198 of file timer.c.
Referenced by xentimer_gettime().
|
static |
Attach a Xen PV timer driver instance.
dev | Bus device object to attach. |
Definition at line 371 of file timer.c.
References xentimer_softc::dev, xentimer_softc::et, xentimer_pcpu_data::irq_handle, NSEC_IN_SEC, xentimer_softc::tc, XENCLOCK_RESOLUTION, xentimer_et_start(), xentimer_et_stop(), xentimer_get_timecount(), xentimer_intr(), XENTIMER_MIN_PERIOD_IN_NSEC, and XENTIMER_QUALITY.
|
static |
Set the next oneshot time for the current CPU.
et | Xen timer driver event timer to schedule on. |
first | Delta to the next time to schedule the interrupt for. |
period | Not used. |
Definition at line 319 of file timer.c.
References xentimer_softc::dev, xentimer_softc::et, NSEC_IN_SEC, xentimer_pcpu_data::timer, xen_fetch_vcpu_time(), and xentimer_vcpu_start_timer().
Referenced by xentimer_attach(), and xentimer_percpu_resume().
|
static |
Cancel the event timer's currently running timer, if any.
Definition at line 353 of file timer.c.
References xentimer_pcpu_data::timer, and xentimer_vcpu_stop_timer().
Referenced by xentimer_attach().
|
static |
Definition at line 172 of file timer.c.
References xen_fetch_vcpu_time().
Referenced by xentimer_attach().
|
static |
Return current time according to the Xen Hypervisor wallclock.
dev | Xentimer device. |
ts | Pointer to store the wallclock time. |
Definition at line 258 of file timer.c.
References xen_fetch_uptime(), and xen_fetch_wallclock().
|
static |
Definition at line 106 of file timer.c.
References xentimer_devclass.
|
static |
Handle a timer interrupt for the Xen PV timer driver.
arg | Xen timer driver softc that is expecting the interrupt. |
Definition at line 276 of file timer.c.
References xentimer_softc::et, xentimer_pcpu_data::last_processed, xentimer_pcpu_data::timer, and xen_fetch_vcpu_time().
Referenced by xentimer_attach().
|
static |
Definition at line 461 of file timer.c.
References xentimer_softc::dev, xentimer_softc::et, and xentimer_et_start().
Referenced by xentimer_resume().
|
static |
Definition at line 119 of file timer.c.
References XTREQUIRES.
|
static |
Definition at line 470 of file timer.c.
References xentimer_softc::dev, and xentimer_percpu_resume().
|
static |
Definition at line 220 of file timer.c.
References xen_fetch_vcpu_time().
|
static |
Definition at line 289 of file timer.c.
Referenced by xentimer_et_start().
|
static |
Definition at line 300 of file timer.c.
Referenced by xentimer_et_stop().
|
static |
Definition at line 71 of file timer.c.
Referenced by xentimer_identify().
|
static |
|
static |