Xen Test Framework
argo.h
Go to the documentation of this file.
1/*
2 * Xen public ARGO hypercall interface
3 */
4
5#ifndef XEN_PUBLIC_ARGO_H
6#define XEN_PUBLIC_ARGO_H
7
8#define XEN_ARGO_DOMID_ANY DOMID_INVALID
9
10/* Fixed-width type for "argo port" number. Nothing to do with evtchns. */
12
13/* gfn type: 64-bit fixed-width on all architectures */
15
16typedef struct xen_argo_iov {
17 unsigned long iov_hnd;
21
22typedef struct xen_argo_addr {
27
28typedef struct xen_argo_send_addr {
32
33typedef struct xen_argo_ring {
34 /* Guests should use atomic operations to access rx_ptr */
36 /* Guests should use atomic operations to access tx_ptr */
38 /*
39 * Header space reserved for later use. Align the start of the ring to a
40 * multiple of the message slot size.
41 */
45
46typedef struct xen_argo_register_ring {
52
58
59/* Messages on the ring are padded to a multiple of this size. */
60#define XEN_ARGO_MSG_SLOT_SIZE 0x10
61
62/*
63 * Notify flags
64 */
65/* Ring exists */
66#define XEN_ARGO_RING_EXISTS (1U << 0)
67/* Ring is shared, not unicast */
68#define XEN_ARGO_RING_SHARED (1U << 1)
69/* Ring is empty */
70#define XEN_ARGO_RING_EMPTY (1U << 2)
71/* Sufficient space to queue space_required bytes might exist */
72#define XEN_ARGO_RING_SUFFICIENT (1U << 3)
73/* Insufficient ring size for space_required bytes */
74#define XEN_ARGO_RING_EMSGSIZE (1U << 4)
75/* Too many domains waiting for available space signals for this ring */
76#define XEN_ARGO_RING_EBUSY (1U << 5)
77
78typedef struct xen_argo_ring_data_ent {
85
86typedef struct xen_argo_ring_data {
89
90 /*
91 * The Xen headers have:
92 * struct xen_argo_ring_data_ent data[];
93 * here. It's useful for the hypervisor side of the interface, but really
94 * not for the client side.
95 */
97
103};
104
105/*
106 * Hypercall operations
107 */
108
109/*
110 * XEN_ARGO_OP_register_ring
111 *
112 * Register a ring using the guest-supplied memory pages.
113 * Also used to reregister an existing ring (eg. after resume from hibernate).
114 *
115 * The first argument struct indicates the port number for the ring to register
116 * and the partner domain, if any, that is to be allowed to send to the ring.
117 * A wildcard (XEN_ARGO_DOMID_ANY) may be supplied instead of a partner domid,
118 * and if the hypervisor has wildcard sender rings enabled, this will allow
119 * any domain (XSM notwithstanding) to send to the ring.
120 *
121 * The second argument is an array of guest frame numbers and the third argument
122 * indicates the size of the array. This operation only supports 4K-sized pages.
123 *
124 * arg1: XEN_GUEST_HANDLE(xen_argo_register_ring_t)
125 * arg2: XEN_GUEST_HANDLE(xen_argo_gfn_t)
126 * arg3: unsigned long npages
127 * arg4: unsigned long flags (32-bit value)
128 */
129#define XEN_ARGO_OP_register_ring 1
130
131/* Register op flags */
132/*
133 * Fail exist:
134 * If set, reject attempts to (re)register an existing established ring.
135 * If clear, reregistration occurs if the ring exists, with the new ring
136 * taking the place of the old, preserving tx_ptr if it remains valid.
137 */
138#define XEN_ARGO_REGISTER_FLAG_FAIL_EXIST 0x1
139
140/*
141 * XEN_ARGO_OP_unregister_ring
142 *
143 * Unregister a previously-registered ring, ending communication.
144 *
145 * arg1: XEN_GUEST_HANDLE(xen_argo_unregister_ring_t)
146 * arg2: NULL
147 * arg3: 0 (ZERO)
148 * arg4: 0 (ZERO)
149 */
150#define XEN_ARGO_OP_unregister_ring 2
151
152/*
153 * XEN_ARGO_OP_sendv
154 *
155 * Send a list of buffers contained in iovs.
156 *
157 * The send address struct specifies the source and destination addresses
158 * for the message being sent, which are used to find the destination ring:
159 * Xen first looks for a most-specific match with a registered ring with
160 * (id.addr == dst) and (id.partner == sending_domain) ;
161 * if that fails, it then looks for a wildcard match (aka multicast receiver)
162 * where (id.addr == dst) and (id.partner == DOMID_ANY).
163 *
164 * For each iov entry, send iov_len bytes from iov_base to the destination ring.
165 * If insufficient space exists in the destination ring, it will return -EAGAIN
166 * and Xen will notify the caller when sufficient space becomes available.
167 *
168 * The message type is a 32-bit data field available to communicate message
169 * context data (eg. kernel-to-kernel, rather than application layer).
170 *
171 * arg1: XEN_GUEST_HANDLE(xen_argo_send_addr_t) source and dest addresses
172 * arg2: XEN_GUEST_HANDLE(xen_argo_iov_t) iovs
173 * arg3: unsigned long niov
174 * arg4: unsigned long message type (32-bit value)
175 */
176#define XEN_ARGO_OP_sendv 3
177
178/*
179 * XEN_ARGO_OP_notify
180 *
181 * Asks Xen for information about other rings in the system.
182 *
183 * ent->ring is the xen_argo_addr_t of the ring you want information on.
184 * Uses the same ring matching rules as XEN_ARGO_OP_sendv.
185 *
186 * ent->space_required : if this field is not null then Xen will check
187 * that there is space in the destination ring for this many bytes of payload.
188 * If the ring is too small for the requested space_required, it will set the
189 * XEN_ARGO_RING_EMSGSIZE flag on return.
190 * If sufficient space is available, it will set XEN_ARGO_RING_SUFFICIENT
191 * and CANCEL any pending notification for that ent->ring; otherwise it
192 * will schedule a notification event and the flag will not be set.
193 *
194 * These flags are set by Xen when notify replies:
195 * XEN_ARGO_RING_EXISTS ring exists
196 * XEN_ARGO_RING_SHARED ring is registered for wildcard partner
197 * XEN_ARGO_RING_EMPTY ring is empty
198 * XEN_ARGO_RING_SUFFICIENT sufficient space for space_required is there
199 * XEN_ARGO_RING_EMSGSIZE space_required is too large for the ring size
200 * XEN_ARGO_RING_EBUSY too many domains waiting for available space signals
201 *
202 * arg1: XEN_GUEST_HANDLE(xen_argo_ring_data_t) ring_data (may be NULL)
203 * arg2: NULL
204 * arg3: 0 (ZERO)
205 * arg4: 0 (ZERO)
206 */
207#define XEN_ARGO_OP_notify 4
208
209#endif /* XEN_PUBLIC_ARGO_H */
210
211/*
212 * Local variables:
213 * mode: C
214 * c-file-style: "BSD"
215 * c-basic-offset: 4
216 * tab-width: 4
217 * indent-tabs-mode: nil
218 * End:
219 */
struct xen_argo_ring xen_argo_ring_t
struct xen_argo_iov xen_argo_iov_t
struct xen_argo_register_ring xen_argo_register_ring_t
struct xen_argo_addr xen_argo_addr_t
struct xen_argo_unregister_ring xen_argo_unregister_ring_t
uint64_t xen_argo_gfn_t
Definition: argo.h:14
struct xen_argo_send_addr xen_argo_send_addr_t
struct xen_argo_ring_data_ent xen_argo_ring_data_ent_t
struct xen_argo_ring_data xen_argo_ring_data_t
uint32_t xen_argo_port_t
Definition: argo.h:11
__UINT32_TYPE__ uint32_t
Definition: stdint.h:16
__UINT64_TYPE__ uint64_t
Definition: stdint.h:17
__UINT8_TYPE__ uint8_t
Definition: stdint.h:14
__UINT16_TYPE__ uint16_t
Definition: stdint.h:15
uint16_t pad
Definition: argo.h:25
xen_argo_port_t aport
Definition: argo.h:23
domid_t domain_id
Definition: argo.h:24
uint32_t iov_len
Definition: argo.h:18
unsigned long iov_hnd
Definition: argo.h:17
uint32_t pad
Definition: argo.h:19
uint16_t pad
Definition: argo.h:49
xen_argo_port_t aport
Definition: argo.h:47
uint32_t len
Definition: argo.h:50
domid_t partner_id
Definition: argo.h:48
uint32_t space_required
Definition: argo.h:82
struct xen_argo_addr ring
Definition: argo.h:79
uint16_t flags
Definition: argo.h:80
uint16_t pad
Definition: argo.h:81
uint32_t max_message_size
Definition: argo.h:83
uint32_t nent
Definition: argo.h:87
uint32_t pad
Definition: argo.h:88
struct xen_argo_addr source
Definition: argo.h:100
uint32_t rx_ptr
Definition: argo.h:35
uint8_t ring[]
Definition: argo.h:43
uint32_t tx_ptr
Definition: argo.h:37
uint8_t reserved[56]
Definition: argo.h:42
struct xen_argo_addr dst
Definition: argo.h:30
struct xen_argo_addr src
Definition: argo.h:29
xen_argo_port_t aport
Definition: argo.h:54
domid_t partner_id
Definition: argo.h:55
uint16_t domid_t
Definition: xen.h:66