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 * Prototype for this hypercall is:
14 * int event_channel_op(int cmd, void *args)
15 * @cmd == EVTCHNOP_??? (event-channel operation).
16 * @args == Operation-specific extra arguments (NULL if none).
19 typedef uint32_t evtchn_port_t;
20 DEFINE_XEN_GUEST_HANDLE(evtchn_port_t);
23 * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
24 * accepting interdomain bindings from domain <remote_dom>. A fresh port
25 * is allocated in <dom> and returned as <port>.
27 * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
28 * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
30 #define EVTCHNOP_alloc_unbound 6
31 struct evtchn_alloc_unbound {
33 domid_t dom, remote_dom;
37 typedef struct evtchn_alloc_unbound evtchn_alloc_unbound_t;
40 * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
41 * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
42 * a port that is unbound and marked as accepting bindings from the calling
43 * domain. A fresh port is allocated in the calling domain and returned as
46 * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
48 #define EVTCHNOP_bind_interdomain 0
49 struct evtchn_bind_interdomain {
52 evtchn_port_t remote_port;
54 evtchn_port_t local_port;
56 typedef struct evtchn_bind_interdomain evtchn_bind_interdomain_t;
59 * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
62 * 1. Virtual IRQs are classified as per-vcpu or global. See the VIRQ list
63 * in xen.h for the classification of each VIRQ.
64 * 2. Global VIRQs must be allocated on VCPU0 but can subsequently be
65 * re-bound via EVTCHNOP_bind_vcpu.
66 * 3. Per-vcpu VIRQs may be bound to at most one event channel per vcpu.
67 * The allocated event channel is bound to the specified vcpu and the
68 * binding cannot be changed.
70 #define EVTCHNOP_bind_virq 1
71 struct evtchn_bind_virq {
78 typedef struct evtchn_bind_virq evtchn_bind_virq_t;
81 * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
83 * 1. A physical IRQ may be bound to at most one event channel per domain.
84 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
86 #define EVTCHNOP_bind_pirq 2
87 struct evtchn_bind_pirq {
90 #define BIND_PIRQ__WILL_SHARE 1
91 uint32_t flags; /* BIND_PIRQ__* */
95 typedef struct evtchn_bind_pirq evtchn_bind_pirq_t;
98 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
100 * 1. The allocated event channel is bound to the specified vcpu. The binding
101 * may not be changed.
103 #define EVTCHNOP_bind_ipi 7
104 struct evtchn_bind_ipi {
106 /* OUT parameters. */
109 typedef struct evtchn_bind_ipi evtchn_bind_ipi_t;
112 * EVTCHNOP_close: Close a local event channel <port>. If the channel is
113 * interdomain then the remote end is placed in the unbound state
114 * (EVTCHNSTAT_unbound), awaiting a new connection.
116 #define EVTCHNOP_close 3
117 struct evtchn_close {
121 typedef struct evtchn_close evtchn_close_t;
124 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
125 * endpoint is <port>.
127 #define EVTCHNOP_send 4
132 typedef struct evtchn_send evtchn_send_t;
135 * EVTCHNOP_status: Get the current status of the communication channel which
136 * has an endpoint at <dom, port>.
138 * 1. <dom> may be specified as DOMID_SELF.
139 * 2. Only a sufficiently-privileged domain may obtain the status of an event
140 * channel for which <dom> is not DOMID_SELF.
142 #define EVTCHNOP_status 5
143 struct evtchn_status {
148 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
149 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
150 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
151 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
152 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
153 #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
155 uint32_t vcpu; /* VCPU to which this channel is bound. */
159 } unbound; /* EVTCHNSTAT_unbound */
163 } interdomain; /* EVTCHNSTAT_interdomain */
164 uint32_t pirq; /* EVTCHNSTAT_pirq */
165 uint32_t virq; /* EVTCHNSTAT_virq */
168 typedef struct evtchn_status evtchn_status_t;
171 * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
174 * 1. IPI-bound channels always notify the vcpu specified at bind time.
175 * This binding cannot be changed.
176 * 2. Per-VCPU VIRQ channels always notify the vcpu specified at bind time.
177 * This binding cannot be changed.
178 * 3. All other channels notify vcpu0 by default. This default is set when
179 * the channel is allocated (a port that is freed and subsequently reused
180 * has its binding reset to vcpu0).
182 #define EVTCHNOP_bind_vcpu 8
183 struct evtchn_bind_vcpu {
188 typedef struct evtchn_bind_vcpu evtchn_bind_vcpu_t;
191 * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
192 * a notification to the appropriate VCPU if an event is pending.
194 #define EVTCHNOP_unmask 9
195 struct evtchn_unmask {
199 typedef struct evtchn_unmask evtchn_unmask_t;
202 * Argument to event_channel_op_compat() hypercall. Superceded by new
203 * event_channel_op() hypercall since 0x00030202.
206 uint32_t cmd; /* EVTCHNOP_* */
208 struct evtchn_alloc_unbound alloc_unbound;
209 struct evtchn_bind_interdomain bind_interdomain;
210 struct evtchn_bind_virq bind_virq;
211 struct evtchn_bind_pirq bind_pirq;
212 struct evtchn_bind_ipi bind_ipi;
213 struct evtchn_close close;
214 struct evtchn_send send;
215 struct evtchn_status status;
216 struct evtchn_bind_vcpu bind_vcpu;
217 struct evtchn_unmask unmask;
220 typedef struct evtchn_op evtchn_op_t;
221 DEFINE_XEN_GUEST_HANDLE(evtchn_op_t);
223 #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
231 * indent-tabs-mode: nil