ia64/xen-unstable

view xen/include/public/vcpu.h @ 9024:d0b7281556f2

New VCPUOP_register_runstate_memory_area hypercall. Avoids
need for a hypercall in the guest timer interrupt handler.

Cleaned up stolen/blocked tick handling in Linux.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Feb 25 21:28:27 2006 +0100 (2006-02-25)
parents 2303fb4682e7
children e99987843336
line source
1 /******************************************************************************
2 * vcpu.h
3 *
4 * VCPU initialisation, query, and hotplug.
5 *
6 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
7 */
9 #ifndef __XEN_PUBLIC_VCPU_H__
10 #define __XEN_PUBLIC_VCPU_H__
12 /*
13 * Prototype for this hypercall is:
14 * int vcpu_op(int cmd, int vcpuid, void *extra_args)
15 * @cmd == VCPUOP_??? (VCPU operation).
16 * @vcpuid == VCPU to operate on.
17 * @extra_args == Operation-specific extra arguments (NULL if none).
18 */
20 /*
21 * Initialise a VCPU. Each VCPU can be initialised only once. A
22 * newly-initialised VCPU will not run until it is brought up by VCPUOP_up.
23 *
24 * @extra_arg == pointer to vcpu_guest_context structure containing initial
25 * state for the VCPU.
26 */
27 #define VCPUOP_initialise 0
29 /*
30 * Bring up a VCPU. This makes the VCPU runnable. This operation will fail
31 * if the VCPU has not been initialised (VCPUOP_initialise).
32 */
33 #define VCPUOP_up 1
35 /*
36 * Bring down a VCPU (i.e., make it non-runnable).
37 * There are a few caveats that callers should observe:
38 * 1. This operation may return, and VCPU_is_up may return false, before the
39 * VCPU stops running (i.e., the command is asynchronous). It is a good
40 * idea to ensure that the VCPU has entered a non-critical loop before
41 * bringing it down. Alternatively, this operation is guaranteed
42 * synchronous if invoked by the VCPU itself.
43 * 2. After a VCPU is initialised, there is currently no way to drop all its
44 * references to domain memory. Even a VCPU that is down still holds
45 * memory references via its pagetable base pointer and GDT. It is good
46 * practise to move a VCPU onto an 'idle' or default page table, LDT and
47 * GDT before bringing it down.
48 */
49 #define VCPUOP_down 2
51 /* Returns 1 if the given VCPU is up. */
52 #define VCPUOP_is_up 3
54 /*
55 * Return information about the state and running time of a VCPU.
56 * @extra_arg == pointer to vcpu_runstate_info structure.
57 */
58 #define VCPUOP_get_runstate_info 4
59 typedef struct vcpu_runstate_info {
60 /* VCPU's current state (RUNSTATE_*). */
61 int state;
62 /* When was current state entered (system time, ns)? */
63 uint64_t state_entry_time;
64 /*
65 * Time spent in each RUNSTATE_* (ns). The sum of these times is
66 * guaranteed not to drift from system time.
67 */
68 uint64_t time[4];
69 } vcpu_runstate_info_t;
71 /* VCPU is currently running on a physical CPU. */
72 #define RUNSTATE_running 0
74 /* VCPU is runnable, but not currently scheduled on any physical CPU. */
75 #define RUNSTATE_runnable 1
77 /* VCPU is blocked (a.k.a. idle). It is therefore not runnable. */
78 #define RUNSTATE_blocked 2
80 /*
81 * VCPU is not runnable, but it is not blocked.
82 * This is a 'catch all' state for things like hotplug and pauses by the
83 * system administrator (or for critical sections in the hypervisor).
84 * RUNSTATE_blocked dominates this state (it is the preferred state).
85 */
86 #define RUNSTATE_offline 3
88 /*
89 * Register a shared memory area from which the guest may obtain its own
90 * runstate information without needing to execute a hypercall.
91 * Notes:
92 * 1. The registered address may be virtual or physical, depending on the
93 * platform. The virtual address should be registered on x86 systems.
94 * 2. Only one shared area may be registered per VCPU. The shared area is
95 * updated by the hypervisor each time the VCPU is scheduled. Thus
96 * runstate.state will always be RUNSTATE_running and
97 * runstate.state_entry_time will indicate the system time at which the
98 * VCPU was last scheduled to run.
99 * @extra_arg == pointer to vcpu_register_runstate_memory_area structure.
100 */
101 #define VCPUOP_register_runstate_memory_area 5
102 typedef struct vcpu_register_runstate_memory_area {
103 union {
104 struct vcpu_runstate_info *v;
105 uint64_t p;
106 } addr;
107 } vcpu_register_runstate_memory_area_t;
109 #endif /* __XEN_PUBLIC_VCPU_H__ */
111 /*
112 * Local variables:
113 * mode: C
114 * c-set-style: "BSD"
115 * c-basic-offset: 4
116 * tab-width: 4
117 * indent-tabs-mode: nil
118 * End:
119 */