diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/lguest.h | 39 | ||||
-rw-r--r-- | include/linux/lguest_launcher.h | 18 | ||||
-rw-r--r-- | include/linux/virtio_blk.h | 6 | ||||
-rw-r--r-- | include/linux/virtio_config.h | 3 | ||||
-rw-r--r-- | include/linux/virtio_net.h | 6 | ||||
-rw-r--r-- | include/linux/virtio_ring.h | 12 |
6 files changed, 46 insertions, 38 deletions
diff --git a/include/linux/lguest.h b/include/linux/lguest.h index dbf2479e808e..2fb1dcbcb5aa 100644 --- a/include/linux/lguest.h +++ b/include/linux/lguest.h | |||
@@ -1,5 +1,7 @@ | |||
1 | /* Things the lguest guest needs to know. Note: like all lguest interfaces, | 1 | /* |
2 | * this is subject to wild and random change between versions. */ | 2 | * Things the lguest guest needs to know. Note: like all lguest interfaces, |
3 | * this is subject to wild and random change between versions. | ||
4 | */ | ||
3 | #ifndef _LINUX_LGUEST_H | 5 | #ifndef _LINUX_LGUEST_H |
4 | #define _LINUX_LGUEST_H | 6 | #define _LINUX_LGUEST_H |
5 | 7 | ||
@@ -11,32 +13,41 @@ | |||
11 | #define LG_CLOCK_MIN_DELTA 100UL | 13 | #define LG_CLOCK_MIN_DELTA 100UL |
12 | #define LG_CLOCK_MAX_DELTA ULONG_MAX | 14 | #define LG_CLOCK_MAX_DELTA ULONG_MAX |
13 | 15 | ||
14 | /*G:031 The second method of communicating with the Host is to via "struct | 16 | /*G:031 |
17 | * The second method of communicating with the Host is to via "struct | ||
15 | * lguest_data". Once the Guest's initialization hypercall tells the Host where | 18 | * lguest_data". Once the Guest's initialization hypercall tells the Host where |
16 | * this is, the Guest and Host both publish information in it. :*/ | 19 | * this is, the Guest and Host both publish information in it. |
17 | struct lguest_data | 20 | :*/ |
18 | { | 21 | struct lguest_data { |
19 | /* 512 == enabled (same as eflags in normal hardware). The Guest | 22 | /* |
20 | * changes interrupts so often that a hypercall is too slow. */ | 23 | * 512 == enabled (same as eflags in normal hardware). The Guest |
24 | * changes interrupts so often that a hypercall is too slow. | ||
25 | */ | ||
21 | unsigned int irq_enabled; | 26 | unsigned int irq_enabled; |
22 | /* Fine-grained interrupt disabling by the Guest */ | 27 | /* Fine-grained interrupt disabling by the Guest */ |
23 | DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS); | 28 | DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS); |
24 | 29 | ||
25 | /* The Host writes the virtual address of the last page fault here, | 30 | /* |
31 | * The Host writes the virtual address of the last page fault here, | ||
26 | * which saves the Guest a hypercall. CR2 is the native register where | 32 | * which saves the Guest a hypercall. CR2 is the native register where |
27 | * this address would normally be found. */ | 33 | * this address would normally be found. |
34 | */ | ||
28 | unsigned long cr2; | 35 | unsigned long cr2; |
29 | 36 | ||
30 | /* Wallclock time set by the Host. */ | 37 | /* Wallclock time set by the Host. */ |
31 | struct timespec time; | 38 | struct timespec time; |
32 | 39 | ||
33 | /* Interrupt pending set by the Host. The Guest should do a hypercall | 40 | /* |
34 | * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF). */ | 41 | * Interrupt pending set by the Host. The Guest should do a hypercall |
42 | * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF). | ||
43 | */ | ||
35 | int irq_pending; | 44 | int irq_pending; |
36 | 45 | ||
37 | /* Async hypercall ring. Instead of directly making hypercalls, we can | 46 | /* |
47 | * Async hypercall ring. Instead of directly making hypercalls, we can | ||
38 | * place them in here for processing the next time the Host wants. | 48 | * place them in here for processing the next time the Host wants. |
39 | * This batching can be quite efficient. */ | 49 | * This batching can be quite efficient. |
50 | */ | ||
40 | 51 | ||
41 | /* 0xFF == done (set by Host), 0 == pending (set by Guest). */ | 52 | /* 0xFF == done (set by Host), 0 == pending (set by Guest). */ |
42 | u8 hcall_status[LHCALL_RING_SIZE]; | 53 | u8 hcall_status[LHCALL_RING_SIZE]; |
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h index bfefbdf7498a..495203ff221c 100644 --- a/include/linux/lguest_launcher.h +++ b/include/linux/lguest_launcher.h | |||
@@ -29,8 +29,10 @@ struct lguest_device_desc { | |||
29 | __u8 type; | 29 | __u8 type; |
30 | /* The number of virtqueues (first in config array) */ | 30 | /* The number of virtqueues (first in config array) */ |
31 | __u8 num_vq; | 31 | __u8 num_vq; |
32 | /* The number of bytes of feature bits. Multiply by 2: one for host | 32 | /* |
33 | * features and one for Guest acknowledgements. */ | 33 | * The number of bytes of feature bits. Multiply by 2: one for host |
34 | * features and one for Guest acknowledgements. | ||
35 | */ | ||
34 | __u8 feature_len; | 36 | __u8 feature_len; |
35 | /* The number of bytes of the config array after virtqueues. */ | 37 | /* The number of bytes of the config array after virtqueues. */ |
36 | __u8 config_len; | 38 | __u8 config_len; |
@@ -39,8 +41,10 @@ struct lguest_device_desc { | |||
39 | __u8 config[0]; | 41 | __u8 config[0]; |
40 | }; | 42 | }; |
41 | 43 | ||
42 | /*D:135 This is how we expect the device configuration field for a virtqueue | 44 | /*D:135 |
43 | * to be laid out in config space. */ | 45 | * This is how we expect the device configuration field for a virtqueue |
46 | * to be laid out in config space. | ||
47 | */ | ||
44 | struct lguest_vqconfig { | 48 | struct lguest_vqconfig { |
45 | /* The number of entries in the virtio_ring */ | 49 | /* The number of entries in the virtio_ring */ |
46 | __u16 num; | 50 | __u16 num; |
@@ -61,7 +65,9 @@ enum lguest_req | |||
61 | LHREQ_EVENTFD, /* + address, fd. */ | 65 | LHREQ_EVENTFD, /* + address, fd. */ |
62 | }; | 66 | }; |
63 | 67 | ||
64 | /* The alignment to use between consumer and producer parts of vring. | 68 | /* |
65 | * x86 pagesize for historical reasons. */ | 69 | * The alignment to use between consumer and producer parts of vring. |
70 | * x86 pagesize for historical reasons. | ||
71 | */ | ||
66 | #define LGUEST_VRING_ALIGN 4096 | 72 | #define LGUEST_VRING_ALIGN 4096 |
67 | #endif /* _LINUX_LGUEST_LAUNCHER */ | 73 | #endif /* _LINUX_LGUEST_LAUNCHER */ |
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h index be7d255fc7cf..8dab9f2b8832 100644 --- a/include/linux/virtio_blk.h +++ b/include/linux/virtio_blk.h | |||
@@ -20,8 +20,7 @@ | |||
20 | 20 | ||
21 | #define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */ | 21 | #define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */ |
22 | 22 | ||
23 | struct virtio_blk_config | 23 | struct virtio_blk_config { |
24 | { | ||
25 | /* The capacity (in 512-byte sectors). */ | 24 | /* The capacity (in 512-byte sectors). */ |
26 | __u64 capacity; | 25 | __u64 capacity; |
27 | /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ | 26 | /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */ |
@@ -50,8 +49,7 @@ struct virtio_blk_config | |||
50 | #define VIRTIO_BLK_T_BARRIER 0x80000000 | 49 | #define VIRTIO_BLK_T_BARRIER 0x80000000 |
51 | 50 | ||
52 | /* This is the first element of the read scatter-gather list. */ | 51 | /* This is the first element of the read scatter-gather list. */ |
53 | struct virtio_blk_outhdr | 52 | struct virtio_blk_outhdr { |
54 | { | ||
55 | /* VIRTIO_BLK_T* */ | 53 | /* VIRTIO_BLK_T* */ |
56 | __u32 type; | 54 | __u32 type; |
57 | /* io priority. */ | 55 | /* io priority. */ |
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 99f514575f6a..e547e3c8ee9a 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h | |||
@@ -79,8 +79,7 @@ | |||
79 | * the dev->feature bits if it wants. | 79 | * the dev->feature bits if it wants. |
80 | */ | 80 | */ |
81 | typedef void vq_callback_t(struct virtqueue *); | 81 | typedef void vq_callback_t(struct virtqueue *); |
82 | struct virtio_config_ops | 82 | struct virtio_config_ops { |
83 | { | ||
84 | void (*get)(struct virtio_device *vdev, unsigned offset, | 83 | void (*get)(struct virtio_device *vdev, unsigned offset, |
85 | void *buf, unsigned len); | 84 | void *buf, unsigned len); |
86 | void (*set)(struct virtio_device *vdev, unsigned offset, | 85 | void (*set)(struct virtio_device *vdev, unsigned offset, |
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index 9c543d6ac535..d8dd539c9f48 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
@@ -31,8 +31,7 @@ | |||
31 | 31 | ||
32 | #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ | 32 | #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ |
33 | 33 | ||
34 | struct virtio_net_config | 34 | struct virtio_net_config { |
35 | { | ||
36 | /* The config defining mac address (if VIRTIO_NET_F_MAC) */ | 35 | /* The config defining mac address (if VIRTIO_NET_F_MAC) */ |
37 | __u8 mac[6]; | 36 | __u8 mac[6]; |
38 | /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ | 37 | /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */ |
@@ -41,8 +40,7 @@ struct virtio_net_config | |||
41 | 40 | ||
42 | /* This is the first element of the scatter-gather list. If you don't | 41 | /* This is the first element of the scatter-gather list. If you don't |
43 | * specify GSO or CSUM features, you can simply ignore the header. */ | 42 | * specify GSO or CSUM features, you can simply ignore the header. */ |
44 | struct virtio_net_hdr | 43 | struct virtio_net_hdr { |
45 | { | ||
46 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset | 44 | #define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset |
47 | __u8 flags; | 45 | __u8 flags; |
48 | #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame | 46 | #define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame |
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index 693e0ec5afa6..e4d144b132b5 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
@@ -30,8 +30,7 @@ | |||
30 | #define VIRTIO_RING_F_INDIRECT_DESC 28 | 30 | #define VIRTIO_RING_F_INDIRECT_DESC 28 |
31 | 31 | ||
32 | /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ | 32 | /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ |
33 | struct vring_desc | 33 | struct vring_desc { |
34 | { | ||
35 | /* Address (guest-physical). */ | 34 | /* Address (guest-physical). */ |
36 | __u64 addr; | 35 | __u64 addr; |
37 | /* Length. */ | 36 | /* Length. */ |
@@ -42,24 +41,21 @@ struct vring_desc | |||
42 | __u16 next; | 41 | __u16 next; |
43 | }; | 42 | }; |
44 | 43 | ||
45 | struct vring_avail | 44 | struct vring_avail { |
46 | { | ||
47 | __u16 flags; | 45 | __u16 flags; |
48 | __u16 idx; | 46 | __u16 idx; |
49 | __u16 ring[]; | 47 | __u16 ring[]; |
50 | }; | 48 | }; |
51 | 49 | ||
52 | /* u32 is used here for ids for padding reasons. */ | 50 | /* u32 is used here for ids for padding reasons. */ |
53 | struct vring_used_elem | 51 | struct vring_used_elem { |
54 | { | ||
55 | /* Index of start of used descriptor chain. */ | 52 | /* Index of start of used descriptor chain. */ |
56 | __u32 id; | 53 | __u32 id; |
57 | /* Total length of the descriptor chain which was used (written to) */ | 54 | /* Total length of the descriptor chain which was used (written to) */ |
58 | __u32 len; | 55 | __u32 len; |
59 | }; | 56 | }; |
60 | 57 | ||
61 | struct vring_used | 58 | struct vring_used { |
62 | { | ||
63 | __u16 flags; | 59 | __u16 flags; |
64 | __u16 idx; | 60 | __u16 idx; |
65 | struct vring_used_elem ring[]; | 61 | struct vring_used_elem ring[]; |