]>
git.proxmox.com Git - qemu.git/blob - pc-bios/s390-ccw/virtio.h
4 * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
6 * This work is licensed under the terms of the GNU GPL, version 2 or (at
7 * your option) any later version. See the COPYING file in the top-level
16 /* Status byte for guest to report progress, and synchronize features. */
17 /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
18 #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
19 /* We have found a driver for the device. */
20 #define VIRTIO_CONFIG_S_DRIVER 2
21 /* Driver has used its parts of the config, and is happy */
22 #define VIRTIO_CONFIG_S_DRIVER_OK 4
23 /* We've given up on this device. */
24 #define VIRTIO_CONFIG_S_FAILED 0x80
26 enum virtio_dev_type
{
29 VIRTIO_ID_CONSOLE
= 3,
30 VIRTIO_ID_BALLOON
= 5,
33 struct virtio_dev_header
{
34 enum virtio_dev_type type
: 8;
40 } __attribute__((packed
));
42 struct virtio_vqconfig
{
47 } __attribute__((packed
));
49 struct vq_info_block
{
54 } __attribute__((packed
));
56 struct vq_config_block
{
59 } __attribute__((packed
));
62 struct virtio_dev_header
*header
;
63 struct virtio_vqconfig
*vqconfig
;
69 #define KVM_S390_VIRTIO_RING_ALIGN 4096
71 #define VRING_USED_F_NO_NOTIFY 1
73 /* This marks a buffer as continuing via the next field. */
74 #define VRING_DESC_F_NEXT 1
75 /* This marks a buffer as write-only (otherwise read-only). */
76 #define VRING_DESC_F_WRITE 2
77 /* This means the buffer contains a list of buffer descriptors. */
78 #define VRING_DESC_F_INDIRECT 4
80 /* Internal flag to mark follow-up segments as such */
81 #define VRING_HIDDEN_IS_CHAIN 256
83 /* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
85 /* Address (guest-physical). */
89 /* The flags as indicated above. */
91 /* We chain unused descriptors via this, too */
93 } __attribute__((packed
));
99 } __attribute__((packed
));
101 /* u32 is used here for ids for padding reasons. */
102 struct vring_used_elem
{
103 /* Index of start of used descriptor chain. */
105 /* Total length of the descriptor chain which was used (written to) */
107 } __attribute__((packed
));
112 struct vring_used_elem ring
[];
113 } __attribute__((packed
));
118 struct vring_desc
*desc
;
119 struct vring_avail
*avail
;
120 struct vring_used
*used
;
121 struct subchannel_id schid
;
125 /***********************************************
127 ***********************************************/
132 * Usage is a bit tricky as some bits are used as flags and some are not.
135 * VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
136 * VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own
137 * and may not be combined with any of the other flags.
140 /* These two define direction. */
141 #define VIRTIO_BLK_T_IN 0
142 #define VIRTIO_BLK_T_OUT 1
144 /* This bit says it's a scsi command, not an actual read or write. */
145 #define VIRTIO_BLK_T_SCSI_CMD 2
147 /* Cache flush command */
148 #define VIRTIO_BLK_T_FLUSH 4
150 /* Barrier before this op. */
151 #define VIRTIO_BLK_T_BARRIER 0x80000000
153 /* This is the first element of the read scatter-gather list. */
154 struct virtio_blk_outhdr
{
159 /* Sector (ie. 512 byte offset) */
163 #endif /* VIRTIO_H */