Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / xen / include / xen3-public / event_channel.h
blob845bc4735cc15a6e2fc70bc4447e58a6914f9536
1 /* $NetBSD: event_channel.h,v 1.3.28.1 2007/10/03 19:26:07 garbled Exp $ */
2 /******************************************************************************
3 * event_channel.h
4 *
5 * Event channels between domains.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to
9 * deal in the Software without restriction, including without limitation the
10 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11 * sell copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
25 * Copyright (c) 2003-2004, K A Fraser.
28 #ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
29 #define __XEN_PUBLIC_EVENT_CHANNEL_H__
32 * Prototype for this hypercall is:
33 * int event_channel_op(int cmd, void *args)
34 * @cmd == EVTCHNOP_??? (event-channel operation).
35 * @args == Operation-specific extra arguments (NULL if none).
38 typedef uint32_t evtchn_port_t;
39 DEFINE_XEN_GUEST_HANDLE(evtchn_port_t);
42 * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
43 * accepting interdomain bindings from domain <remote_dom>. A fresh port
44 * is allocated in <dom> and returned as <port>.
45 * NOTES:
46 * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
47 * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
49 #define EVTCHNOP_alloc_unbound 6
50 struct evtchn_alloc_unbound {
51 /* IN parameters */
52 domid_t dom, remote_dom;
53 /* OUT parameters */
54 evtchn_port_t port;
56 typedef struct evtchn_alloc_unbound evtchn_alloc_unbound_t;
59 * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
60 * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
61 * a port that is unbound and marked as accepting bindings from the calling
62 * domain. A fresh port is allocated in the calling domain and returned as
63 * <local_port>.
64 * NOTES:
65 * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
67 #define EVTCHNOP_bind_interdomain 0
68 struct evtchn_bind_interdomain {
69 /* IN parameters. */
70 domid_t remote_dom;
71 evtchn_port_t remote_port;
72 /* OUT parameters. */
73 evtchn_port_t local_port;
75 typedef struct evtchn_bind_interdomain evtchn_bind_interdomain_t;
78 * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
79 * vcpu.
80 * NOTES:
81 * 1. Virtual IRQs are classified as per-vcpu or global. See the VIRQ list
82 * in xen.h for the classification of each VIRQ.
83 * 2. Global VIRQs must be allocated on VCPU0 but can subsequently be
84 * re-bound via EVTCHNOP_bind_vcpu.
85 * 3. Per-vcpu VIRQs may be bound to at most one event channel per vcpu.
86 * The allocated event channel is bound to the specified vcpu and the
87 * binding cannot be changed.
89 #define EVTCHNOP_bind_virq 1
90 struct evtchn_bind_virq {
91 /* IN parameters. */
92 uint32_t virq;
93 uint32_t vcpu;
94 /* OUT parameters. */
95 evtchn_port_t port;
97 typedef struct evtchn_bind_virq evtchn_bind_virq_t;
100 * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
101 * NOTES:
102 * 1. A physical IRQ may be bound to at most one event channel per domain.
103 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
105 #define EVTCHNOP_bind_pirq 2
106 struct evtchn_bind_pirq {
107 /* IN parameters. */
108 uint32_t pirq;
109 #define BIND_PIRQ__WILL_SHARE 1
110 uint32_t flags; /* BIND_PIRQ__* */
111 /* OUT parameters. */
112 evtchn_port_t port;
114 typedef struct evtchn_bind_pirq evtchn_bind_pirq_t;
117 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
118 * NOTES:
119 * 1. The allocated event channel is bound to the specified vcpu. The binding
120 * may not be changed.
122 #define EVTCHNOP_bind_ipi 7
123 struct evtchn_bind_ipi {
124 uint32_t vcpu;
125 /* OUT parameters. */
126 evtchn_port_t port;
128 typedef struct evtchn_bind_ipi evtchn_bind_ipi_t;
131 * EVTCHNOP_close: Close a local event channel <port>. If the channel is
132 * interdomain then the remote end is placed in the unbound state
133 * (EVTCHNSTAT_unbound), awaiting a new connection.
135 #define EVTCHNOP_close 3
136 struct evtchn_close {
137 /* IN parameters. */
138 evtchn_port_t port;
140 typedef struct evtchn_close evtchn_close_t;
143 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
144 * endpoint is <port>.
146 #define EVTCHNOP_send 4
147 struct evtchn_send {
148 /* IN parameters. */
149 evtchn_port_t port;
151 typedef struct evtchn_send evtchn_send_t;
154 * EVTCHNOP_status: Get the current status of the communication channel which
155 * has an endpoint at <dom, port>.
156 * NOTES:
157 * 1. <dom> may be specified as DOMID_SELF.
158 * 2. Only a sufficiently-privileged domain may obtain the status of an event
159 * channel for which <dom> is not DOMID_SELF.
161 #define EVTCHNOP_status 5
162 struct evtchn_status {
163 /* IN parameters */
164 domid_t dom;
165 evtchn_port_t port;
166 /* OUT parameters */
167 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
168 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
169 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
170 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
171 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
172 #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
173 uint32_t status;
174 uint32_t vcpu; /* VCPU to which this channel is bound. */
175 union {
176 struct {
177 domid_t dom;
178 } unbound; /* EVTCHNSTAT_unbound */
179 struct {
180 domid_t dom;
181 evtchn_port_t port;
182 } interdomain; /* EVTCHNSTAT_interdomain */
183 uint32_t pirq; /* EVTCHNSTAT_pirq */
184 uint32_t virq; /* EVTCHNSTAT_virq */
185 } u;
187 typedef struct evtchn_status evtchn_status_t;
190 * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
191 * event is pending.
192 * NOTES:
193 * 1. IPI-bound channels always notify the vcpu specified at bind time.
194 * This binding cannot be changed.
195 * 2. Per-VCPU VIRQ channels always notify the vcpu specified at bind time.
196 * This binding cannot be changed.
197 * 3. All other channels notify vcpu0 by default. This default is set when
198 * the channel is allocated (a port that is freed and subsequently reused
199 * has its binding reset to vcpu0).
201 #define EVTCHNOP_bind_vcpu 8
202 struct evtchn_bind_vcpu {
203 /* IN parameters. */
204 evtchn_port_t port;
205 uint32_t vcpu;
207 typedef struct evtchn_bind_vcpu evtchn_bind_vcpu_t;
210 * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
211 * a notification to the appropriate VCPU if an event is pending.
213 #define EVTCHNOP_unmask 9
214 struct evtchn_unmask {
215 /* IN parameters. */
216 evtchn_port_t port;
218 typedef struct evtchn_unmask evtchn_unmask_t;
221 * EVTCHNOP_reset: Close all event channels associated with specified domain.
222 * NOTES:
223 * 1. <dom> may be specified as DOMID_SELF.
224 * 2. Only a sufficiently-privileged domain may specify other than DOMID_SELF.
226 #define EVTCHNOP_reset 10
227 struct evtchn_reset {
228 /* IN parameters. */
229 domid_t dom;
231 typedef struct evtchn_reset evtchn_reset_t;
234 * Argument to event_channel_op_compat() hypercall. Superceded by new
235 * event_channel_op() hypercall since 0x00030202.
237 struct evtchn_op {
238 uint32_t cmd; /* EVTCHNOP_* */
239 union {
240 struct evtchn_alloc_unbound alloc_unbound;
241 struct evtchn_bind_interdomain bind_interdomain;
242 struct evtchn_bind_virq bind_virq;
243 struct evtchn_bind_pirq bind_pirq;
244 struct evtchn_bind_ipi bind_ipi;
245 struct evtchn_close close;
246 struct evtchn_send send;
247 struct evtchn_status status;
248 struct evtchn_bind_vcpu bind_vcpu;
249 struct evtchn_unmask unmask;
250 } u;
252 typedef struct evtchn_op evtchn_op_t;
253 DEFINE_XEN_GUEST_HANDLE(evtchn_op_t);
255 #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
258 * Local variables:
259 * mode: C
260 * c-set-style: "BSD"
261 * c-basic-offset: 4
262 * tab-width: 4
263 * indent-tabs-mode: nil
264 * End: