win-pvdrivers

diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/include/public/vcpu.h	Wed Nov 28 14:44:10 2007 -0800
     1.3 @@ -0,0 +1,192 @@
     1.4 +/******************************************************************************
     1.5 + * vcpu.h
     1.6 + * 
     1.7 + * VCPU initialisation, query, and hotplug.
     1.8 + * 
     1.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    1.10 + * of this software and associated documentation files (the "Software"), to
    1.11 + * deal in the Software without restriction, including without limitation the
    1.12 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    1.13 + * sell copies of the Software, and to permit persons to whom the Software is
    1.14 + * furnished to do so, subject to the following conditions:
    1.15 + *
    1.16 + * The above copyright notice and this permission notice shall be included in
    1.17 + * all copies or substantial portions of the Software.
    1.18 + *
    1.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    1.24 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    1.25 + * DEALINGS IN THE SOFTWARE.
    1.26 + *
    1.27 + * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
    1.28 + */
    1.29 +
    1.30 +#ifndef __XEN_PUBLIC_VCPU_H__
    1.31 +#define __XEN_PUBLIC_VCPU_H__
    1.32 +
    1.33 +/*
    1.34 + * Prototype for this hypercall is:
    1.35 + *  int vcpu_op(int cmd, int vcpuid, void *extra_args)
    1.36 + * @cmd        == VCPUOP_??? (VCPU operation).
    1.37 + * @vcpuid     == VCPU to operate on.
    1.38 + * @extra_args == Operation-specific extra arguments (NULL if none).
    1.39 + */
    1.40 +
    1.41 +/*
    1.42 + * Initialise a VCPU. Each VCPU can be initialised only once. A 
    1.43 + * newly-initialised VCPU will not run until it is brought up by VCPUOP_up.
    1.44 + * 
    1.45 + * @extra_arg == pointer to vcpu_guest_context structure containing initial
    1.46 + *               state for the VCPU.
    1.47 + */
    1.48 +#define VCPUOP_initialise            0
    1.49 +
    1.50 +/*
    1.51 + * Bring up a VCPU. This makes the VCPU runnable. This operation will fail
    1.52 + * if the VCPU has not been initialised (VCPUOP_initialise).
    1.53 + */
    1.54 +#define VCPUOP_up                    1
    1.55 +
    1.56 +/*
    1.57 + * Bring down a VCPU (i.e., make it non-runnable).
    1.58 + * There are a few caveats that callers should observe:
    1.59 + *  1. This operation may return, and VCPU_is_up may return false, before the
    1.60 + *     VCPU stops running (i.e., the command is asynchronous). It is a good
    1.61 + *     idea to ensure that the VCPU has entered a non-critical loop before
    1.62 + *     bringing it down. Alternatively, this operation is guaranteed
    1.63 + *     synchronous if invoked by the VCPU itself.
    1.64 + *  2. After a VCPU is initialised, there is currently no way to drop all its
    1.65 + *     references to domain memory. Even a VCPU that is down still holds
    1.66 + *     memory references via its pagetable base pointer and GDT. It is good
    1.67 + *     practise to move a VCPU onto an 'idle' or default page table, LDT and
    1.68 + *     GDT before bringing it down.
    1.69 + */
    1.70 +#define VCPUOP_down                  2
    1.71 +
    1.72 +/* Returns 1 if the given VCPU is up. */
    1.73 +#define VCPUOP_is_up                 3
    1.74 +
    1.75 +/*
    1.76 + * Return information about the state and running time of a VCPU.
    1.77 + * @extra_arg == pointer to vcpu_runstate_info structure.
    1.78 + */
    1.79 +#define VCPUOP_get_runstate_info     4
    1.80 +struct vcpu_runstate_info {
    1.81 +    /* VCPU's current state (RUNSTATE_*). */
    1.82 +    int      state;
    1.83 +    /* When was current state entered (system time, ns)? */
    1.84 +    uint64_t state_entry_time;
    1.85 +    /*
    1.86 +     * Time spent in each RUNSTATE_* (ns). The sum of these times is
    1.87 +     * guaranteed not to drift from system time.
    1.88 +     */
    1.89 +    uint64_t time[4];
    1.90 +};
    1.91 +typedef struct vcpu_runstate_info vcpu_runstate_info_t;
    1.92 +DEFINE_XEN_GUEST_HANDLE(vcpu_runstate_info_t);
    1.93 +
    1.94 +/* VCPU is currently running on a physical CPU. */
    1.95 +#define RUNSTATE_running  0
    1.96 +
    1.97 +/* VCPU is runnable, but not currently scheduled on any physical CPU. */
    1.98 +#define RUNSTATE_runnable 1
    1.99 +
   1.100 +/* VCPU is blocked (a.k.a. idle). It is therefore not runnable. */
   1.101 +#define RUNSTATE_blocked  2
   1.102 +
   1.103 +/*
   1.104 + * VCPU is not runnable, but it is not blocked.
   1.105 + * This is a 'catch all' state for things like hotplug and pauses by the
   1.106 + * system administrator (or for critical sections in the hypervisor).
   1.107 + * RUNSTATE_blocked dominates this state (it is the preferred state).
   1.108 + */
   1.109 +#define RUNSTATE_offline  3
   1.110 +
   1.111 +/*
   1.112 + * Register a shared memory area from which the guest may obtain its own
   1.113 + * runstate information without needing to execute a hypercall.
   1.114 + * Notes:
   1.115 + *  1. The registered address may be virtual or physical or guest handle,
   1.116 + *     depending on the platform. Virtual address or guest handle should be
   1.117 + *     registered on x86 systems.
   1.118 + *  2. Only one shared area may be registered per VCPU. The shared area is
   1.119 + *     updated by the hypervisor each time the VCPU is scheduled. Thus
   1.120 + *     runstate.state will always be RUNSTATE_running and
   1.121 + *     runstate.state_entry_time will indicate the system time at which the
   1.122 + *     VCPU was last scheduled to run.
   1.123 + * @extra_arg == pointer to vcpu_register_runstate_memory_area structure.
   1.124 + */
   1.125 +#define VCPUOP_register_runstate_memory_area 5
   1.126 +struct vcpu_register_runstate_memory_area {
   1.127 +    union {
   1.128 +        XEN_GUEST_HANDLE(vcpu_runstate_info_t) h;
   1.129 +        struct vcpu_runstate_info *v;
   1.130 +        uint64_t p;
   1.131 +    } addr;
   1.132 +};
   1.133 +typedef struct vcpu_register_runstate_memory_area vcpu_register_runstate_memory_area_t;
   1.134 +DEFINE_XEN_GUEST_HANDLE(vcpu_register_runstate_memory_area_t);
   1.135 +
   1.136 +/*
   1.137 + * Set or stop a VCPU's periodic timer. Every VCPU has one periodic timer
   1.138 + * which can be set via these commands. Periods smaller than one millisecond
   1.139 + * may not be supported.
   1.140 + */
   1.141 +#define VCPUOP_set_periodic_timer    6 /* arg == vcpu_set_periodic_timer_t */
   1.142 +#define VCPUOP_stop_periodic_timer   7 /* arg == NULL */
   1.143 +struct vcpu_set_periodic_timer {
   1.144 +    uint64_t period_ns;
   1.145 +};
   1.146 +typedef struct vcpu_set_periodic_timer vcpu_set_periodic_timer_t;
   1.147 +DEFINE_XEN_GUEST_HANDLE(vcpu_set_periodic_timer_t);
   1.148 +
   1.149 +/*
   1.150 + * Set or stop a VCPU's single-shot timer. Every VCPU has one single-shot
   1.151 + * timer which can be set via these commands.
   1.152 + */
   1.153 +#define VCPUOP_set_singleshot_timer  8 /* arg == vcpu_set_singleshot_timer_t */
   1.154 +#define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */
   1.155 +struct vcpu_set_singleshot_timer {
   1.156 +    uint64_t timeout_abs_ns;   /* Absolute system time value in nanoseconds. */
   1.157 +    uint32_t flags;            /* VCPU_SSHOTTMR_??? */
   1.158 +};
   1.159 +typedef struct vcpu_set_singleshot_timer vcpu_set_singleshot_timer_t;
   1.160 +DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t);
   1.161 +
   1.162 +/* Flags to VCPUOP_set_singleshot_timer. */
   1.163 + /* Require the timeout to be in the future (return -ETIME if it's passed). */
   1.164 +#define _VCPU_SSHOTTMR_future (0)
   1.165 +#define VCPU_SSHOTTMR_future  (1U << _VCPU_SSHOTTMR_future)
   1.166 +
   1.167 +/* 
   1.168 + * Register a memory location in the guest address space for the
   1.169 + * vcpu_info structure.  This allows the guest to place the vcpu_info
   1.170 + * structure in a convenient place, such as in a per-cpu data area.
   1.171 + * The pointer need not be page aligned, but the structure must not
   1.172 + * cross a page boundary.
   1.173 + *
   1.174 + * This may be called only once per vcpu.
   1.175 + */
   1.176 +#define VCPUOP_register_vcpu_info   10  /* arg == struct vcpu_info */
   1.177 +struct vcpu_register_vcpu_info {
   1.178 +    uint64_t mfn;    /* mfn of page to place vcpu_info */
   1.179 +    uint32_t offset; /* offset within page */
   1.180 +    uint32_t rsvd;   /* unused */
   1.181 +};
   1.182 +typedef struct vcpu_register_vcpu_info vcpu_register_vcpu_info_t;
   1.183 +DEFINE_XEN_GUEST_HANDLE(vcpu_register_vcpu_info_t);
   1.184 +
   1.185 +#endif /* __XEN_PUBLIC_VCPU_H__ */
   1.186 +
   1.187 +/*
   1.188 + * Local variables:
   1.189 + * mode: C
   1.190 + * c-set-style: "BSD"
   1.191 + * c-basic-offset: 4
   1.192 + * tab-width: 4
   1.193 + * indent-tabs-mode: nil
   1.194 + * End:
   1.195 + */