win-pvdrivers

annotate common/include/public/event_channel.h @ 1106:2d392ecdd366

Fix race is xenvbd causing 30 second freeze under high load
author James Harper <james.harper@bendigoit.com.au>
date Tue Nov 11 23:08:11 2014 +1100 (2014-11-11)
parents 5712dede5a1b
children
rev   line source
andy@12 1 /******************************************************************************
andy@12 2 * event_channel.h
andy@12 3 *
andy@12 4 * Event channels between domains.
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) 2003-2004, K A Fraser.
andy@12 25 */
andy@12 26
andy@12 27 #ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
andy@12 28 #define __XEN_PUBLIC_EVENT_CHANNEL_H__
andy@12 29
andy@12 30 /*
andy@12 31 * Prototype for this hypercall is:
andy@12 32 * int event_channel_op(int cmd, void *args)
andy@12 33 * @cmd == EVTCHNOP_??? (event-channel operation).
andy@12 34 * @args == Operation-specific extra arguments (NULL if none).
andy@12 35 */
andy@12 36
andy@12 37 typedef uint32_t evtchn_port_t;
andy@12 38 DEFINE_XEN_GUEST_HANDLE(evtchn_port_t);
andy@12 39
andy@12 40 /*
andy@12 41 * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
andy@12 42 * accepting interdomain bindings from domain <remote_dom>. A fresh port
andy@12 43 * is allocated in <dom> and returned as <port>.
andy@12 44 * NOTES:
andy@12 45 * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
andy@12 46 * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
andy@12 47 */
andy@12 48 #define EVTCHNOP_alloc_unbound 6
andy@12 49 struct evtchn_alloc_unbound {
andy@12 50 /* IN parameters */
andy@12 51 domid_t dom, remote_dom;
andy@12 52 /* OUT parameters */
andy@12 53 evtchn_port_t port;
andy@12 54 };
andy@12 55 typedef struct evtchn_alloc_unbound evtchn_alloc_unbound_t;
andy@12 56
andy@12 57 /*
andy@12 58 * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
andy@12 59 * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
andy@12 60 * a port that is unbound and marked as accepting bindings from the calling
andy@12 61 * domain. A fresh port is allocated in the calling domain and returned as
andy@12 62 * <local_port>.
andy@12 63 * NOTES:
andy@12 64 * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
andy@12 65 */
andy@12 66 #define EVTCHNOP_bind_interdomain 0
andy@12 67 struct evtchn_bind_interdomain {
andy@12 68 /* IN parameters. */
andy@12 69 domid_t remote_dom;
andy@12 70 evtchn_port_t remote_port;
andy@12 71 /* OUT parameters. */
andy@12 72 evtchn_port_t local_port;
andy@12 73 };
andy@12 74 typedef struct evtchn_bind_interdomain evtchn_bind_interdomain_t;
andy@12 75
andy@12 76 /*
andy@12 77 * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
andy@12 78 * vcpu.
andy@12 79 * NOTES:
andy@12 80 * 1. Virtual IRQs are classified as per-vcpu or global. See the VIRQ list
andy@12 81 * in xen.h for the classification of each VIRQ.
andy@12 82 * 2. Global VIRQs must be allocated on VCPU0 but can subsequently be
andy@12 83 * re-bound via EVTCHNOP_bind_vcpu.
andy@12 84 * 3. Per-vcpu VIRQs may be bound to at most one event channel per vcpu.
andy@12 85 * The allocated event channel is bound to the specified vcpu and the
andy@12 86 * binding cannot be changed.
andy@12 87 */
andy@12 88 #define EVTCHNOP_bind_virq 1
andy@12 89 struct evtchn_bind_virq {
andy@12 90 /* IN parameters. */
andy@12 91 uint32_t virq;
andy@12 92 uint32_t vcpu;
andy@12 93 /* OUT parameters. */
andy@12 94 evtchn_port_t port;
andy@12 95 };
andy@12 96 typedef struct evtchn_bind_virq evtchn_bind_virq_t;
andy@12 97
andy@12 98 /*
andy@12 99 * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
andy@12 100 * NOTES:
andy@12 101 * 1. A physical IRQ may be bound to at most one event channel per domain.
andy@12 102 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
andy@12 103 */
andy@12 104 #define EVTCHNOP_bind_pirq 2
andy@12 105 struct evtchn_bind_pirq {
andy@12 106 /* IN parameters. */
andy@12 107 uint32_t pirq;
andy@12 108 #define BIND_PIRQ__WILL_SHARE 1
andy@12 109 uint32_t flags; /* BIND_PIRQ__* */
andy@12 110 /* OUT parameters. */
andy@12 111 evtchn_port_t port;
andy@12 112 };
andy@12 113 typedef struct evtchn_bind_pirq evtchn_bind_pirq_t;
andy@12 114
andy@12 115 /*
andy@12 116 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
andy@12 117 * NOTES:
andy@12 118 * 1. The allocated event channel is bound to the specified vcpu. The binding
andy@12 119 * may not be changed.
andy@12 120 */
andy@12 121 #define EVTCHNOP_bind_ipi 7
andy@12 122 struct evtchn_bind_ipi {
andy@12 123 uint32_t vcpu;
andy@12 124 /* OUT parameters. */
andy@12 125 evtchn_port_t port;
andy@12 126 };
andy@12 127 typedef struct evtchn_bind_ipi evtchn_bind_ipi_t;
andy@12 128
andy@12 129 /*
andy@12 130 * EVTCHNOP_close: Close a local event channel <port>. If the channel is
andy@12 131 * interdomain then the remote end is placed in the unbound state
andy@12 132 * (EVTCHNSTAT_unbound), awaiting a new connection.
andy@12 133 */
andy@12 134 #define EVTCHNOP_close 3
andy@12 135 struct evtchn_close {
andy@12 136 /* IN parameters. */
andy@12 137 evtchn_port_t port;
andy@12 138 };
andy@12 139 typedef struct evtchn_close evtchn_close_t;
andy@12 140
andy@12 141 /*
andy@12 142 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
andy@12 143 * endpoint is <port>.
andy@12 144 */
andy@12 145 #define EVTCHNOP_send 4
andy@12 146 struct evtchn_send {
andy@12 147 /* IN parameters. */
andy@12 148 evtchn_port_t port;
andy@12 149 };
andy@12 150 typedef struct evtchn_send evtchn_send_t;
andy@12 151
andy@12 152 /*
andy@12 153 * EVTCHNOP_status: Get the current status of the communication channel which
andy@12 154 * has an endpoint at <dom, port>.
andy@12 155 * NOTES:
andy@12 156 * 1. <dom> may be specified as DOMID_SELF.
andy@12 157 * 2. Only a sufficiently-privileged domain may obtain the status of an event
andy@12 158 * channel for which <dom> is not DOMID_SELF.
andy@12 159 */
andy@12 160 #define EVTCHNOP_status 5
andy@12 161 struct evtchn_status {
andy@12 162 /* IN parameters */
andy@12 163 domid_t dom;
andy@12 164 evtchn_port_t port;
andy@12 165 /* OUT parameters */
andy@12 166 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
andy@12 167 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
andy@12 168 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
andy@12 169 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
andy@12 170 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
andy@12 171 #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
andy@12 172 uint32_t status;
andy@12 173 uint32_t vcpu; /* VCPU to which this channel is bound. */
andy@12 174 union {
andy@12 175 struct {
andy@12 176 domid_t dom;
andy@12 177 } unbound; /* EVTCHNSTAT_unbound */
andy@12 178 struct {
andy@12 179 domid_t dom;
andy@12 180 evtchn_port_t port;
andy@12 181 } interdomain; /* EVTCHNSTAT_interdomain */
andy@12 182 uint32_t pirq; /* EVTCHNSTAT_pirq */
andy@12 183 uint32_t virq; /* EVTCHNSTAT_virq */
andy@12 184 } u;
andy@12 185 };
andy@12 186 typedef struct evtchn_status evtchn_status_t;
andy@12 187
andy@12 188 /*
andy@12 189 * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
andy@12 190 * event is pending.
andy@12 191 * NOTES:
andy@12 192 * 1. IPI-bound channels always notify the vcpu specified at bind time.
andy@12 193 * This binding cannot be changed.
andy@12 194 * 2. Per-VCPU VIRQ channels always notify the vcpu specified at bind time.
andy@12 195 * This binding cannot be changed.
andy@12 196 * 3. All other channels notify vcpu0 by default. This default is set when
andy@12 197 * the channel is allocated (a port that is freed and subsequently reused
andy@12 198 * has its binding reset to vcpu0).
andy@12 199 */
andy@12 200 #define EVTCHNOP_bind_vcpu 8
andy@12 201 struct evtchn_bind_vcpu {
andy@12 202 /* IN parameters. */
andy@12 203 evtchn_port_t port;
andy@12 204 uint32_t vcpu;
andy@12 205 };
andy@12 206 typedef struct evtchn_bind_vcpu evtchn_bind_vcpu_t;
andy@12 207
andy@12 208 /*
andy@12 209 * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
andy@12 210 * a notification to the appropriate VCPU if an event is pending.
andy@12 211 */
andy@12 212 #define EVTCHNOP_unmask 9
andy@12 213 struct evtchn_unmask {
andy@12 214 /* IN parameters. */
andy@12 215 evtchn_port_t port;
andy@12 216 };
andy@12 217 typedef struct evtchn_unmask evtchn_unmask_t;
andy@12 218
andy@12 219 /*
andy@12 220 * EVTCHNOP_reset: Close all event channels associated with specified domain.
andy@12 221 * NOTES:
andy@12 222 * 1. <dom> may be specified as DOMID_SELF.
andy@12 223 * 2. Only a sufficiently-privileged domain may specify other than DOMID_SELF.
andy@12 224 */
andy@12 225 #define EVTCHNOP_reset 10
andy@12 226 struct evtchn_reset {
andy@12 227 /* IN parameters. */
andy@12 228 domid_t dom;
andy@12 229 };
andy@12 230 typedef struct evtchn_reset evtchn_reset_t;
andy@12 231
andy@12 232 /*
andy@12 233 * Argument to event_channel_op_compat() hypercall. Superceded by new
andy@12 234 * event_channel_op() hypercall since 0x00030202.
andy@12 235 */
andy@12 236 struct evtchn_op {
andy@12 237 uint32_t cmd; /* EVTCHNOP_* */
andy@12 238 union {
andy@12 239 struct evtchn_alloc_unbound alloc_unbound;
andy@12 240 struct evtchn_bind_interdomain bind_interdomain;
andy@12 241 struct evtchn_bind_virq bind_virq;
andy@12 242 struct evtchn_bind_pirq bind_pirq;
andy@12 243 struct evtchn_bind_ipi bind_ipi;
andy@12 244 struct evtchn_close close;
andy@12 245 struct evtchn_send send;
andy@12 246 struct evtchn_status status;
andy@12 247 struct evtchn_bind_vcpu bind_vcpu;
andy@12 248 struct evtchn_unmask unmask;
andy@12 249 } u;
andy@12 250 };
andy@12 251 typedef struct evtchn_op evtchn_op_t;
andy@12 252 DEFINE_XEN_GUEST_HANDLE(evtchn_op_t);
andy@12 253
andy@12 254 #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
andy@12 255
andy@12 256 /*
andy@12 257 * Local variables:
andy@12 258 * mode: C
andy@12 259 * c-set-style: "BSD"
andy@12 260 * c-basic-offset: 4
andy@12 261 * tab-width: 4
andy@12 262 * indent-tabs-mode: nil
andy@12 263 * End:
andy@12 264 */