xref: /freebsd/sys/contrib/xen/event_channel.h (revision 3a9fd8242b35884921dfc4e886f284a75870a536)
1*3a9fd824SRoger Pau Monné /******************************************************************************
2*3a9fd824SRoger Pau Monné  * event_channel.h
3*3a9fd824SRoger Pau Monné  *
4*3a9fd824SRoger Pau Monné  * Event channels between domains.
5*3a9fd824SRoger Pau Monné  *
6*3a9fd824SRoger Pau Monné  * Permission is hereby granted, free of charge, to any person obtaining a copy
7*3a9fd824SRoger Pau Monné  * of this software and associated documentation files (the "Software"), to
8*3a9fd824SRoger Pau Monné  * deal in the Software without restriction, including without limitation the
9*3a9fd824SRoger Pau Monné  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10*3a9fd824SRoger Pau Monné  * sell copies of the Software, and to permit persons to whom the Software is
11*3a9fd824SRoger Pau Monné  * furnished to do so, subject to the following conditions:
12*3a9fd824SRoger Pau Monné  *
13*3a9fd824SRoger Pau Monné  * The above copyright notice and this permission notice shall be included in
14*3a9fd824SRoger Pau Monné  * all copies or substantial portions of the Software.
15*3a9fd824SRoger Pau Monné  *
16*3a9fd824SRoger Pau Monné  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17*3a9fd824SRoger Pau Monné  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18*3a9fd824SRoger Pau Monné  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19*3a9fd824SRoger Pau Monné  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20*3a9fd824SRoger Pau Monné  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21*3a9fd824SRoger Pau Monné  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22*3a9fd824SRoger Pau Monné  * DEALINGS IN THE SOFTWARE.
23*3a9fd824SRoger Pau Monné  *
24*3a9fd824SRoger Pau Monné  * Copyright (c) 2003-2004, K A Fraser.
25*3a9fd824SRoger Pau Monné  */
26*3a9fd824SRoger Pau Monné 
27*3a9fd824SRoger Pau Monné #ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
28*3a9fd824SRoger Pau Monné #define __XEN_PUBLIC_EVENT_CHANNEL_H__
29*3a9fd824SRoger Pau Monné 
30*3a9fd824SRoger Pau Monné #include "xen.h"
31*3a9fd824SRoger Pau Monné 
32*3a9fd824SRoger Pau Monné /*
33*3a9fd824SRoger Pau Monné  * `incontents 150 evtchn Event Channels
34*3a9fd824SRoger Pau Monné  *
35*3a9fd824SRoger Pau Monné  * Event channels are the basic primitive provided by Xen for event
36*3a9fd824SRoger Pau Monné  * notifications. An event is the Xen equivalent of a hardware
37*3a9fd824SRoger Pau Monné  * interrupt. They essentially store one bit of information, the event
38*3a9fd824SRoger Pau Monné  * of interest is signalled by transitioning this bit from 0 to 1.
39*3a9fd824SRoger Pau Monné  *
40*3a9fd824SRoger Pau Monné  * Notifications are received by a guest via an upcall from Xen,
41*3a9fd824SRoger Pau Monné  * indicating when an event arrives (setting the bit). Further
42*3a9fd824SRoger Pau Monné  * notifications are masked until the bit is cleared again (therefore,
43*3a9fd824SRoger Pau Monné  * guests must check the value of the bit after re-enabling event
44*3a9fd824SRoger Pau Monné  * delivery to ensure no missed notifications).
45*3a9fd824SRoger Pau Monné  *
46*3a9fd824SRoger Pau Monné  * Event notifications can be masked by setting a flag; this is
47*3a9fd824SRoger Pau Monné  * equivalent to disabling interrupts and can be used to ensure
48*3a9fd824SRoger Pau Monné  * atomicity of certain operations in the guest kernel.
49*3a9fd824SRoger Pau Monné  *
50*3a9fd824SRoger Pau Monné  * Event channels are represented by the evtchn_* fields in
51*3a9fd824SRoger Pau Monné  * struct shared_info and struct vcpu_info.
52*3a9fd824SRoger Pau Monné  */
53*3a9fd824SRoger Pau Monné 
54*3a9fd824SRoger Pau Monné /*
55*3a9fd824SRoger Pau Monné  * ` enum neg_errnoval
56*3a9fd824SRoger Pau Monné  * ` HYPERVISOR_event_channel_op(enum event_channel_op cmd, void *args)
57*3a9fd824SRoger Pau Monné  * `
58*3a9fd824SRoger Pau Monné  * @cmd  == EVTCHNOP_* (event-channel operation).
59*3a9fd824SRoger Pau Monné  * @args == struct evtchn_* Operation-specific extra arguments (NULL if none).
60*3a9fd824SRoger Pau Monné  */
61*3a9fd824SRoger Pau Monné 
62*3a9fd824SRoger Pau Monné /* ` enum event_channel_op { // EVTCHNOP_* => struct evtchn_* */
63*3a9fd824SRoger Pau Monné #define EVTCHNOP_bind_interdomain 0
64*3a9fd824SRoger Pau Monné #define EVTCHNOP_bind_virq        1
65*3a9fd824SRoger Pau Monné #define EVTCHNOP_bind_pirq        2
66*3a9fd824SRoger Pau Monné #define EVTCHNOP_close            3
67*3a9fd824SRoger Pau Monné #define EVTCHNOP_send             4
68*3a9fd824SRoger Pau Monné #define EVTCHNOP_status           5
69*3a9fd824SRoger Pau Monné #define EVTCHNOP_alloc_unbound    6
70*3a9fd824SRoger Pau Monné #define EVTCHNOP_bind_ipi         7
71*3a9fd824SRoger Pau Monné #define EVTCHNOP_bind_vcpu        8
72*3a9fd824SRoger Pau Monné #define EVTCHNOP_unmask           9
73*3a9fd824SRoger Pau Monné #define EVTCHNOP_reset           10
74*3a9fd824SRoger Pau Monné #define EVTCHNOP_init_control    11
75*3a9fd824SRoger Pau Monné #define EVTCHNOP_expand_array    12
76*3a9fd824SRoger Pau Monné #define EVTCHNOP_set_priority    13
77*3a9fd824SRoger Pau Monné #ifdef __XEN__
78*3a9fd824SRoger Pau Monné #define EVTCHNOP_reset_cont      14
79*3a9fd824SRoger Pau Monné #endif
80*3a9fd824SRoger Pau Monné /* ` } */
81*3a9fd824SRoger Pau Monné 
82*3a9fd824SRoger Pau Monné typedef uint32_t evtchn_port_t;
83*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(evtchn_port_t);
84*3a9fd824SRoger Pau Monné 
85*3a9fd824SRoger Pau Monné /*
86*3a9fd824SRoger Pau Monné  * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
87*3a9fd824SRoger Pau Monné  * accepting interdomain bindings from domain <remote_dom>. A fresh port
88*3a9fd824SRoger Pau Monné  * is allocated in <dom> and returned as <port>.
89*3a9fd824SRoger Pau Monné  * NOTES:
90*3a9fd824SRoger Pau Monné  *  1. If the caller is unprivileged then <dom> must be DOMID_SELF.
91*3a9fd824SRoger Pau Monné  *  2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
92*3a9fd824SRoger Pau Monné  */
93*3a9fd824SRoger Pau Monné struct evtchn_alloc_unbound {
94*3a9fd824SRoger Pau Monné     /* IN parameters */
95*3a9fd824SRoger Pau Monné     domid_t dom, remote_dom;
96*3a9fd824SRoger Pau Monné     /* OUT parameters */
97*3a9fd824SRoger Pau Monné     evtchn_port_t port;
98*3a9fd824SRoger Pau Monné };
99*3a9fd824SRoger Pau Monné typedef struct evtchn_alloc_unbound evtchn_alloc_unbound_t;
100*3a9fd824SRoger Pau Monné 
101*3a9fd824SRoger Pau Monné /*
102*3a9fd824SRoger Pau Monné  * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
103*3a9fd824SRoger Pau Monné  * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
104*3a9fd824SRoger Pau Monné  * a port that is unbound and marked as accepting bindings from the calling
105*3a9fd824SRoger Pau Monné  * domain. A fresh port is allocated in the calling domain and returned as
106*3a9fd824SRoger Pau Monné  * <local_port>.
107*3a9fd824SRoger Pau Monné  *
108*3a9fd824SRoger Pau Monné  * In case the peer domain has already tried to set our event channel
109*3a9fd824SRoger Pau Monné  * pending, before it was bound, EVTCHNOP_bind_interdomain always sets
110*3a9fd824SRoger Pau Monné  * the local event channel pending.
111*3a9fd824SRoger Pau Monné  *
112*3a9fd824SRoger Pau Monné  * The usual pattern of use, in the guest's upcall (or subsequent
113*3a9fd824SRoger Pau Monné  * handler) is as follows: (Re-enable the event channel for subsequent
114*3a9fd824SRoger Pau Monné  * signalling and then) check for the existence of whatever condition
115*3a9fd824SRoger Pau Monné  * is being waited for by other means, and take whatever action is
116*3a9fd824SRoger Pau Monné  * needed (if any).
117*3a9fd824SRoger Pau Monné  *
118*3a9fd824SRoger Pau Monné  * NOTES:
119*3a9fd824SRoger Pau Monné  *  1. <remote_dom> may be DOMID_SELF, allowing loopback connections.
120*3a9fd824SRoger Pau Monné  */
121*3a9fd824SRoger Pau Monné struct evtchn_bind_interdomain {
122*3a9fd824SRoger Pau Monné     /* IN parameters. */
123*3a9fd824SRoger Pau Monné     domid_t remote_dom;
124*3a9fd824SRoger Pau Monné     evtchn_port_t remote_port;
125*3a9fd824SRoger Pau Monné     /* OUT parameters. */
126*3a9fd824SRoger Pau Monné     evtchn_port_t local_port;
127*3a9fd824SRoger Pau Monné };
128*3a9fd824SRoger Pau Monné typedef struct evtchn_bind_interdomain evtchn_bind_interdomain_t;
129*3a9fd824SRoger Pau Monné 
130*3a9fd824SRoger Pau Monné /*
131*3a9fd824SRoger Pau Monné  * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
132*3a9fd824SRoger Pau Monné  * vcpu.
133*3a9fd824SRoger Pau Monné  * NOTES:
134*3a9fd824SRoger Pau Monné  *  1. Virtual IRQs are classified as per-vcpu or global. See the VIRQ list
135*3a9fd824SRoger Pau Monné  *     in xen.h for the classification of each VIRQ.
136*3a9fd824SRoger Pau Monné  *  2. Global VIRQs must be allocated on VCPU0 but can subsequently be
137*3a9fd824SRoger Pau Monné  *     re-bound via EVTCHNOP_bind_vcpu.
138*3a9fd824SRoger Pau Monné  *  3. Per-vcpu VIRQs may be bound to at most one event channel per vcpu.
139*3a9fd824SRoger Pau Monné  *     The allocated event channel is bound to the specified vcpu and the
140*3a9fd824SRoger Pau Monné  *     binding cannot be changed.
141*3a9fd824SRoger Pau Monné  */
142*3a9fd824SRoger Pau Monné struct evtchn_bind_virq {
143*3a9fd824SRoger Pau Monné     /* IN parameters. */
144*3a9fd824SRoger Pau Monné     uint32_t virq; /* enum virq */
145*3a9fd824SRoger Pau Monné     uint32_t vcpu;
146*3a9fd824SRoger Pau Monné     /* OUT parameters. */
147*3a9fd824SRoger Pau Monné     evtchn_port_t port;
148*3a9fd824SRoger Pau Monné };
149*3a9fd824SRoger Pau Monné typedef struct evtchn_bind_virq evtchn_bind_virq_t;
150*3a9fd824SRoger Pau Monné 
151*3a9fd824SRoger Pau Monné /*
152*3a9fd824SRoger Pau Monné  * EVTCHNOP_bind_pirq: Bind a local event channel to a real IRQ (PIRQ <irq>).
153*3a9fd824SRoger Pau Monné  * NOTES:
154*3a9fd824SRoger Pau Monné  *  1. A physical IRQ may be bound to at most one event channel per domain.
155*3a9fd824SRoger Pau Monné  *  2. Only a sufficiently-privileged domain may bind to a physical IRQ.
156*3a9fd824SRoger Pau Monné  */
157*3a9fd824SRoger Pau Monné struct evtchn_bind_pirq {
158*3a9fd824SRoger Pau Monné     /* IN parameters. */
159*3a9fd824SRoger Pau Monné     uint32_t pirq;
160*3a9fd824SRoger Pau Monné #define BIND_PIRQ__WILL_SHARE 1
161*3a9fd824SRoger Pau Monné     uint32_t flags; /* BIND_PIRQ__* */
162*3a9fd824SRoger Pau Monné     /* OUT parameters. */
163*3a9fd824SRoger Pau Monné     evtchn_port_t port;
164*3a9fd824SRoger Pau Monné };
165*3a9fd824SRoger Pau Monné typedef struct evtchn_bind_pirq evtchn_bind_pirq_t;
166*3a9fd824SRoger Pau Monné 
167*3a9fd824SRoger Pau Monné /*
168*3a9fd824SRoger Pau Monné  * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
169*3a9fd824SRoger Pau Monné  * NOTES:
170*3a9fd824SRoger Pau Monné  *  1. The allocated event channel is bound to the specified vcpu. The binding
171*3a9fd824SRoger Pau Monné  *     may not be changed.
172*3a9fd824SRoger Pau Monné  */
173*3a9fd824SRoger Pau Monné struct evtchn_bind_ipi {
174*3a9fd824SRoger Pau Monné     uint32_t vcpu;
175*3a9fd824SRoger Pau Monné     /* OUT parameters. */
176*3a9fd824SRoger Pau Monné     evtchn_port_t port;
177*3a9fd824SRoger Pau Monné };
178*3a9fd824SRoger Pau Monné typedef struct evtchn_bind_ipi evtchn_bind_ipi_t;
179*3a9fd824SRoger Pau Monné 
180*3a9fd824SRoger Pau Monné /*
181*3a9fd824SRoger Pau Monné  * EVTCHNOP_close: Close a local event channel <port>. If the channel is
182*3a9fd824SRoger Pau Monné  * interdomain then the remote end is placed in the unbound state
183*3a9fd824SRoger Pau Monné  * (EVTCHNSTAT_unbound), awaiting a new connection.
184*3a9fd824SRoger Pau Monné  */
185*3a9fd824SRoger Pau Monné struct evtchn_close {
186*3a9fd824SRoger Pau Monné     /* IN parameters. */
187*3a9fd824SRoger Pau Monné     evtchn_port_t port;
188*3a9fd824SRoger Pau Monné };
189*3a9fd824SRoger Pau Monné typedef struct evtchn_close evtchn_close_t;
190*3a9fd824SRoger Pau Monné 
191*3a9fd824SRoger Pau Monné /*
192*3a9fd824SRoger Pau Monné  * EVTCHNOP_send: Send an event to the remote end of the channel whose local
193*3a9fd824SRoger Pau Monné  * endpoint is <port>.
194*3a9fd824SRoger Pau Monné  */
195*3a9fd824SRoger Pau Monné struct evtchn_send {
196*3a9fd824SRoger Pau Monné     /* IN parameters. */
197*3a9fd824SRoger Pau Monné     evtchn_port_t port;
198*3a9fd824SRoger Pau Monné };
199*3a9fd824SRoger Pau Monné typedef struct evtchn_send evtchn_send_t;
200*3a9fd824SRoger Pau Monné 
201*3a9fd824SRoger Pau Monné /*
202*3a9fd824SRoger Pau Monné  * EVTCHNOP_status: Get the current status of the communication channel which
203*3a9fd824SRoger Pau Monné  * has an endpoint at <dom, port>.
204*3a9fd824SRoger Pau Monné  * NOTES:
205*3a9fd824SRoger Pau Monné  *  1. <dom> may be specified as DOMID_SELF.
206*3a9fd824SRoger Pau Monné  *  2. Only a sufficiently-privileged domain may obtain the status of an event
207*3a9fd824SRoger Pau Monné  *     channel for which <dom> is not DOMID_SELF.
208*3a9fd824SRoger Pau Monné  */
209*3a9fd824SRoger Pau Monné struct evtchn_status {
210*3a9fd824SRoger Pau Monné     /* IN parameters */
211*3a9fd824SRoger Pau Monné     domid_t  dom;
212*3a9fd824SRoger Pau Monné     evtchn_port_t port;
213*3a9fd824SRoger Pau Monné     /* OUT parameters */
214*3a9fd824SRoger Pau Monné #define EVTCHNSTAT_closed       0  /* Channel is not in use.                 */
215*3a9fd824SRoger Pau Monné #define EVTCHNSTAT_unbound      1  /* Channel is waiting interdom connection.*/
216*3a9fd824SRoger Pau Monné #define EVTCHNSTAT_interdomain  2  /* Channel is connected to remote domain. */
217*3a9fd824SRoger Pau Monné #define EVTCHNSTAT_pirq         3  /* Channel is bound to a phys IRQ line.   */
218*3a9fd824SRoger Pau Monné #define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
219*3a9fd824SRoger Pau Monné #define EVTCHNSTAT_ipi          5  /* Channel is bound to a virtual IPI line */
220*3a9fd824SRoger Pau Monné     uint32_t status;
221*3a9fd824SRoger Pau Monné     uint32_t vcpu;                 /* VCPU to which this channel is bound.   */
222*3a9fd824SRoger Pau Monné     union {
223*3a9fd824SRoger Pau Monné         struct {
224*3a9fd824SRoger Pau Monné             domid_t dom;
225*3a9fd824SRoger Pau Monné         } unbound;                 /* EVTCHNSTAT_unbound */
226*3a9fd824SRoger Pau Monné         struct {
227*3a9fd824SRoger Pau Monné             domid_t dom;
228*3a9fd824SRoger Pau Monné             evtchn_port_t port;
229*3a9fd824SRoger Pau Monné         } interdomain;             /* EVTCHNSTAT_interdomain */
230*3a9fd824SRoger Pau Monné         uint32_t pirq;             /* EVTCHNSTAT_pirq        */
231*3a9fd824SRoger Pau Monné         uint32_t virq;             /* EVTCHNSTAT_virq        */
232*3a9fd824SRoger Pau Monné     } u;
233*3a9fd824SRoger Pau Monné };
234*3a9fd824SRoger Pau Monné typedef struct evtchn_status evtchn_status_t;
235*3a9fd824SRoger Pau Monné 
236*3a9fd824SRoger Pau Monné /*
237*3a9fd824SRoger Pau Monné  * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
238*3a9fd824SRoger Pau Monné  * event is pending.
239*3a9fd824SRoger Pau Monné  * NOTES:
240*3a9fd824SRoger Pau Monné  *  1. IPI-bound channels always notify the vcpu specified at bind time.
241*3a9fd824SRoger Pau Monné  *     This binding cannot be changed.
242*3a9fd824SRoger Pau Monné  *  2. Per-VCPU VIRQ channels always notify the vcpu specified at bind time.
243*3a9fd824SRoger Pau Monné  *     This binding cannot be changed.
244*3a9fd824SRoger Pau Monné  *  3. All other channels notify vcpu0 by default. This default is set when
245*3a9fd824SRoger Pau Monné  *     the channel is allocated (a port that is freed and subsequently reused
246*3a9fd824SRoger Pau Monné  *     has its binding reset to vcpu0).
247*3a9fd824SRoger Pau Monné  */
248*3a9fd824SRoger Pau Monné struct evtchn_bind_vcpu {
249*3a9fd824SRoger Pau Monné     /* IN parameters. */
250*3a9fd824SRoger Pau Monné     evtchn_port_t port;
251*3a9fd824SRoger Pau Monné     uint32_t vcpu;
252*3a9fd824SRoger Pau Monné };
253*3a9fd824SRoger Pau Monné typedef struct evtchn_bind_vcpu evtchn_bind_vcpu_t;
254*3a9fd824SRoger Pau Monné 
255*3a9fd824SRoger Pau Monné /*
256*3a9fd824SRoger Pau Monné  * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
257*3a9fd824SRoger Pau Monné  * a notification to the appropriate VCPU if an event is pending.
258*3a9fd824SRoger Pau Monné  */
259*3a9fd824SRoger Pau Monné struct evtchn_unmask {
260*3a9fd824SRoger Pau Monné     /* IN parameters. */
261*3a9fd824SRoger Pau Monné     evtchn_port_t port;
262*3a9fd824SRoger Pau Monné };
263*3a9fd824SRoger Pau Monné typedef struct evtchn_unmask evtchn_unmask_t;
264*3a9fd824SRoger Pau Monné 
265*3a9fd824SRoger Pau Monné /*
266*3a9fd824SRoger Pau Monné  * EVTCHNOP_reset: Close all event channels associated with specified domain.
267*3a9fd824SRoger Pau Monné  * NOTES:
268*3a9fd824SRoger Pau Monné  *  1. <dom> may be specified as DOMID_SELF.
269*3a9fd824SRoger Pau Monné  *  2. Only a sufficiently-privileged domain may specify other than DOMID_SELF.
270*3a9fd824SRoger Pau Monné  *  3. Destroys all control blocks and event array, resets event channel
271*3a9fd824SRoger Pau Monné  *     operations to 2-level ABI if called with <dom> == DOMID_SELF and FIFO
272*3a9fd824SRoger Pau Monné  *     ABI was used. Guests should not bind events during EVTCHNOP_reset call
273*3a9fd824SRoger Pau Monné  *     as these events are likely to be lost.
274*3a9fd824SRoger Pau Monné  */
275*3a9fd824SRoger Pau Monné struct evtchn_reset {
276*3a9fd824SRoger Pau Monné     /* IN parameters. */
277*3a9fd824SRoger Pau Monné     domid_t dom;
278*3a9fd824SRoger Pau Monné };
279*3a9fd824SRoger Pau Monné typedef struct evtchn_reset evtchn_reset_t;
280*3a9fd824SRoger Pau Monné 
281*3a9fd824SRoger Pau Monné /*
282*3a9fd824SRoger Pau Monné  * EVTCHNOP_init_control: initialize the control block for the FIFO ABI.
283*3a9fd824SRoger Pau Monné  *
284*3a9fd824SRoger Pau Monné  * Note: any events that are currently pending will not be resent and
285*3a9fd824SRoger Pau Monné  * will be lost.  Guests should call this before binding any event to
286*3a9fd824SRoger Pau Monné  * avoid losing any events.
287*3a9fd824SRoger Pau Monné  */
288*3a9fd824SRoger Pau Monné struct evtchn_init_control {
289*3a9fd824SRoger Pau Monné     /* IN parameters. */
290*3a9fd824SRoger Pau Monné     uint64_t control_gfn;
291*3a9fd824SRoger Pau Monné     uint32_t offset;
292*3a9fd824SRoger Pau Monné     uint32_t vcpu;
293*3a9fd824SRoger Pau Monné     /* OUT parameters. */
294*3a9fd824SRoger Pau Monné     uint8_t link_bits;
295*3a9fd824SRoger Pau Monné     uint8_t _pad[7];
296*3a9fd824SRoger Pau Monné };
297*3a9fd824SRoger Pau Monné typedef struct evtchn_init_control evtchn_init_control_t;
298*3a9fd824SRoger Pau Monné 
299*3a9fd824SRoger Pau Monné /*
300*3a9fd824SRoger Pau Monné  * EVTCHNOP_expand_array: add an additional page to the event array.
301*3a9fd824SRoger Pau Monné  */
302*3a9fd824SRoger Pau Monné struct evtchn_expand_array {
303*3a9fd824SRoger Pau Monné     /* IN parameters. */
304*3a9fd824SRoger Pau Monné     uint64_t array_gfn;
305*3a9fd824SRoger Pau Monné };
306*3a9fd824SRoger Pau Monné typedef struct evtchn_expand_array evtchn_expand_array_t;
307*3a9fd824SRoger Pau Monné 
308*3a9fd824SRoger Pau Monné /*
309*3a9fd824SRoger Pau Monné  * EVTCHNOP_set_priority: set the priority for an event channel.
310*3a9fd824SRoger Pau Monné  */
311*3a9fd824SRoger Pau Monné struct evtchn_set_priority {
312*3a9fd824SRoger Pau Monné     /* IN parameters. */
313*3a9fd824SRoger Pau Monné     evtchn_port_t port;
314*3a9fd824SRoger Pau Monné     uint32_t priority;
315*3a9fd824SRoger Pau Monné };
316*3a9fd824SRoger Pau Monné typedef struct evtchn_set_priority evtchn_set_priority_t;
317*3a9fd824SRoger Pau Monné 
318*3a9fd824SRoger Pau Monné /*
319*3a9fd824SRoger Pau Monné  * ` enum neg_errnoval
320*3a9fd824SRoger Pau Monné  * ` HYPERVISOR_event_channel_op_compat(struct evtchn_op *op)
321*3a9fd824SRoger Pau Monné  * `
322*3a9fd824SRoger Pau Monné  * Superceded by new event_channel_op() hypercall since 0x00030202.
323*3a9fd824SRoger Pau Monné  */
324*3a9fd824SRoger Pau Monné struct evtchn_op {
325*3a9fd824SRoger Pau Monné     uint32_t cmd; /* enum event_channel_op */
326*3a9fd824SRoger Pau Monné     union {
327*3a9fd824SRoger Pau Monné         evtchn_alloc_unbound_t    alloc_unbound;
328*3a9fd824SRoger Pau Monné         evtchn_bind_interdomain_t bind_interdomain;
329*3a9fd824SRoger Pau Monné         evtchn_bind_virq_t        bind_virq;
330*3a9fd824SRoger Pau Monné         evtchn_bind_pirq_t        bind_pirq;
331*3a9fd824SRoger Pau Monné         evtchn_bind_ipi_t         bind_ipi;
332*3a9fd824SRoger Pau Monné         evtchn_close_t            close;
333*3a9fd824SRoger Pau Monné         evtchn_send_t             send;
334*3a9fd824SRoger Pau Monné         evtchn_status_t           status;
335*3a9fd824SRoger Pau Monné         evtchn_bind_vcpu_t        bind_vcpu;
336*3a9fd824SRoger Pau Monné         evtchn_unmask_t           unmask;
337*3a9fd824SRoger Pau Monné     } u;
338*3a9fd824SRoger Pau Monné };
339*3a9fd824SRoger Pau Monné typedef struct evtchn_op evtchn_op_t;
340*3a9fd824SRoger Pau Monné DEFINE_XEN_GUEST_HANDLE(evtchn_op_t);
341*3a9fd824SRoger Pau Monné 
342*3a9fd824SRoger Pau Monné /*
343*3a9fd824SRoger Pau Monné  * 2-level ABI
344*3a9fd824SRoger Pau Monné  */
345*3a9fd824SRoger Pau Monné 
346*3a9fd824SRoger Pau Monné #define EVTCHN_2L_NR_CHANNELS (sizeof(xen_ulong_t) * sizeof(xen_ulong_t) * 64)
347*3a9fd824SRoger Pau Monné 
348*3a9fd824SRoger Pau Monné /*
349*3a9fd824SRoger Pau Monné  * FIFO ABI
350*3a9fd824SRoger Pau Monné  */
351*3a9fd824SRoger Pau Monné 
352*3a9fd824SRoger Pau Monné /* Events may have priorities from 0 (highest) to 15 (lowest). */
353*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_PRIORITY_MAX     0
354*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_PRIORITY_DEFAULT 7
355*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_PRIORITY_MIN     15
356*3a9fd824SRoger Pau Monné 
357*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_MAX_QUEUES (EVTCHN_FIFO_PRIORITY_MIN + 1)
358*3a9fd824SRoger Pau Monné 
359*3a9fd824SRoger Pau Monné typedef uint32_t event_word_t;
360*3a9fd824SRoger Pau Monné 
361*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_PENDING 31
362*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_MASKED  30
363*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_LINKED  29
364*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_BUSY    28
365*3a9fd824SRoger Pau Monné 
366*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_LINK_BITS 17
367*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_LINK_MASK ((1 << EVTCHN_FIFO_LINK_BITS) - 1)
368*3a9fd824SRoger Pau Monné 
369*3a9fd824SRoger Pau Monné #define EVTCHN_FIFO_NR_CHANNELS (1 << EVTCHN_FIFO_LINK_BITS)
370*3a9fd824SRoger Pau Monné 
371*3a9fd824SRoger Pau Monné struct evtchn_fifo_control_block {
372*3a9fd824SRoger Pau Monné     uint32_t ready;
373*3a9fd824SRoger Pau Monné     uint32_t _rsvd;
374*3a9fd824SRoger Pau Monné     uint32_t head[EVTCHN_FIFO_MAX_QUEUES];
375*3a9fd824SRoger Pau Monné };
376*3a9fd824SRoger Pau Monné typedef struct evtchn_fifo_control_block evtchn_fifo_control_block_t;
377*3a9fd824SRoger Pau Monné 
378*3a9fd824SRoger Pau Monné #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
379*3a9fd824SRoger Pau Monné 
380*3a9fd824SRoger Pau Monné /*
381*3a9fd824SRoger Pau Monné  * Local variables:
382*3a9fd824SRoger Pau Monné  * mode: C
383*3a9fd824SRoger Pau Monné  * c-file-style: "BSD"
384*3a9fd824SRoger Pau Monné  * c-basic-offset: 4
385*3a9fd824SRoger Pau Monné  * tab-width: 4
386*3a9fd824SRoger Pau Monné  * indent-tabs-mode: nil
387*3a9fd824SRoger Pau Monné  * End:
388*3a9fd824SRoger Pau Monné  */
389