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__
12 #include <xen/interface/xen.h>
14 typedef uint32_t evtchn_port_t
;
15 DEFINE_GUEST_HANDLE(evtchn_port_t
);
18 * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
19 * accepting interdomain bindings from domain <remote_dom>. A fresh port
20 * is allocated in <dom> and returned as <port>.
22 * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
23 * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
25 #define EVTCHNOP_alloc_unbound 6
26 struct evtchn_alloc_unbound
{
28 domid_t dom
, remote_dom
;
34 * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
35 * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
36 * a port that is unbound and marked as accepting bindings from the calling
37 * domain. A fresh port is allocated in the calling domain and returned as
40 * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
42 #define EVTCHNOP_bind_interdomain 0
43 struct evtchn_bind_interdomain
{
46 evtchn_port_t remote_port
;
48 evtchn_port_t local_port
;
52 * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
55 * 1. A virtual IRQ may be bound to at most one event channel per vcpu.
56 * 2. The allocated event channel is bound to the specified vcpu. The binding
59 #define EVTCHNOP_bind_virq 1
60 struct evtchn_bind_virq
{
69 * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
71 * 1. A physical IRQ may be bound to at most one event channel per domain.
72 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
74 #define EVTCHNOP_bind_pirq 2
75 struct evtchn_bind_pirq
{
78 #define BIND_PIRQ__WILL_SHARE 1
79 uint32_t flags
; /* BIND_PIRQ__* */
85 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
87 * 1. The allocated event channel is bound to the specified vcpu. The binding
90 #define EVTCHNOP_bind_ipi 7
91 struct evtchn_bind_ipi
{
98 * EVTCHNOP_close: Close a local event channel <port>. If the channel is
99 * interdomain then the remote end is placed in the unbound state
100 * (EVTCHNSTAT_unbound), awaiting a new connection.
102 #define EVTCHNOP_close 3
103 struct evtchn_close
{
109 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
110 * endpoint is <port>.
112 #define EVTCHNOP_send 4
119 * EVTCHNOP_status: Get the current status of the communication channel which
120 * has an endpoint at <dom, port>.
122 * 1. <dom> may be specified as DOMID_SELF.
123 * 2. Only a sufficiently-privileged domain may obtain the status of an event
124 * channel for which <dom> is not DOMID_SELF.
126 #define EVTCHNOP_status 5
127 struct evtchn_status
{
132 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
133 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
134 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
135 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
136 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
137 #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
139 uint32_t vcpu
; /* VCPU to which this channel is bound. */
143 } unbound
; /* EVTCHNSTAT_unbound */
147 } interdomain
; /* EVTCHNSTAT_interdomain */
148 uint32_t pirq
; /* EVTCHNSTAT_pirq */
149 uint32_t virq
; /* EVTCHNSTAT_virq */
154 * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
157 * 1. IPI- and VIRQ-bound channels always notify the vcpu that initialised
158 * the binding. This binding cannot be changed.
159 * 2. All other channels notify vcpu0 by default. This default is set when
160 * the channel is allocated (a port that is freed and subsequently reused
161 * has its binding reset to vcpu0).
163 #define EVTCHNOP_bind_vcpu 8
164 struct evtchn_bind_vcpu
{
171 * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
172 * a notification to the appropriate VCPU if an event is pending.
174 #define EVTCHNOP_unmask 9
175 struct evtchn_unmask
{
181 uint32_t cmd
; /* EVTCHNOP_* */
183 struct evtchn_alloc_unbound alloc_unbound
;
184 struct evtchn_bind_interdomain bind_interdomain
;
185 struct evtchn_bind_virq bind_virq
;
186 struct evtchn_bind_pirq bind_pirq
;
187 struct evtchn_bind_ipi bind_ipi
;
188 struct evtchn_close close
;
189 struct evtchn_send send
;
190 struct evtchn_status status
;
191 struct evtchn_bind_vcpu bind_vcpu
;
192 struct evtchn_unmask unmask
;
195 DEFINE_GUEST_HANDLE_STRUCT(evtchn_op
);
197 #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */