ia64/xen-unstable

view xen/include/public/event_channel.h @ 9597:8f7aad20b4a5

Backtrack on the new interface for reserved event-channel
ports, as binding them in user space via the evtchn driver
would be a pain. Instead extend VIRQs so they can be
classified as 'global' or 'per vcpu'. The former can only
be allocated once per guest, but can be re-bound to
an arbitrary VCPU.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Apr 05 19:30:02 2006 +0100 (2006-04-05)
parents c445d4a0dd76
children 4e1b8be54311
line source
1 /******************************************************************************
2 * event_channel.h
3 *
4 * Event channels between domains.
5 *
6 * Copyright (c) 2003-2004, K A Fraser.
7 */
9 #ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
10 #define __XEN_PUBLIC_EVENT_CHANNEL_H__
12 typedef uint32_t evtchn_port_t;
13 DEFINE_GUEST_HANDLE(evtchn_port_t);
15 /*
16 * EVTCHNOP_alloc_unbound: Allocate a port in domain <dom> and mark as
17 * accepting interdomain bindings from domain <remote_dom>. A fresh port
18 * is allocated in <dom> and returned as <port>.
19 * NOTES:
20 * 1. If the caller is unprivileged then <dom> must be DOMID_SELF.
21 * 2. <rdom> may be DOMID_SELF, allowing loopback connections.
22 */
23 #define EVTCHNOP_alloc_unbound 6
24 typedef struct evtchn_alloc_unbound {
25 /* IN parameters */
26 domid_t dom, remote_dom;
27 /* OUT parameters */
28 evtchn_port_t port;
29 } evtchn_alloc_unbound_t;
31 /*
32 * EVTCHNOP_bind_interdomain: Construct an interdomain event channel between
33 * the calling domain and <remote_dom>. <remote_dom,remote_port> must identify
34 * a port that is unbound and marked as accepting bindings from the calling
35 * domain. A fresh port is allocated in the calling domain and returned as
36 * <local_port>.
37 * NOTES:
38 * 2. <remote_dom> may be DOMID_SELF, allowing loopback connections.
39 */
40 #define EVTCHNOP_bind_interdomain 0
41 typedef struct evtchn_bind_interdomain {
42 /* IN parameters. */
43 domid_t remote_dom;
44 evtchn_port_t remote_port;
45 /* OUT parameters. */
46 evtchn_port_t local_port;
47 } evtchn_bind_interdomain_t;
49 /*
50 * EVTCHNOP_bind_virq: Bind a local event channel to VIRQ <irq> on specified
51 * vcpu.
52 * NOTES:
53 * 1. Virtual IRQs are classified as per-vcpu or global. See the VIRQ list
54 * in xen.h for the classification of each VIRQ.
55 * 2. Global VIRQs must be allocated on VCPU0 but can subsequently be
56 * re-bound via EVTCHNOP_bind_vcpu.
57 * 3. Per-vcpu VIRQs may be bound to at most one event channel per vcpu.
58 * The allocated event channel is bound to the specified vcpu and the
59 * binding cannot be changed.
60 */
61 #define EVTCHNOP_bind_virq 1
62 typedef struct evtchn_bind_virq {
63 /* IN parameters. */
64 uint32_t virq;
65 uint32_t vcpu;
66 /* OUT parameters. */
67 evtchn_port_t port;
68 } evtchn_bind_virq_t;
70 /*
71 * EVTCHNOP_bind_pirq: Bind a local event channel to PIRQ <irq>.
72 * NOTES:
73 * 1. A physical IRQ may be bound to at most one event channel per domain.
74 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
75 */
76 #define EVTCHNOP_bind_pirq 2
77 typedef struct evtchn_bind_pirq {
78 /* IN parameters. */
79 uint32_t pirq;
80 #define BIND_PIRQ__WILL_SHARE 1
81 uint32_t flags; /* BIND_PIRQ__* */
82 /* OUT parameters. */
83 evtchn_port_t port;
84 } evtchn_bind_pirq_t;
86 /*
87 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
88 * NOTES:
89 * 1. The allocated event channel is bound to the specified vcpu. The binding
90 * may not be changed.
91 */
92 #define EVTCHNOP_bind_ipi 7
93 typedef struct evtchn_bind_ipi {
94 uint32_t vcpu;
95 /* OUT parameters. */
96 evtchn_port_t port;
97 } evtchn_bind_ipi_t;
99 /*
100 * EVTCHNOP_close: Close a local event channel <port>. If the channel is
101 * interdomain then the remote end is placed in the unbound state
102 * (EVTCHNSTAT_unbound), awaiting a new connection.
103 */
104 #define EVTCHNOP_close 3
105 typedef struct evtchn_close {
106 /* IN parameters. */
107 evtchn_port_t port;
108 } evtchn_close_t;
110 /*
111 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
112 * endpoint is <port>.
113 */
114 #define EVTCHNOP_send 4
115 typedef struct evtchn_send {
116 /* IN parameters. */
117 evtchn_port_t port;
118 } evtchn_send_t;
120 /*
121 * EVTCHNOP_status: Get the current status of the communication channel which
122 * has an endpoint at <dom, port>.
123 * NOTES:
124 * 1. <dom> may be specified as DOMID_SELF.
125 * 2. Only a sufficiently-privileged domain may obtain the status of an event
126 * channel for which <dom> is not DOMID_SELF.
127 */
128 #define EVTCHNOP_status 5
129 typedef struct evtchn_status {
130 /* IN parameters */
131 domid_t dom;
132 evtchn_port_t port;
133 /* OUT parameters */
134 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
135 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
136 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
137 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
138 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
139 #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
140 uint32_t status;
141 uint32_t vcpu; /* VCPU to which this channel is bound. */
142 union {
143 struct {
144 domid_t dom;
145 } unbound; /* EVTCHNSTAT_unbound */
146 struct {
147 domid_t dom;
148 evtchn_port_t port;
149 } interdomain; /* EVTCHNSTAT_interdomain */
150 uint32_t pirq; /* EVTCHNSTAT_pirq */
151 uint32_t virq; /* EVTCHNSTAT_virq */
152 } u;
153 } evtchn_status_t;
155 /*
156 * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
157 * event is pending.
158 * NOTES:
159 * 1. IPI-bound channels always notify the vcpu specified at bind time.
160 * This binding cannot be changed.
161 * 2. Per-VCPU VIRQ channels always notify the vcpu specified at bind time.
162 * This binding cannot be changed.
163 * 3. All other channels notify vcpu0 by default. This default is set when
164 * the channel is allocated (a port that is freed and subsequently reused
165 * has its binding reset to vcpu0).
166 */
167 #define EVTCHNOP_bind_vcpu 8
168 typedef struct evtchn_bind_vcpu {
169 /* IN parameters. */
170 evtchn_port_t port;
171 uint32_t vcpu;
172 } evtchn_bind_vcpu_t;
174 /*
175 * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver
176 * a notification to the appropriate VCPU if an event is pending.
177 */
178 #define EVTCHNOP_unmask 9
179 typedef struct evtchn_unmask {
180 /* IN parameters. */
181 evtchn_port_t port;
182 } evtchn_unmask_t;
184 typedef struct evtchn_op {
185 uint32_t cmd; /* EVTCHNOP_* */
186 union {
187 evtchn_alloc_unbound_t alloc_unbound;
188 evtchn_bind_interdomain_t bind_interdomain;
189 evtchn_bind_virq_t bind_virq;
190 evtchn_bind_pirq_t bind_pirq;
191 evtchn_bind_ipi_t bind_ipi;
192 evtchn_close_t close;
193 evtchn_send_t send;
194 evtchn_status_t status;
195 evtchn_bind_vcpu_t bind_vcpu;
196 evtchn_unmask_t unmask;
197 } u;
198 } evtchn_op_t;
199 DEFINE_GUEST_HANDLE(evtchn_op_t);
201 #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */
203 /*
204 * Local variables:
205 * mode: C
206 * c-set-style: "BSD"
207 * c-basic-offset: 4
208 * tab-width: 4
209 * indent-tabs-mode: nil
210 * End:
211 */