diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/lguest_launcher.h | 6 | ||||
| -rw-r--r-- | include/linux/virtio_balloon.h | 3 | ||||
| -rw-r--r-- | include/linux/virtio_console.h | 11 | ||||
| -rw-r--r-- | include/linux/virtio_pci.h | 8 | ||||
| -rw-r--r-- | include/linux/virtio_ring.h | 13 |
5 files changed, 34 insertions, 7 deletions
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h index e7217dc58f39..a53407a4165c 100644 --- a/include/linux/lguest_launcher.h +++ b/include/linux/lguest_launcher.h | |||
| @@ -54,9 +54,13 @@ struct lguest_vqconfig { | |||
| 54 | /* Write command first word is a request. */ | 54 | /* Write command first word is a request. */ |
| 55 | enum lguest_req | 55 | enum lguest_req |
| 56 | { | 56 | { |
| 57 | LHREQ_INITIALIZE, /* + base, pfnlimit, pgdir, start */ | 57 | LHREQ_INITIALIZE, /* + base, pfnlimit, start */ |
| 58 | LHREQ_GETDMA, /* No longer used */ | 58 | LHREQ_GETDMA, /* No longer used */ |
| 59 | LHREQ_IRQ, /* + irq */ | 59 | LHREQ_IRQ, /* + irq */ |
| 60 | LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ | 60 | LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ |
| 61 | }; | 61 | }; |
| 62 | |||
| 63 | /* The alignment to use between consumer and producer parts of vring. | ||
| 64 | * x86 pagesize for historical reasons. */ | ||
| 65 | #define LGUEST_VRING_ALIGN 4096 | ||
| 62 | #endif /* _LINUX_LGUEST_LAUNCHER */ | 66 | #endif /* _LINUX_LGUEST_LAUNCHER */ |
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h index c30c7bfbf39b..8726ff77763e 100644 --- a/include/linux/virtio_balloon.h +++ b/include/linux/virtio_balloon.h | |||
| @@ -10,6 +10,9 @@ | |||
| 10 | /* The feature bitmap for virtio balloon */ | 10 | /* The feature bitmap for virtio balloon */ |
| 11 | #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ | 11 | #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ |
| 12 | 12 | ||
| 13 | /* Size of a PFN in the balloon interface. */ | ||
| 14 | #define VIRTIO_BALLOON_PFN_SHIFT 12 | ||
| 15 | |||
| 13 | struct virtio_balloon_config | 16 | struct virtio_balloon_config |
| 14 | { | 17 | { |
| 15 | /* Number of pages host wants Guest to give up. */ | 18 | /* Number of pages host wants Guest to give up. */ |
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h index 19a0da0dba41..7615ffcdd555 100644 --- a/include/linux/virtio_console.h +++ b/include/linux/virtio_console.h | |||
| @@ -7,6 +7,17 @@ | |||
| 7 | /* The ID for virtio console */ | 7 | /* The ID for virtio console */ |
| 8 | #define VIRTIO_ID_CONSOLE 3 | 8 | #define VIRTIO_ID_CONSOLE 3 |
| 9 | 9 | ||
| 10 | /* Feature bits */ | ||
| 11 | #define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ | ||
| 12 | |||
| 13 | struct virtio_console_config { | ||
| 14 | /* colums of the screens */ | ||
| 15 | __u16 cols; | ||
| 16 | /* rows of the screens */ | ||
| 17 | __u16 rows; | ||
| 18 | } __attribute__((packed)); | ||
| 19 | |||
| 20 | |||
| 10 | #ifdef __KERNEL__ | 21 | #ifdef __KERNEL__ |
| 11 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); | 22 | int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); |
| 12 | #endif /* __KERNEL__ */ | 23 | #endif /* __KERNEL__ */ |
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h index cdef35742932..cd0fd5d181a6 100644 --- a/include/linux/virtio_pci.h +++ b/include/linux/virtio_pci.h | |||
| @@ -53,4 +53,12 @@ | |||
| 53 | 53 | ||
| 54 | /* Virtio ABI version, this must match exactly */ | 54 | /* Virtio ABI version, this must match exactly */ |
| 55 | #define VIRTIO_PCI_ABI_VERSION 0 | 55 | #define VIRTIO_PCI_ABI_VERSION 0 |
| 56 | |||
| 57 | /* How many bits to shift physical queue address written to QUEUE_PFN. | ||
| 58 | * 12 is historical, and due to x86 page size. */ | ||
| 59 | #define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12 | ||
| 60 | |||
| 61 | /* The alignment to use between consumer and producer parts of vring. | ||
| 62 | * x86 pagesize again. */ | ||
| 63 | #define VIRTIO_PCI_VRING_ALIGN 4096 | ||
| 56 | #endif | 64 | #endif |
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h index c4a598fb3826..71e03722fb59 100644 --- a/include/linux/virtio_ring.h +++ b/include/linux/virtio_ring.h | |||
| @@ -83,7 +83,7 @@ struct vring { | |||
| 83 | * __u16 avail_idx; | 83 | * __u16 avail_idx; |
| 84 | * __u16 available[num]; | 84 | * __u16 available[num]; |
| 85 | * | 85 | * |
| 86 | * // Padding to the next page boundary. | 86 | * // Padding to the next align boundary. |
| 87 | * char pad[]; | 87 | * char pad[]; |
| 88 | * | 88 | * |
| 89 | * // A ring of used descriptor heads with free-running index. | 89 | * // A ring of used descriptor heads with free-running index. |
| @@ -93,19 +93,19 @@ struct vring { | |||
| 93 | * }; | 93 | * }; |
| 94 | */ | 94 | */ |
| 95 | static inline void vring_init(struct vring *vr, unsigned int num, void *p, | 95 | static inline void vring_init(struct vring *vr, unsigned int num, void *p, |
| 96 | unsigned long pagesize) | 96 | unsigned long align) |
| 97 | { | 97 | { |
| 98 | vr->num = num; | 98 | vr->num = num; |
| 99 | vr->desc = p; | 99 | vr->desc = p; |
| 100 | vr->avail = p + num*sizeof(struct vring_desc); | 100 | vr->avail = p + num*sizeof(struct vring_desc); |
| 101 | vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1) | 101 | vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + align-1) |
| 102 | & ~(pagesize - 1)); | 102 | & ~(align - 1)); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | static inline unsigned vring_size(unsigned int num, unsigned long pagesize) | 105 | static inline unsigned vring_size(unsigned int num, unsigned long align) |
| 106 | { | 106 | { |
| 107 | return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) | 107 | return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) |
| 108 | + pagesize - 1) & ~(pagesize - 1)) | 108 | + align - 1) & ~(align - 1)) |
| 109 | + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num; | 109 | + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| @@ -115,6 +115,7 @@ struct virtio_device; | |||
| 115 | struct virtqueue; | 115 | struct virtqueue; |
| 116 | 116 | ||
| 117 | struct virtqueue *vring_new_virtqueue(unsigned int num, | 117 | struct virtqueue *vring_new_virtqueue(unsigned int num, |
| 118 | unsigned int vring_align, | ||
| 118 | struct virtio_device *vdev, | 119 | struct virtio_device *vdev, |
| 119 | void *pages, | 120 | void *pages, |
| 120 | void (*notify)(struct virtqueue *vq), | 121 | void (*notify)(struct virtqueue *vq), |
