1 /******************************************************************************
4 * Event channels between domains.
6 * Copyright (c) 2003-2004, K A Fraser.
9 #ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
10 #define __XEN_PUBLIC_EVENT_CHANNEL_H__
13 * EVTCHNOP_alloc_unbound: Allocate a fresh local port and prepare
14 * it for binding to <dom>.
16 #define EVTCHNOP_alloc_unbound 6
23 } PACKED evtchn_alloc_unbound_t; /* 8 bytes */
26 * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
27 * <dom1> and <dom2>. Either <port1> or <port2> may be wildcarded by setting to
28 * zero. On successful return both <port1> and <port2> are filled in and
29 * <dom1,port1> is fully bound to <dom2,port2>.
32 * 1. A wildcarded port is allocated from the relevant domain's free list
33 * (i.e., some port that was previously EVTCHNSTAT_closed). However, if the
34 * remote port pair is already fully bound then a port is not allocated,
35 * and instead the existing local port is returned to the caller.
36 * 2. If the caller is unprivileged then <dom1> must be DOMID_SELF.
37 * 3. If the caller is unprivileged and <dom2,port2> is EVTCHNSTAT_closed
38 * then <dom2> must be DOMID_SELF.
39 * 4. If either port is already bound then it must be bound to the other
40 * specified domain and port (if not wildcarded).
41 * 5. If either port is awaiting binding (EVTCHNSTAT_unbound) then it must
42 * be awaiting binding to the other domain, and the other port pair must
43 * be closed or unbound.
45 #define EVTCHNOP_bind_interdomain 0
48 domid_t dom1, dom2; /* 0, 2 */
49 /* IN/OUT parameters. */
50 u32 port1, port2; /* 4, 8 */
51 } PACKED evtchn_bind_interdomain_t; /* 12 bytes */
54 * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
56 * 1. A virtual IRQ may be bound to at most one event channel per domain.
58 #define EVTCHNOP_bind_virq 1
64 } PACKED evtchn_bind_virq_t; /* 8 bytes */
67 * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
69 * 1. A physical IRQ may be bound to at most one event channel per domain.
70 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
72 #define EVTCHNOP_bind_pirq 2
76 #define BIND_PIRQ__WILL_SHARE 1
77 u32 flags; /* BIND_PIRQ__* */ /* 4 */
80 } PACKED evtchn_bind_pirq_t; /* 12 bytes */
83 * EVTCHNOP_close: Close the communication channel which has an endpoint at
84 * <dom, port>. If the channel is interdomain then the remote end is placed in
85 * the unbound state (EVTCHNSTAT_unbound), awaiting a new connection.
87 * 1. <dom> may be specified as DOMID_SELF.
88 * 2. Only a sufficiently-privileged domain may close an event channel
89 * for which <dom> is not DOMID_SELF.
91 #define EVTCHNOP_close 3
97 /* No OUT parameters. */
98 } PACKED evtchn_close_t; /* 8 bytes */
101 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
102 * endpoint is <DOMID_SELF, local_port>.
104 #define EVTCHNOP_send 4
107 u32 local_port; /* 0 */
108 /* No OUT parameters. */
109 } PACKED evtchn_send_t; /* 4 bytes */
112 * EVTCHNOP_status: Get the current status of the communication channel which
113 * has an endpoint at <dom, port>.
115 * 1. <dom> may be specified as DOMID_SELF.
116 * 2. Only a sufficiently-privileged domain may obtain the status of an event
117 * channel for which <dom> is not DOMID_SELF.
119 #define EVTCHNOP_status 5
126 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
127 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
128 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
129 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
130 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
131 #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
135 domid_t dom; /* 12 */
136 } PACKED unbound; /* EVTCHNSTAT_unbound */
138 domid_t dom; /* 12 */
141 } PACKED interdomain; /* EVTCHNSTAT_interdomain */
142 u32 pirq; /* EVTCHNSTAT_pirq */ /* 12 */
143 u32 virq; /* EVTCHNSTAT_virq */ /* 12 */
144 u32 ipi_edom; /* EVTCHNSTAT_ipi */ /* 12 */
146 } PACKED evtchn_status_t; /* 20 bytes */
149 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
151 #define EVTCHNOP_bind_ipi 7
154 u32 ipi_edom; /* 0 */
155 /* OUT parameters. */
157 } PACKED evtchn_bind_ipi_t; /* 8 bytes */
161 u32 cmd; /* EVTCHNOP_* */ /* 0 */
162 u32 __reserved; /* 4 */
164 evtchn_alloc_unbound_t alloc_unbound;
165 evtchn_bind_interdomain_t bind_interdomain;
166 evtchn_bind_virq_t bind_virq;
167 evtchn_bind_pirq_t bind_pirq;
168 evtchn_close_t close;
170 evtchn_status_t status;
171 evtchn_bind_ipi_t bind_ipi;
174 } PACKED evtchn_op_t; /* 32 bytes */
176 #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */