block: Typo fix in copy_on_readv()
[qemu/kevin.git] / hw / s390x / virtio-ccw.h
blob541fdd29948dfb9fe51f23542699962591028a94
1 /*
2 * virtio ccw target definitions
4 * Copyright 2012,2015 IBM Corp.
5 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6 * Pierre Morel <pmorel@linux.vnet.ibm.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
10 * directory.
13 #ifndef HW_S390X_VIRTIO_CCW_H
14 #define HW_S390X_VIRTIO_CCW_H
16 #include "hw/virtio/virtio-blk.h"
17 #include "hw/virtio/virtio-net.h"
18 #include "hw/virtio/virtio-serial.h"
19 #include "hw/virtio/virtio-scsi.h"
20 #ifdef CONFIG_VHOST_SCSI
21 #include "hw/virtio/vhost-scsi.h"
22 #endif
23 #include "hw/virtio/virtio-balloon.h"
24 #include "hw/virtio/virtio-rng.h"
25 #include "hw/virtio/virtio-crypto.h"
26 #include "hw/virtio/virtio-bus.h"
27 #ifdef CONFIG_VHOST_VSOCK
28 #include "hw/virtio/vhost-vsock.h"
29 #endif /* CONFIG_VHOST_VSOCK */
30 #include "hw/virtio/virtio-gpu.h"
32 #include "hw/s390x/s390_flic.h"
33 #include "hw/s390x/css.h"
34 #include "ccw-device.h"
35 #include "hw/s390x/css-bridge.h"
37 #define VIRTIO_CCW_CU_TYPE 0x3832
38 #define VIRTIO_CCW_CHPID_TYPE 0x32
40 #define CCW_CMD_SET_VQ 0x13
41 #define CCW_CMD_VDEV_RESET 0x33
42 #define CCW_CMD_READ_FEAT 0x12
43 #define CCW_CMD_WRITE_FEAT 0x11
44 #define CCW_CMD_READ_CONF 0x22
45 #define CCW_CMD_WRITE_CONF 0x21
46 #define CCW_CMD_WRITE_STATUS 0x31
47 #define CCW_CMD_SET_IND 0x43
48 #define CCW_CMD_SET_CONF_IND 0x53
49 #define CCW_CMD_READ_VQ_CONF 0x32
50 #define CCW_CMD_READ_STATUS 0x72
51 #define CCW_CMD_SET_IND_ADAPTER 0x73
52 #define CCW_CMD_SET_VIRTIO_REV 0x83
54 #define TYPE_VIRTIO_CCW_DEVICE "virtio-ccw-device"
55 #define VIRTIO_CCW_DEVICE(obj) \
56 OBJECT_CHECK(VirtioCcwDevice, (obj), TYPE_VIRTIO_CCW_DEVICE)
57 #define VIRTIO_CCW_DEVICE_CLASS(klass) \
58 OBJECT_CLASS_CHECK(VirtIOCCWDeviceClass, (klass), TYPE_VIRTIO_CCW_DEVICE)
59 #define VIRTIO_CCW_DEVICE_GET_CLASS(obj) \
60 OBJECT_GET_CLASS(VirtIOCCWDeviceClass, (obj), TYPE_VIRTIO_CCW_DEVICE)
62 typedef struct VirtioBusState VirtioCcwBusState;
63 typedef struct VirtioBusClass VirtioCcwBusClass;
65 #define TYPE_VIRTIO_CCW_BUS "virtio-ccw-bus"
66 #define VIRTIO_CCW_BUS(obj) \
67 OBJECT_CHECK(VirtioCcwBus, (obj), TYPE_VIRTIO_CCW_BUS)
68 #define VIRTIO_CCW_BUS_GET_CLASS(obj) \
69 OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS)
70 #define VIRTIO_CCW_BUS_CLASS(klass) \
71 OBJECT_CLASS_CHECK(VirtioCcwBusClass, klass, TYPE_VIRTIO_CCW_BUS)
73 typedef struct VirtioCcwDevice VirtioCcwDevice;
75 typedef struct VirtIOCCWDeviceClass {
76 CCWDeviceClass parent_class;
77 void (*realize)(VirtioCcwDevice *dev, Error **errp);
78 int (*exit)(VirtioCcwDevice *dev);
79 } VirtIOCCWDeviceClass;
81 /* Performance improves when virtqueue kick processing is decoupled from the
82 * vcpu thread using ioeventfd for some devices. */
83 #define VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT 1
84 #define VIRTIO_CCW_FLAG_USE_IOEVENTFD (1 << VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT)
86 struct VirtioCcwDevice {
87 CcwDevice parent_obj;
88 int revision;
89 uint32_t max_rev;
90 VirtioBusState bus;
91 uint32_t flags;
92 uint8_t thinint_isc;
93 AdapterRoutes routes;
94 /* Guest provided values: */
95 IndAddr *indicators;
96 IndAddr *indicators2;
97 IndAddr *summary_indicator;
98 uint64_t ind_bit;
99 bool force_revision_1;
102 /* The maximum virtio revision we support. */
103 #define VIRTIO_CCW_MAX_REV 2
104 static inline int virtio_ccw_rev_max(VirtioCcwDevice *dev)
106 return dev->max_rev;
109 /* virtio-scsi-ccw */
111 #define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw"
112 #define VIRTIO_SCSI_CCW(obj) \
113 OBJECT_CHECK(VirtIOSCSICcw, (obj), TYPE_VIRTIO_SCSI_CCW)
115 typedef struct VirtIOSCSICcw {
116 VirtioCcwDevice parent_obj;
117 VirtIOSCSI vdev;
118 } VirtIOSCSICcw;
120 #ifdef CONFIG_VHOST_SCSI
121 /* vhost-scsi-ccw */
123 #define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw"
124 #define VHOST_SCSI_CCW(obj) \
125 OBJECT_CHECK(VHostSCSICcw, (obj), TYPE_VHOST_SCSI_CCW)
127 typedef struct VHostSCSICcw {
128 VirtioCcwDevice parent_obj;
129 VHostSCSI vdev;
130 } VHostSCSICcw;
131 #endif
133 /* virtio-blk-ccw */
135 #define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw"
136 #define VIRTIO_BLK_CCW(obj) \
137 OBJECT_CHECK(VirtIOBlkCcw, (obj), TYPE_VIRTIO_BLK_CCW)
139 typedef struct VirtIOBlkCcw {
140 VirtioCcwDevice parent_obj;
141 VirtIOBlock vdev;
142 } VirtIOBlkCcw;
144 /* virtio-balloon-ccw */
146 #define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw"
147 #define VIRTIO_BALLOON_CCW(obj) \
148 OBJECT_CHECK(VirtIOBalloonCcw, (obj), TYPE_VIRTIO_BALLOON_CCW)
150 typedef struct VirtIOBalloonCcw {
151 VirtioCcwDevice parent_obj;
152 VirtIOBalloon vdev;
153 } VirtIOBalloonCcw;
155 /* virtio-serial-ccw */
157 #define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw"
158 #define VIRTIO_SERIAL_CCW(obj) \
159 OBJECT_CHECK(VirtioSerialCcw, (obj), TYPE_VIRTIO_SERIAL_CCW)
161 typedef struct VirtioSerialCcw {
162 VirtioCcwDevice parent_obj;
163 VirtIOSerial vdev;
164 } VirtioSerialCcw;
166 /* virtio-net-ccw */
168 #define TYPE_VIRTIO_NET_CCW "virtio-net-ccw"
169 #define VIRTIO_NET_CCW(obj) \
170 OBJECT_CHECK(VirtIONetCcw, (obj), TYPE_VIRTIO_NET_CCW)
172 typedef struct VirtIONetCcw {
173 VirtioCcwDevice parent_obj;
174 VirtIONet vdev;
175 } VirtIONetCcw;
177 /* virtio-rng-ccw */
179 #define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw"
180 #define VIRTIO_RNG_CCW(obj) \
181 OBJECT_CHECK(VirtIORNGCcw, (obj), TYPE_VIRTIO_RNG_CCW)
183 typedef struct VirtIORNGCcw {
184 VirtioCcwDevice parent_obj;
185 VirtIORNG vdev;
186 } VirtIORNGCcw;
188 /* virtio-crypto-ccw */
190 #define TYPE_VIRTIO_CRYPTO_CCW "virtio-crypto-ccw"
191 #define VIRTIO_CRYPTO_CCW(obj) \
192 OBJECT_CHECK(VirtIOCryptoCcw, (obj), TYPE_VIRTIO_CRYPTO_CCW)
194 typedef struct VirtIOCryptoCcw {
195 VirtioCcwDevice parent_obj;
196 VirtIOCrypto vdev;
197 } VirtIOCryptoCcw;
199 VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch);
201 #ifdef CONFIG_VIRTFS
202 #include "hw/9pfs/virtio-9p.h"
204 #define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw"
205 #define VIRTIO_9P_CCW(obj) \
206 OBJECT_CHECK(V9fsCCWState, (obj), TYPE_VIRTIO_9P_CCW)
208 typedef struct V9fsCCWState {
209 VirtioCcwDevice parent_obj;
210 V9fsVirtioState vdev;
211 } V9fsCCWState;
213 #endif /* CONFIG_VIRTFS */
215 #ifdef CONFIG_VHOST_VSOCK
216 #define TYPE_VHOST_VSOCK_CCW "vhost-vsock-ccw"
217 #define VHOST_VSOCK_CCW(obj) \
218 OBJECT_CHECK(VHostVSockCCWState, (obj), TYPE_VHOST_VSOCK_CCW)
220 typedef struct VHostVSockCCWState {
221 VirtioCcwDevice parent_obj;
222 VHostVSock vdev;
223 } VHostVSockCCWState;
225 #endif /* CONFIG_VHOST_VSOCK */
227 #define TYPE_VIRTIO_GPU_CCW "virtio-gpu-ccw"
228 #define VIRTIO_GPU_CCW(obj) \
229 OBJECT_CHECK(VirtIOGPUCcw, (obj), TYPE_VIRTIO_GPU_CCW)
231 typedef struct VirtIOGPUCcw {
232 VirtioCcwDevice parent_obj;
233 VirtIOGPU vdev;
234 } VirtIOGPUCcw;
236 #endif