direct-io.hg

view xen/include/hypervisor-ifs/event_channel.h @ 2714:77fbe6c094f2

bitkeeper revision 1.1159.1.261 (41792d94c9Ck-m72kpZkL5_a2aSoZA)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0
into freefall.cl.cam.ac.uk:/local/scratch/cl349/xeno.bk-24dom0
author cl349@freefall.cl.cam.ac.uk
date Fri Oct 22 15:56:04 2004 +0000 (2004-10-22)
parents bd1640d9d7d4 06527e1d6757
children
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 __HYPERVISOR_IFS__EVENT_CHANNEL_H__
10 #define __HYPERVISOR_IFS__EVENT_CHANNEL_H__
12 /*
13 * EVTCHNOP_alloc_unbound: Allocate a fresh local port and prepare
14 * it for binding to <dom>.
15 */
16 #define EVTCHNOP_alloc_unbound 6
17 typedef struct {
18 /* IN parameters */
19 domid_t dom; /* 0 */
20 u16 __pad;
21 /* OUT parameters */
22 u32 port; /* 4 */
23 } PACKED evtchn_alloc_unbound_t; /* 8 bytes */
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 {
47 /* IN parameters. */
48 domid_t dom1, dom2; /* 0, 2 */
49 /* IN/OUT parameters. */
50 u32 port1, port2; /* 4, 8 */
51 } PACKED evtchn_bind_interdomain_t; /* 12 bytes */
53 /*
54 * EVTCHNOP_bind_virq: Bind a local event channel to IRQ <irq>.
55 * NOTES:
56 * 1. A virtual IRQ may be bound to at most one event channel per domain.
57 */
58 #define EVTCHNOP_bind_virq 1
59 typedef struct {
60 /* IN parameters. */
61 u32 virq; /* 0 */
62 /* OUT parameters. */
63 u32 port; /* 4 */
64 } PACKED evtchn_bind_virq_t; /* 8 bytes */
66 /*
67 * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
68 * NOTES:
69 * 1. A physical IRQ may be bound to at most one event channel per domain.
70 * 2. Only a sufficiently-privileged domain may bind to a physical IRQ.
71 */
72 #define EVTCHNOP_bind_pirq 2
73 typedef struct {
74 /* IN parameters. */
75 u32 pirq; /* 0 */
76 #define BIND_PIRQ__WILL_SHARE 1
77 u32 flags; /* BIND_PIRQ__* */ /* 4 */
78 /* OUT parameters. */
79 u32 port; /* 8 */
80 } PACKED evtchn_bind_pirq_t; /* 12 bytes */
82 /*
83 * EVTCHNOP_close: Close the communication channel which has an endpoint at
84 * <dom, port>. If the channel is interdomain then the remote end is placed in
85 * the unbound state (EVTCHNSTAT_unbound), awaiting a new connection.
86 * NOTES:
87 * 1. <dom> may be specified as DOMID_SELF.
88 * 2. Only a sufficiently-privileged domain may close an event channel
89 * for which <dom> is not DOMID_SELF.
90 */
91 #define EVTCHNOP_close 3
92 typedef struct {
93 /* IN parameters. */
94 domid_t dom; /* 0 */
95 u16 __pad;
96 u32 port; /* 4 */
97 /* No OUT parameters. */
98 } PACKED evtchn_close_t; /* 8 bytes */
100 /*
101 * EVTCHNOP_send: Send an event to the remote end of the channel whose local
102 * endpoint is <DOMID_SELF, local_port>.
103 */
104 #define EVTCHNOP_send 4
105 typedef struct {
106 /* IN parameters. */
107 u32 local_port; /* 0 */
108 /* No OUT parameters. */
109 } PACKED evtchn_send_t; /* 4 bytes */
111 /*
112 * EVTCHNOP_status: Get the current status of the communication channel which
113 * has an endpoint at <dom, port>.
114 * NOTES:
115 * 1. <dom> may be specified as DOMID_SELF.
116 * 2. Only a sufficiently-privileged domain may obtain the status of an event
117 * channel for which <dom> is not DOMID_SELF.
118 */
119 #define EVTCHNOP_status 5
120 typedef struct {
121 /* IN parameters */
122 domid_t dom; /* 0 */
123 u16 __pad;
124 u32 port; /* 4 */
125 /* OUT parameters */
126 #define EVTCHNSTAT_closed 0 /* Channel is not in use. */
127 #define EVTCHNSTAT_unbound 1 /* Channel is waiting interdom connection.*/
128 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
129 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
130 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
131 u32 status; /* 8 */
132 union { /* 12 */
133 struct {
134 domid_t dom; /* 12 */
135 } PACKED unbound; /* EVTCHNSTAT_unbound */
136 struct {
137 domid_t dom; /* 12 */
138 u16 __pad;
139 u32 port; /* 16 */
140 } PACKED interdomain; /* EVTCHNSTAT_interdomain */
141 u32 pirq; /* EVTCHNSTAT_pirq */ /* 12 */
142 u32 virq; /* EVTCHNSTAT_virq */ /* 12 */
143 } PACKED u;
144 } PACKED evtchn_status_t; /* 20 bytes */
146 typedef struct {
147 u32 cmd; /* EVTCHNOP_* */ /* 0 */
148 u32 __reserved; /* 4 */
149 union { /* 8 */
150 evtchn_alloc_unbound_t alloc_unbound;
151 evtchn_bind_interdomain_t bind_interdomain;
152 evtchn_bind_virq_t bind_virq;
153 evtchn_bind_pirq_t bind_pirq;
154 evtchn_close_t close;
155 evtchn_send_t send;
156 evtchn_status_t status;
157 u8 __dummy[24];
158 } PACKED u;
159 } PACKED evtchn_op_t; /* 32 bytes */
161 #endif /* __HYPERVISOR_IFS__EVENT_CHANNEL_H__ */