ia64/xen-unstable

view xen/include/public/event_channel.h @ 5704:9b73afea874e

Certain types of event channel are now auto-bound to vcpu0 by Xen.
Make sure that xenolinux agrees with this.
author sos22@douglas.cl.cam.ac.uk
date Fri Jul 08 15:35:43 2005 +0000 (2005-07-08)
parents 1d375ce8e0e0
children 215d8b2f3d94
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 /*
13 * EVTCHNOP_alloc_unbound: Prepare a local port for binding to <dom>.
14 * <port> may be wildcarded by setting to zero, in which case a fresh port
15 * will be allocated, and the field filled in on return.
16 */
17 #define EVTCHNOP_alloc_unbound 6
18 typedef struct evtchn_alloc_unbound {
19 /* IN parameters */
20 domid_t dom;
21 /* IN/OUT parameters */
22 u32 port;
23 } evtchn_alloc_unbound_t;
25 /*
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>.
30 *
31 * NOTES:
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.
44 */
45 #define EVTCHNOP_bind_interdomain 0
46 typedef struct evtchn_bind_interdomain {
47 /* IN parameters. */
48 domid_t dom1, dom2;
49 /* IN/OUT parameters. */
50 u32 port1, port2;
51 } evtchn_bind_interdomain_t;
53 /*
54 * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq> on calling vcpu.
55 * NOTES:
56 * 1. A virtual IRQ may be bound to at most one event channel per vcpu.
57 * 2. The allocated event channel is bound to the calling vcpu. The binding
58 * may not be changed.
59 */
60 #define EVTCHNOP_bind_virq 1
61 typedef struct evtchn_bind_virq {
62 /* IN parameters. */
63 u32 virq;
64 /* OUT parameters. */
65 u32 port;
66 } evtchn_bind_virq_t;
68 /*
69 * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
70 * NOTES:
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.
73 */
74 #define EVTCHNOP_bind_pirq 2
75 typedef struct evtchn_bind_pirq {
76 /* IN parameters. */
77 u32 pirq;
78 #define BIND_PIRQ__WILL_SHARE 1
79 u32 flags; /* BIND_PIRQ__* */
80 /* OUT parameters. */
81 u32 port;
82 } evtchn_bind_pirq_t;
84 /*
85 * EVTCHNOP_bind_ipi: Bind a local event channel to receive events.
86 * NOTES:
87 * 1. The allocated event channel is bound to the calling vcpu. The binding
88 * may not be changed.
89 */
90 #define EVTCHNOP_bind_ipi 7
91 typedef struct evtchn_bind_ipi {
92 /* OUT parameters. */
93 u32 port;
94 } evtchn_bind_ipi_t;
96 /*
97 * EVTCHNOP_close: Close the communication channel which has an endpoint at
98 * <dom, port>. If the channel is interdomain then the remote end is placed in
99 * the unbound state (EVTCHNSTAT_unbound), awaiting a new connection.
100 * NOTES:
101 * 1. <dom> may be specified as DOMID_SELF.
102 * 2. Only a sufficiently-privileged domain may close an event channel
103 * for which <dom> is not DOMID_SELF.
104 */
105 #define EVTCHNOP_close 3
106 typedef struct evtchn_close {
107 /* IN parameters. */
108 domid_t dom;
109 u32 port;
110 /* No OUT parameters. */
111 } evtchn_close_t;
113 /*
114 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
115 * endpoint is <DOMID_SELF, local_port>.
116 */
117 #define EVTCHNOP_send 4
118 typedef struct evtchn_send {
119 /* IN parameters. */
120 u32 local_port;
121 /* No OUT parameters. */
122 } evtchn_send_t;
124 /*
125 * EVTCHNOP_status: Get the current status of the communication channel which
126 * has an endpoint at <dom, port>.
127 * NOTES:
128 * 1. <dom> may be specified as DOMID_SELF.
129 * 2. Only a sufficiently-privileged domain may obtain the status of an event
130 * channel for which <dom> is not DOMID_SELF.
131 */
132 #define EVTCHNOP_status 5
133 typedef struct evtchn_status {
134 /* IN parameters */
135 domid_t dom;
136 u32 port;
137 /* OUT parameters */
138 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
139 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
140 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
141 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
142 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
143 #define EVTCHNSTAT_ipi 5 /* Channel is bound to a virtual IPI line */
144 u32 status;
145 u32 vcpu; /* VCPU to which this channel is bound. */
146 union {
147 struct {
148 domid_t dom;
149 } unbound; /* EVTCHNSTAT_unbound */
150 struct {
151 domid_t dom;
152 u32 port;
153 } interdomain; /* EVTCHNSTAT_interdomain */
154 u32 pirq; /* EVTCHNSTAT_pirq */
155 u32 virq; /* EVTCHNSTAT_virq */
156 } u;
157 } evtchn_status_t;
159 /*
160 * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
161 * event is pending.
162 * NOTES:
163 * 1. IPI- and VIRQ-bound channels always notify the vcpu that initialised
164 * the binding. This binding cannot be changed.
165 * 2. All other channels notify vcpu0 by default. This default is set when
166 * the channel is allocated (a port that is freed and subsequently reused
167 * has its binding reset to vcpu0).
168 */
169 #define EVTCHNOP_bind_vcpu 8
170 typedef struct evtchn_bind_vcpu {
171 /* IN parameters. */
172 u32 port;
173 u32 vcpu;
174 } evtchn_bind_vcpu_t;
176 typedef struct evtchn_op {
177 u32 cmd; /* EVTCHNOP_* */
178 union {
179 evtchn_alloc_unbound_t alloc_unbound;
180 evtchn_bind_interdomain_t bind_interdomain;
181 evtchn_bind_virq_t bind_virq;
182 evtchn_bind_pirq_t bind_pirq;
183 evtchn_bind_ipi_t bind_ipi;
184 evtchn_close_t close;
185 evtchn_send_t send;
186 evtchn_status_t status;
187 evtchn_bind_vcpu_t bind_vcpu;
188 } u;
189 } evtchn_op_t;
191 #endif /* __XEN_PUBLIC_EVENT_CHANNEL_H__ */