arm_kvm: Do not assume particular GIC type in kvm_arch_irqchip_create()
[qemu/ar7.git] / hw / s390x / virtio-ccw.h
blob692ddd73184b300b4e9e31e1f3b18519056b85f8
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-bus.h>
26 #include <hw/s390x/s390_flic.h>
28 #define VIRTUAL_CSSID 0xfe
30 #define VIRTIO_CCW_CU_TYPE 0x3832
31 #define VIRTIO_CCW_CHPID_TYPE 0x32
33 #define CCW_CMD_SET_VQ 0x13
34 #define CCW_CMD_VDEV_RESET 0x33
35 #define CCW_CMD_READ_FEAT 0x12
36 #define CCW_CMD_WRITE_FEAT 0x11
37 #define CCW_CMD_READ_CONF 0x22
38 #define CCW_CMD_WRITE_CONF 0x21
39 #define CCW_CMD_WRITE_STATUS 0x31
40 #define CCW_CMD_SET_IND 0x43
41 #define CCW_CMD_SET_CONF_IND 0x53
42 #define CCW_CMD_READ_VQ_CONF 0x32
43 #define CCW_CMD_SET_IND_ADAPTER 0x73
44 #define CCW_CMD_SET_VIRTIO_REV 0x83
46 #define TYPE_VIRTIO_CCW_DEVICE "virtio-ccw-device"
47 #define VIRTIO_CCW_DEVICE(obj) \
48 OBJECT_CHECK(VirtioCcwDevice, (obj), TYPE_VIRTIO_CCW_DEVICE)
49 #define VIRTIO_CCW_DEVICE_CLASS(klass) \
50 OBJECT_CLASS_CHECK(VirtIOCCWDeviceClass, (klass), TYPE_VIRTIO_CCW_DEVICE)
51 #define VIRTIO_CCW_DEVICE_GET_CLASS(obj) \
52 OBJECT_GET_CLASS(VirtIOCCWDeviceClass, (obj), TYPE_VIRTIO_CCW_DEVICE)
54 typedef struct VirtioBusState VirtioCcwBusState;
55 typedef struct VirtioBusClass VirtioCcwBusClass;
57 #define TYPE_VIRTIO_CCW_BUS "virtio-ccw-bus"
58 #define VIRTIO_CCW_BUS(obj) \
59 OBJECT_CHECK(VirtioCcwBus, (obj), TYPE_VIRTIO_CCW_BUS)
60 #define VIRTIO_CCW_BUS_GET_CLASS(obj) \
61 OBJECT_CHECK(VirtioCcwBusState, (obj), TYPE_VIRTIO_CCW_BUS)
62 #define VIRTIO_CCW_BUS_CLASS(klass) \
63 OBJECT_CLASS_CHECK(VirtioCcwBusClass, klass, TYPE_VIRTIO_CCW_BUS)
65 typedef struct VirtioCcwDevice VirtioCcwDevice;
67 typedef struct VirtIOCCWDeviceClass {
68 DeviceClass parent_class;
69 void (*realize)(VirtioCcwDevice *dev, Error **errp);
70 int (*exit)(VirtioCcwDevice *dev);
71 } VirtIOCCWDeviceClass;
73 /* Performance improves when virtqueue kick processing is decoupled from the
74 * vcpu thread using ioeventfd for some devices. */
75 #define VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT 1
76 #define VIRTIO_CCW_FLAG_USE_IOEVENTFD (1 << VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT)
78 typedef struct IndAddr {
79 hwaddr addr;
80 uint64_t map;
81 unsigned long refcnt;
82 int len;
83 QTAILQ_ENTRY(IndAddr) sibling;
84 } IndAddr;
86 struct VirtioCcwDevice {
87 DeviceState parent_obj;
88 SubchDev *sch;
89 char *bus_id;
90 int revision;
91 VirtioBusState bus;
92 bool ioeventfd_started;
93 bool ioeventfd_disabled;
94 uint32_t flags;
95 uint8_t thinint_isc;
96 AdapterRoutes routes;
97 /* Guest provided values: */
98 IndAddr *indicators;
99 IndAddr *indicators2;
100 IndAddr *summary_indicator;
101 uint64_t ind_bit;
104 /* The maximum virtio revision we support. */
105 static inline int virtio_ccw_rev_max(VirtIODevice *vdev)
107 return 0;
110 /* virtual css bus type */
111 typedef struct VirtualCssBus {
112 BusState parent_obj;
113 } VirtualCssBus;
115 #define TYPE_VIRTUAL_CSS_BUS "virtual-css-bus"
116 #define VIRTUAL_CSS_BUS(obj) \
117 OBJECT_CHECK(VirtualCssBus, (obj), TYPE_VIRTUAL_CSS_BUS)
119 /* virtio-scsi-ccw */
121 #define TYPE_VIRTIO_SCSI_CCW "virtio-scsi-ccw"
122 #define VIRTIO_SCSI_CCW(obj) \
123 OBJECT_CHECK(VirtIOSCSICcw, (obj), TYPE_VIRTIO_SCSI_CCW)
125 typedef struct VirtIOSCSICcw {
126 VirtioCcwDevice parent_obj;
127 VirtIOSCSI vdev;
128 } VirtIOSCSICcw;
130 #ifdef CONFIG_VHOST_SCSI
131 /* vhost-scsi-ccw */
133 #define TYPE_VHOST_SCSI_CCW "vhost-scsi-ccw"
134 #define VHOST_SCSI_CCW(obj) \
135 OBJECT_CHECK(VHostSCSICcw, (obj), TYPE_VHOST_SCSI_CCW)
137 typedef struct VHostSCSICcw {
138 VirtioCcwDevice parent_obj;
139 VHostSCSI vdev;
140 } VHostSCSICcw;
141 #endif
143 /* virtio-blk-ccw */
145 #define TYPE_VIRTIO_BLK_CCW "virtio-blk-ccw"
146 #define VIRTIO_BLK_CCW(obj) \
147 OBJECT_CHECK(VirtIOBlkCcw, (obj), TYPE_VIRTIO_BLK_CCW)
149 typedef struct VirtIOBlkCcw {
150 VirtioCcwDevice parent_obj;
151 VirtIOBlock vdev;
152 } VirtIOBlkCcw;
154 /* virtio-balloon-ccw */
156 #define TYPE_VIRTIO_BALLOON_CCW "virtio-balloon-ccw"
157 #define VIRTIO_BALLOON_CCW(obj) \
158 OBJECT_CHECK(VirtIOBalloonCcw, (obj), TYPE_VIRTIO_BALLOON_CCW)
160 typedef struct VirtIOBalloonCcw {
161 VirtioCcwDevice parent_obj;
162 VirtIOBalloon vdev;
163 } VirtIOBalloonCcw;
165 /* virtio-serial-ccw */
167 #define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw"
168 #define VIRTIO_SERIAL_CCW(obj) \
169 OBJECT_CHECK(VirtioSerialCcw, (obj), TYPE_VIRTIO_SERIAL_CCW)
171 typedef struct VirtioSerialCcw {
172 VirtioCcwDevice parent_obj;
173 VirtIOSerial vdev;
174 } VirtioSerialCcw;
176 /* virtio-net-ccw */
178 #define TYPE_VIRTIO_NET_CCW "virtio-net-ccw"
179 #define VIRTIO_NET_CCW(obj) \
180 OBJECT_CHECK(VirtIONetCcw, (obj), TYPE_VIRTIO_NET_CCW)
182 typedef struct VirtIONetCcw {
183 VirtioCcwDevice parent_obj;
184 VirtIONet vdev;
185 } VirtIONetCcw;
187 /* virtio-rng-ccw */
189 #define TYPE_VIRTIO_RNG_CCW "virtio-rng-ccw"
190 #define VIRTIO_RNG_CCW(obj) \
191 OBJECT_CHECK(VirtIORNGCcw, (obj), TYPE_VIRTIO_RNG_CCW)
193 typedef struct VirtIORNGCcw {
194 VirtioCcwDevice parent_obj;
195 VirtIORNG vdev;
196 } VirtIORNGCcw;
198 VirtualCssBus *virtual_css_bus_init(void);
199 void virtio_ccw_device_update_status(SubchDev *sch);
200 VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch);
202 #ifdef CONFIG_VIRTFS
203 #include "hw/9pfs/virtio-9p.h"
205 #define TYPE_VIRTIO_9P_CCW "virtio-9p-ccw"
206 #define VIRTIO_9P_CCW(obj) \
207 OBJECT_CHECK(V9fsCCWState, (obj), TYPE_VIRTIO_9P_CCW)
209 typedef struct V9fsCCWState {
210 VirtioCcwDevice parent_obj;
211 V9fsState vdev;
212 } V9fsCCWState;
214 #endif /* CONFIG_VIRTFS */
216 #endif