ia64/xen-unstable

view linux-2.6.7-xen-sparse/include/asm-xen/domain_controller.h @ 1820:3d4f8eb89670

bitkeeper revision 1.1106.1.2 (40faa780dekT3E5arFwcbQDu1MbX6g)

Cleaned up Xen's instruction emulator.
author kaf24@scramble.cl.cam.ac.uk
date Sun Jul 18 16:38:24 2004 +0000 (2004-07-18)
parents 002fc84add90
children
line source
1 /******************************************************************************
2 * domain_controller.h
3 *
4 * Interface to server controller (e.g., 'xend'). This header file defines the
5 * interface that is shared with guest OSes.
6 *
7 * Copyright (c) 2004, K A Fraser
8 */
10 #ifndef __DOMAIN_CONTROLLER_H__
11 #define __DOMAIN_CONTROLLER_H__
14 #ifndef BASIC_START_INFO
15 #error "Xen header file hypervisor-if.h must already be included here."
16 #endif
19 /*
20 * EXTENDED BOOTSTRAP STRUCTURE FOR NEW DOMAINS.
21 */
23 typedef struct {
24 BASIC_START_INFO;
25 u16 domain_controller_evtchn; /* 320 */
26 } PACKED extended_start_info_t; /* 322 bytes */
27 #define SIF_BLK_BE_DOMAIN (1<<4) /* Is this a block backend domain? */
28 #define SIF_NET_BE_DOMAIN (1<<5) /* Is this a net backend domain? */
31 /*
32 * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
33 * interpreted by control software to determine the appropriate action. These
34 * are only really advisories: the controller can actually do as it likes.
35 */
36 #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
37 #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
38 #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
41 /*
42 * CONTROLLER MESSAGING INTERFACE.
43 */
45 typedef struct {
46 u8 type; /* 0: echoed in response */
47 u8 subtype; /* 1: echoed in response */
48 u8 id; /* 2: echoed in response */
49 u8 length; /* 3: number of bytes in 'msg' */
50 u8 msg[60]; /* 4: type-specific message data */
51 } PACKED control_msg_t; /* 64 bytes */
53 #define CONTROL_RING_SIZE 8
54 typedef u32 CONTROL_RING_IDX;
55 #define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
57 typedef struct {
58 control_msg_t tx_ring[CONTROL_RING_SIZE]; /* 0: guest -> controller */
59 control_msg_t rx_ring[CONTROL_RING_SIZE]; /* 512: controller -> guest */
60 CONTROL_RING_IDX tx_req_prod, tx_resp_prod; /* 1024, 1028 */
61 CONTROL_RING_IDX rx_req_prod, rx_resp_prod; /* 1032, 1036 */
62 } PACKED control_if_t; /* 1040 bytes */
64 /*
65 * Top-level command types.
66 */
67 #define CMSG_CONSOLE 0 /* Console */
68 #define CMSG_BLKIF_BE 1 /* Block-device backend */
69 #define CMSG_BLKIF_FE 2 /* Block-device frontend */
70 #define CMSG_NETIF_BE 3 /* Network-device backend */
71 #define CMSG_NETIF_FE 4 /* Network-device frontend */
72 #define CMSG_SHUTDOWN 6 /* Shutdown messages */
75 /******************************************************************************
76 * CONSOLE DEFINITIONS
77 */
79 /*
80 * Subtypes for console messages.
81 */
82 #define CMSG_CONSOLE_DATA 0
85 /******************************************************************************
86 * BLOCK-INTERFACE FRONTEND DEFINITIONS
87 */
89 /* Messages from domain controller to guest. */
90 #define CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED 0
92 /* Messages from guest to domain controller. */
93 #define CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED 32
94 #define CMSG_BLKIF_FE_INTERFACE_CONNECT 33
95 #define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34
97 /* These are used by both front-end and back-end drivers. */
98 #define blkif_vdev_t u16
99 #define blkif_pdev_t u16
100 #define blkif_sector_t u64
102 /*
103 * CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED:
104 * Notify a guest about a status change on one of its block interfaces.
105 * If the interface is DESTROYED or DOWN then the interface is disconnected:
106 * 1. The shared-memory frame is available for reuse.
107 * 2. Any unacknowledged messgaes pending on the interface were dropped.
108 */
109 #define BLKIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */
110 #define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
111 #define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
112 typedef struct {
113 u32 handle; /* 0 */
114 u32 status; /* 4 */
115 u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
116 } PACKED blkif_fe_interface_status_changed_t; /* 10 bytes */
118 /*
119 * CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED:
120 * Notify the domain controller that the front-end driver is DOWN or UP.
121 * When the driver goes DOWN then the controller will send no more
122 * status-change notifications. When the driver comes UP then the controller
123 * will send a notification for each interface that currently exists.
124 * If the driver goes DOWN while interfaces are still UP, the domain
125 * will automatically take the interfaces DOWN.
126 */
127 #define BLKIF_DRIVER_STATUS_DOWN 0
128 #define BLKIF_DRIVER_STATUS_UP 1
129 typedef struct {
130 /* IN */
131 u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
132 /* OUT */
133 /*
134 * Tells driver how many interfaces it should expect to immediately
135 * receive notifications about.
136 */
137 u32 nr_interfaces; /* 4 */
138 } PACKED blkif_fe_driver_status_changed_t; /* 8 bytes */
140 /*
141 * CMSG_BLKIF_FE_INTERFACE_CONNECT:
142 * If successful, the domain controller will acknowledge with a
143 * STATUS_CONNECTED message.
144 */
145 typedef struct {
146 u32 handle; /* 0 */
147 u32 __pad;
148 memory_t shmem_frame; /* 8 */
149 MEMORY_PADDING;
150 } PACKED blkif_fe_interface_connect_t; /* 16 bytes */
152 /*
153 * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
154 * If successful, the domain controller will acknowledge with a
155 * STATUS_DISCONNECTED message.
156 */
157 typedef struct {
158 u32 handle; /* 0 */
159 } PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */
162 /******************************************************************************
163 * BLOCK-INTERFACE BACKEND DEFINITIONS
164 */
166 /* Messages from domain controller. */
167 #define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */
168 #define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */
169 #define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
170 #define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
171 #define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */
172 #define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */
173 #define CMSG_BLKIF_BE_VBD_GROW 6 /* Append an extent to a given VBD. */
174 #define CMSG_BLKIF_BE_VBD_SHRINK 7 /* Remove last extent from a given VBD. */
176 /* Messages to domain controller. */
177 #define CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED 32
179 /*
180 * Message request/response definitions for block-device messages.
181 */
183 typedef struct {
184 blkif_sector_t sector_start; /* 0 */
185 blkif_sector_t sector_length; /* 8 */
186 blkif_pdev_t device; /* 16 */
187 u16 __pad; /* 18 */
188 } PACKED blkif_extent_t; /* 20 bytes */
190 /* Non-specific 'okay' return. */
191 #define BLKIF_BE_STATUS_OKAY 0
192 /* Non-specific 'error' return. */
193 #define BLKIF_BE_STATUS_ERROR 1
194 /* The following are specific error returns. */
195 #define BLKIF_BE_STATUS_INTERFACE_EXISTS 2
196 #define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
197 #define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
198 #define BLKIF_BE_STATUS_VBD_EXISTS 5
199 #define BLKIF_BE_STATUS_VBD_NOT_FOUND 6
200 #define BLKIF_BE_STATUS_OUT_OF_MEMORY 7
201 #define BLKIF_BE_STATUS_EXTENT_NOT_FOUND 8
202 #define BLKIF_BE_STATUS_MAPPING_ERROR 9
204 /* This macro can be used to create an array of descriptive error strings. */
205 #define BLKIF_BE_STATUS_ERRORS { \
206 "Okay", \
207 "Non-specific error", \
208 "Interface already exists", \
209 "Interface not found", \
210 "Interface is still connected", \
211 "VBD already exists", \
212 "VBD not found", \
213 "Out of memory", \
214 "Extent not found for VBD", \
215 "Could not map domain memory" }
217 /*
218 * CMSG_BLKIF_BE_CREATE:
219 * When the driver sends a successful response then the interface is fully
220 * created. The controller will send a DOWN notification to the front-end
221 * driver.
222 */
223 typedef struct {
224 /* IN */
225 domid_t domid; /* 0: Domain attached to new interface. */
226 u32 blkif_handle; /* 4: Domain-specific interface handle. */
227 /* OUT */
228 u32 status; /* 8 */
229 } PACKED blkif_be_create_t; /* 12 bytes */
231 /*
232 * CMSG_BLKIF_BE_DESTROY:
233 * When the driver sends a successful response then the interface is fully
234 * torn down. The controller will send a DESTROYED notification to the
235 * front-end driver.
236 */
237 typedef struct {
238 /* IN */
239 domid_t domid; /* 0: Identify interface to be destroyed. */
240 u32 blkif_handle; /* 4: ...ditto... */
241 /* OUT */
242 u32 status; /* 8 */
243 } PACKED blkif_be_destroy_t; /* 12 bytes */
245 /*
246 * CMSG_BLKIF_BE_CONNECT:
247 * When the driver sends a successful response then the interface is fully
248 * connected. The controller will send a CONNECTED notification to the
249 * front-end driver.
250 */
251 typedef struct {
252 /* IN */
253 domid_t domid; /* 0: Domain attached to new interface. */
254 u32 blkif_handle; /* 4: Domain-specific interface handle. */
255 memory_t shmem_frame; /* 8: Page cont. shared comms window. */
256 MEMORY_PADDING;
257 u32 evtchn; /* 16: Event channel for notifications. */
258 /* OUT */
259 u32 status; /* 20 */
260 } PACKED blkif_be_connect_t; /* 24 bytes */
262 /*
263 * CMSG_BLKIF_BE_DISCONNECT:
264 * When the driver sends a successful response then the interface is fully
265 * disconnected. The controller will send a DOWN notification to the front-end
266 * driver.
267 */
268 typedef struct {
269 /* IN */
270 domid_t domid; /* 0: Domain attached to new interface. */
271 u32 blkif_handle; /* 4: Domain-specific interface handle. */
272 /* OUT */
273 u32 status; /* 8 */
274 } PACKED blkif_be_disconnect_t; /* 12 bytes */
276 /* CMSG_BLKIF_BE_VBD_CREATE */
277 typedef struct {
278 /* IN */
279 domid_t domid; /* 0: Identify blkdev interface. */
280 u32 blkif_handle; /* 4: ...ditto... */
281 blkif_vdev_t vdevice; /* 8: Interface-specific id for this VBD. */
282 u16 readonly; /* 10: Non-zero -> VBD isn't writeable. */
283 /* OUT */
284 u32 status; /* 12 */
285 } PACKED blkif_be_vbd_create_t; /* 16 bytes */
287 /* CMSG_BLKIF_BE_VBD_DESTROY */
288 typedef struct {
289 /* IN */
290 domid_t domid; /* 0: Identify blkdev interface. */
291 u32 blkif_handle; /* 4: ...ditto... */
292 blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
293 u16 __pad; /* 10 */
294 /* OUT */
295 u32 status; /* 12 */
296 } PACKED blkif_be_vbd_destroy_t; /* 16 bytes */
298 /* CMSG_BLKIF_BE_VBD_GROW */
299 typedef struct {
300 /* IN */
301 domid_t domid; /* 0: Identify blkdev interface. */
302 u32 blkif_handle; /* 4: ...ditto... */
303 blkif_extent_t extent; /* 8: Physical extent to append to VBD. */
304 blkif_vdev_t vdevice; /* 28: Interface-specific id of the VBD. */
305 u16 __pad; /* 30 */
306 /* OUT */
307 u32 status; /* 32 */
308 } PACKED blkif_be_vbd_grow_t; /* 36 bytes */
310 /* CMSG_BLKIF_BE_VBD_SHRINK */
311 typedef struct {
312 /* IN */
313 domid_t domid; /* 0: Identify blkdev interface. */
314 u32 blkif_handle; /* 4: ...ditto... */
315 blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
316 u16 __pad; /* 10 */
317 /* OUT */
318 u32 status; /* 12 */
319 } PACKED blkif_be_vbd_shrink_t; /* 16 bytes */
321 /*
322 * CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED:
323 * Notify the domain controller that the back-end driver is DOWN or UP.
324 * If the driver goes DOWN while interfaces are still UP, the controller
325 * will automatically send DOWN notifications.
326 */
327 typedef struct {
328 u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
329 } PACKED blkif_be_driver_status_changed_t; /* 4 bytes */
332 /******************************************************************************
333 * NETWORK-INTERFACE FRONTEND DEFINITIONS
334 */
336 /* Messages from domain controller to guest. */
337 #define CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED 0
339 /* Messages from guest to domain controller. */
340 #define CMSG_NETIF_FE_DRIVER_STATUS_CHANGED 32
341 #define CMSG_NETIF_FE_INTERFACE_CONNECT 33
342 #define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34
344 /*
345 * CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED:
346 * Notify a guest about a status change on one of its network interfaces.
347 * If the interface is DESTROYED or DOWN then the interface is disconnected:
348 * 1. The shared-memory frame is available for reuse.
349 * 2. Any unacknowledged messgaes pending on the interface were dropped.
350 */
351 #define NETIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */
352 #define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
353 #define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
354 typedef struct {
355 u32 handle; /* 0 */
356 u32 status; /* 4 */
357 u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
358 u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
359 } PACKED netif_fe_interface_status_changed_t; /* 16 bytes */
361 /*
362 * CMSG_NETIF_FE_DRIVER_STATUS_CHANGED:
363 * Notify the domain controller that the front-end driver is DOWN or UP.
364 * When the driver goes DOWN then the controller will send no more
365 * status-change notifications. When the driver comes UP then the controller
366 * will send a notification for each interface that currently exists.
367 * If the driver goes DOWN while interfaces are still UP, the domain
368 * will automatically take the interfaces DOWN.
369 */
370 #define NETIF_DRIVER_STATUS_DOWN 0
371 #define NETIF_DRIVER_STATUS_UP 1
372 typedef struct {
373 /* IN */
374 u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
375 /* OUT */
376 /*
377 * Tells driver how many interfaces it should expect to immediately
378 * receive notifications about.
379 */
380 u32 nr_interfaces; /* 4 */
381 } PACKED netif_fe_driver_status_changed_t; /* 8 bytes */
383 /*
384 * CMSG_NETIF_FE_INTERFACE_CONNECT:
385 * If successful, the domain controller will acknowledge with a
386 * STATUS_CONNECTED message.
387 */
388 typedef struct {
389 u32 handle; /* 0 */
390 u32 __pad; /* 4 */
391 memory_t tx_shmem_frame; /* 8 */
392 MEMORY_PADDING;
393 memory_t rx_shmem_frame; /* 16 */
394 MEMORY_PADDING;
395 } PACKED netif_fe_interface_connect_t; /* 24 bytes */
397 /*
398 * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
399 * If successful, the domain controller will acknowledge with a
400 * STATUS_DISCONNECTED message.
401 */
402 typedef struct {
403 u32 handle; /* 0 */
404 } PACKED netif_fe_interface_disconnect_t; /* 4 bytes */
407 /******************************************************************************
408 * NETWORK-INTERFACE BACKEND DEFINITIONS
409 */
411 /* Messages from domain controller. */
412 #define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */
413 #define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */
414 #define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
415 #define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
417 /* Messages to domain controller. */
418 #define CMSG_NETIF_BE_DRIVER_STATUS_CHANGED 32
420 /*
421 * Message request/response definitions for net-device messages.
422 */
424 /* Non-specific 'okay' return. */
425 #define NETIF_BE_STATUS_OKAY 0
426 /* Non-specific 'error' return. */
427 #define NETIF_BE_STATUS_ERROR 1
428 /* The following are specific error returns. */
429 #define NETIF_BE_STATUS_INTERFACE_EXISTS 2
430 #define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
431 #define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
432 #define NETIF_BE_STATUS_OUT_OF_MEMORY 5
433 #define NETIF_BE_STATUS_MAPPING_ERROR 6
435 /* This macro can be used to create an array of descriptive error strings. */
436 #define NETIF_BE_STATUS_ERRORS { \
437 "Okay", \
438 "Non-specific error", \
439 "Interface already exists", \
440 "Interface not found", \
441 "Interface is still connected", \
442 "Out of memory", \
443 "Could not map domain memory" }
445 /*
446 * CMSG_NETIF_BE_CREATE:
447 * When the driver sends a successful response then the interface is fully
448 * created. The controller will send a DOWN notification to the front-end
449 * driver.
450 */
451 typedef struct {
452 /* IN */
453 domid_t domid; /* 0: Domain attached to new interface. */
454 u32 netif_handle; /* 4: Domain-specific interface handle. */
455 u8 mac[6]; /* 8 */
456 u16 __pad; /* 14 */
457 /* OUT */
458 u32 status; /* 16 */
459 } PACKED netif_be_create_t; /* 20 bytes */
461 /*
462 * CMSG_NETIF_BE_DESTROY:
463 * When the driver sends a successful response then the interface is fully
464 * torn down. The controller will send a DESTROYED notification to the
465 * front-end driver.
466 */
467 typedef struct {
468 /* IN */
469 domid_t domid; /* 0: Identify interface to be destroyed. */
470 u32 netif_handle; /* 4: ...ditto... */
471 /* OUT */
472 u32 status; /* 8 */
473 } PACKED netif_be_destroy_t; /* 12 bytes */
475 /*
476 * CMSG_NETIF_BE_CONNECT:
477 * When the driver sends a successful response then the interface is fully
478 * connected. The controller will send a CONNECTED notification to the
479 * front-end driver.
480 */
481 typedef struct {
482 /* IN */
483 domid_t domid; /* 0: Domain attached to new interface. */
484 u32 netif_handle; /* 4: Domain-specific interface handle. */
485 memory_t tx_shmem_frame; /* 8: Page cont. tx shared comms window. */
486 MEMORY_PADDING;
487 memory_t rx_shmem_frame; /* 16: Page cont. rx shared comms window. */
488 MEMORY_PADDING;
489 u16 evtchn; /* 24: Event channel for notifications. */
490 u16 __pad; /* 26 */
491 /* OUT */
492 u32 status; /* 28 */
493 } PACKED netif_be_connect_t; /* 32 bytes */
495 /*
496 * CMSG_NETIF_BE_DISCONNECT:
497 * When the driver sends a successful response then the interface is fully
498 * disconnected. The controller will send a DOWN notification to the front-end
499 * driver.
500 */
501 typedef struct {
502 /* IN */
503 domid_t domid; /* 0: Domain attached to new interface. */
504 u32 netif_handle; /* 4: Domain-specific interface handle. */
505 /* OUT */
506 u32 status; /* 8 */
507 } PACKED netif_be_disconnect_t; /* 12 bytes */
509 /*
510 * CMSG_NETIF_BE_DRIVER_STATUS_CHANGED:
511 * Notify the domain controller that the back-end driver is DOWN or UP.
512 * If the driver goes DOWN while interfaces are still UP, the domain
513 * will automatically send DOWN notifications.
514 */
515 typedef struct {
516 u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
517 } PACKED netif_be_driver_status_changed_t; /* 4 bytes */
520 /******************************************************************************
521 * SHUTDOWN DEFINITIONS
522 */
524 /*
525 * Subtypes for shutdown messages.
526 */
527 #define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
528 #define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
529 #define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
530 /* SHUTDOWN_suspend. */
532 #endif /* __DOMAIN_CONTROLLER_H__ */