win-pvdrivers

annotate common/include/public/vcpu.h @ 12:5712dede5a1b

add in xen public includes, so the extra step of copying them over is not needed
author Andy Grover <andy@groveronline.com>
date Wed Nov 28 14:44:10 2007 -0800 (2007-11-28)
parents
children
rev   line source
andy@12 1 /******************************************************************************
andy@12 2 * vcpu.h
andy@12 3 *
andy@12 4 * VCPU initialisation, query, and hotplug.
andy@12 5 *
andy@12 6 * Permission is hereby granted, free of charge, to any person obtaining a copy
andy@12 7 * of this software and associated documentation files (the "Software"), to
andy@12 8 * deal in the Software without restriction, including without limitation the
andy@12 9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
andy@12 10 * sell copies of the Software, and to permit persons to whom the Software is
andy@12 11 * furnished to do so, subject to the following conditions:
andy@12 12 *
andy@12 13 * The above copyright notice and this permission notice shall be included in
andy@12 14 * all copies or substantial portions of the Software.
andy@12 15 *
andy@12 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
andy@12 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
andy@12 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
andy@12 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
andy@12 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
andy@12 21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
andy@12 22 * DEALINGS IN THE SOFTWARE.
andy@12 23 *
andy@12 24 * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
andy@12 25 */
andy@12 26
andy@12 27 #ifndef __XEN_PUBLIC_VCPU_H__
andy@12 28 #define __XEN_PUBLIC_VCPU_H__
andy@12 29
andy@12 30 /*
andy@12 31 * Prototype for this hypercall is:
andy@12 32 * int vcpu_op(int cmd, int vcpuid, void *extra_args)
andy@12 33 * @cmd == VCPUOP_??? (VCPU operation).
andy@12 34 * @vcpuid == VCPU to operate on.
andy@12 35 * @extra_args == Operation-specific extra arguments (NULL if none).
andy@12 36 */
andy@12 37
andy@12 38 /*
andy@12 39 * Initialise a VCPU. Each VCPU can be initialised only once. A
andy@12 40 * newly-initialised VCPU will not run until it is brought up by VCPUOP_up.
andy@12 41 *
andy@12 42 * @extra_arg == pointer to vcpu_guest_context structure containing initial
andy@12 43 * state for the VCPU.
andy@12 44 */
andy@12 45 #define VCPUOP_initialise 0
andy@12 46
andy@12 47 /*
andy@12 48 * Bring up a VCPU. This makes the VCPU runnable. This operation will fail
andy@12 49 * if the VCPU has not been initialised (VCPUOP_initialise).
andy@12 50 */
andy@12 51 #define VCPUOP_up 1
andy@12 52
andy@12 53 /*
andy@12 54 * Bring down a VCPU (i.e., make it non-runnable).
andy@12 55 * There are a few caveats that callers should observe:
andy@12 56 * 1. This operation may return, and VCPU_is_up may return false, before the
andy@12 57 * VCPU stops running (i.e., the command is asynchronous). It is a good
andy@12 58 * idea to ensure that the VCPU has entered a non-critical loop before
andy@12 59 * bringing it down. Alternatively, this operation is guaranteed
andy@12 60 * synchronous if invoked by the VCPU itself.
andy@12 61 * 2. After a VCPU is initialised, there is currently no way to drop all its
andy@12 62 * references to domain memory. Even a VCPU that is down still holds
andy@12 63 * memory references via its pagetable base pointer and GDT. It is good
andy@12 64 * practise to move a VCPU onto an 'idle' or default page table, LDT and
andy@12 65 * GDT before bringing it down.
andy@12 66 */
andy@12 67 #define VCPUOP_down 2
andy@12 68
andy@12 69 /* Returns 1 if the given VCPU is up. */
andy@12 70 #define VCPUOP_is_up 3
andy@12 71
andy@12 72 /*
andy@12 73 * Return information about the state and running time of a VCPU.
andy@12 74 * @extra_arg == pointer to vcpu_runstate_info structure.
andy@12 75 */
andy@12 76 #define VCPUOP_get_runstate_info 4
andy@12 77 struct vcpu_runstate_info {
andy@12 78 /* VCPU's current state (RUNSTATE_*). */
andy@12 79 int state;
andy@12 80 /* When was current state entered (system time, ns)? */
andy@12 81 uint64_t state_entry_time;
andy@12 82 /*
andy@12 83 * Time spent in each RUNSTATE_* (ns). The sum of these times is
andy@12 84 * guaranteed not to drift from system time.
andy@12 85 */
andy@12 86 uint64_t time[4];
andy@12 87 };
andy@12 88 typedef struct vcpu_runstate_info vcpu_runstate_info_t;
andy@12 89 DEFINE_XEN_GUEST_HANDLE(vcpu_runstate_info_t);
andy@12 90
andy@12 91 /* VCPU is currently running on a physical CPU. */
andy@12 92 #define RUNSTATE_running 0
andy@12 93
andy@12 94 /* VCPU is runnable, but not currently scheduled on any physical CPU. */
andy@12 95 #define RUNSTATE_runnable 1
andy@12 96
andy@12 97 /* VCPU is blocked (a.k.a. idle). It is therefore not runnable. */
andy@12 98 #define RUNSTATE_blocked 2
andy@12 99
andy@12 100 /*
andy@12 101 * VCPU is not runnable, but it is not blocked.
andy@12 102 * This is a 'catch all' state for things like hotplug and pauses by the
andy@12 103 * system administrator (or for critical sections in the hypervisor).
andy@12 104 * RUNSTATE_blocked dominates this state (it is the preferred state).
andy@12 105 */
andy@12 106 #define RUNSTATE_offline 3
andy@12 107
andy@12 108 /*
andy@12 109 * Register a shared memory area from which the guest may obtain its own
andy@12 110 * runstate information without needing to execute a hypercall.
andy@12 111 * Notes:
andy@12 112 * 1. The registered address may be virtual or physical or guest handle,
andy@12 113 * depending on the platform. Virtual address or guest handle should be
andy@12 114 * registered on x86 systems.
andy@12 115 * 2. Only one shared area may be registered per VCPU. The shared area is
andy@12 116 * updated by the hypervisor each time the VCPU is scheduled. Thus
andy@12 117 * runstate.state will always be RUNSTATE_running and
andy@12 118 * runstate.state_entry_time will indicate the system time at which the
andy@12 119 * VCPU was last scheduled to run.
andy@12 120 * @extra_arg == pointer to vcpu_register_runstate_memory_area structure.
andy@12 121 */
andy@12 122 #define VCPUOP_register_runstate_memory_area 5
andy@12 123 struct vcpu_register_runstate_memory_area {
andy@12 124 union {
andy@12 125 XEN_GUEST_HANDLE(vcpu_runstate_info_t) h;
andy@12 126 struct vcpu_runstate_info *v;
andy@12 127 uint64_t p;
andy@12 128 } addr;
andy@12 129 };
andy@12 130 typedef struct vcpu_register_runstate_memory_area vcpu_register_runstate_memory_area_t;
andy@12 131 DEFINE_XEN_GUEST_HANDLE(vcpu_register_runstate_memory_area_t);
andy@12 132
andy@12 133 /*
andy@12 134 * Set or stop a VCPU's periodic timer. Every VCPU has one periodic timer
andy@12 135 * which can be set via these commands. Periods smaller than one millisecond
andy@12 136 * may not be supported.
andy@12 137 */
andy@12 138 #define VCPUOP_set_periodic_timer 6 /* arg == vcpu_set_periodic_timer_t */
andy@12 139 #define VCPUOP_stop_periodic_timer 7 /* arg == NULL */
andy@12 140 struct vcpu_set_periodic_timer {
andy@12 141 uint64_t period_ns;
andy@12 142 };
andy@12 143 typedef struct vcpu_set_periodic_timer vcpu_set_periodic_timer_t;
andy@12 144 DEFINE_XEN_GUEST_HANDLE(vcpu_set_periodic_timer_t);
andy@12 145
andy@12 146 /*
andy@12 147 * Set or stop a VCPU's single-shot timer. Every VCPU has one single-shot
andy@12 148 * timer which can be set via these commands.
andy@12 149 */
andy@12 150 #define VCPUOP_set_singleshot_timer 8 /* arg == vcpu_set_singleshot_timer_t */
andy@12 151 #define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
andy@12 152 struct vcpu_set_singleshot_timer {
andy@12 153 uint64_t timeout_abs_ns; /* Absolute system time value in nanoseconds. */
andy@12 154 uint32_t flags; /* VCPU_SSHOTTMR_??? */
andy@12 155 };
andy@12 156 typedef struct vcpu_set_singleshot_timer vcpu_set_singleshot_timer_t;
andy@12 157 DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t);
andy@12 158
andy@12 159 /* Flags to VCPUOP_set_singleshot_timer. */
andy@12 160 /* Require the timeout to be in the future (return -ETIME if it's passed). */
andy@12 161 #define _VCPU_SSHOTTMR_future (0)
andy@12 162 #define VCPU_SSHOTTMR_future (1U << _VCPU_SSHOTTMR_future)
andy@12 163
andy@12 164 /*
andy@12 165 * Register a memory location in the guest address space for the
andy@12 166 * vcpu_info structure. This allows the guest to place the vcpu_info
andy@12 167 * structure in a convenient place, such as in a per-cpu data area.
andy@12 168 * The pointer need not be page aligned, but the structure must not
andy@12 169 * cross a page boundary.
andy@12 170 *
andy@12 171 * This may be called only once per vcpu.
andy@12 172 */
andy@12 173 #define VCPUOP_register_vcpu_info 10 /* arg == struct vcpu_info */
andy@12 174 struct vcpu_register_vcpu_info {
andy@12 175 uint64_t mfn; /* mfn of page to place vcpu_info */
andy@12 176 uint32_t offset; /* offset within page */
andy@12 177 uint32_t rsvd; /* unused */
andy@12 178 };
andy@12 179 typedef struct vcpu_register_vcpu_info vcpu_register_vcpu_info_t;
andy@12 180 DEFINE_XEN_GUEST_HANDLE(vcpu_register_vcpu_info_t);
andy@12 181
andy@12 182 #endif /* __XEN_PUBLIC_VCPU_H__ */
andy@12 183
andy@12 184 /*
andy@12 185 * Local variables:
andy@12 186 * mode: C
andy@12 187 * c-set-style: "BSD"
andy@12 188 * c-basic-offset: 4
andy@12 189 * tab-width: 4
andy@12 190 * indent-tabs-mode: nil
andy@12 191 * End:
andy@12 192 */