aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-10-21 21:24:21 -0400
committerRusty Russell <rusty@rustcorp.com.au>2007-10-23 01:49:56 -0400
commit19f1537b7b8a9a82665db3ad8210a9d954d13acd (patch)
tree793c1f8763350012caa521a55c5778b1c633b7e5 /include/linux
parent15045275c32bf6d15d32c2eca8157be9c0ba6e45 (diff)
Lguest support for Virtio
This makes lguest able to use the virtio devices. We change the device descriptor page from a simple array to a variable length "type, config_len, status, config data..." format, and implement virtio_config_ops to read from that config data. We use the virtio ring implementation for an efficient Guest <-> Host virtqueue mechanism, and the new LHCALL_NOTIFY hypercall to kick the host when it changes. We also use LHCALL_NOTIFY on kernel addresses for very very early console output. We could have another hypercall, but this hack works quite well. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/lguest_launcher.h47
1 files changed, 19 insertions, 28 deletions
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index 5ec04a225e4f..61e1e3e6b1cc 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -22,37 +22,28 @@
22 * complex burden for the Host and suboptimal for the Guest, so we have our own 22 * complex burden for the Host and suboptimal for the Guest, so we have our own
23 * "lguest" bus and simple drivers. 23 * "lguest" bus and simple drivers.
24 * 24 *
25 * Devices are described by an array of LGUEST_MAX_DEVICES of these structs, 25 * Devices are described by a simplified ID, a status byte, and some "config"
26 * placed by the Launcher just above the top of physical memory: 26 * bytes which describe this device's configuration. This is placed by the
27 * Launcher just above the top of physical memory:
27 */ 28 */
28struct lguest_device_desc { 29struct lguest_device_desc {
29 /* The device type: console, network, disk etc. */ 30 /* The device type: console, network, disk etc. Type 0 terminates. */
30 __u16 type; 31 __u8 type;
31#define LGUEST_DEVICE_T_CONSOLE 1 32 /* The number of bytes of the config array. */
32#define LGUEST_DEVICE_T_NET 2 33 __u8 config_len;
33#define LGUEST_DEVICE_T_BLOCK 3 34 /* A status byte, written by the Guest. */
34 35 __u8 status;
35 /* The specific features of this device: these depends on device type 36 __u8 config[0];
36 * except for LGUEST_DEVICE_F_RANDOMNESS. */ 37};
37 __u16 features;
38#define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */
39#define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */
40
41 /* This is how the Guest reports status of the device: the Host can set
42 * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only
43 * ever manipulated by the Guest, and only ever set. */
44 __u16 status;
45/* 256 and above are device specific. */
46#define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */
47#define LGUEST_DEVICE_S_DRIVER 2 /* We have found a driver */
48#define LGUEST_DEVICE_S_DRIVER_OK 4 /* Driver says OK! */
49#define LGUEST_DEVICE_S_REMOVED 8 /* Device has gone away. */
50#define LGUEST_DEVICE_S_REMOVED_ACK 16 /* Driver has been told. */
51#define LGUEST_DEVICE_S_FAILED 128 /* Something actually failed */
52 38
53 /* Each device exists somewhere in Guest physical memory, over some 39/*D:135 This is how we expect the device configuration field for a virtqueue
54 * number of pages. */ 40 * (type VIRTIO_CONFIG_F_VIRTQUEUE) to be laid out: */
55 __u16 num_pages; 41struct lguest_vqconfig {
42 /* The number of entries in the virtio_ring */
43 __u16 num;
44 /* The interrupt we get when something happens. */
45 __u16 irq;
46 /* The page number of the virtio ring for this device. */
56 __u32 pfn; 47 __u32 pfn;
57}; 48};
58/*:*/ 49/*:*/