direct-io.hg

view xen/include/public/event_channel.h @ 8151:f5b119533cc8

Define explicit evtchn_port_t type (32 bits) and plumb up
to user space thru /dev/xen/evtchn.

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