hw/display/sm501: Replace i2c_send_recv() by i2c_recv() & i2c_send()
[qemu/ar7.git] / hw / s390x / vhost-vsock-ccw.c
blob246416a8f964a1d9ad23c16b9b41d95fa9c01efe
1 /*
2 * vhost vsock ccw implementation
4 * This work is licensed under the terms of the GNU GPL, version 2 or (at
5 * your option) any later version. See the COPYING file in the top-level
6 * directory.
7 */
9 #include "qemu/osdep.h"
10 #include "hw/qdev-properties.h"
11 #include "hw/virtio/virtio.h"
12 #include "qapi/error.h"
13 #include "qemu/module.h"
14 #include "virtio-ccw.h"
16 static Property vhost_vsock_ccw_properties[] = {
17 DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev,
18 VIRTIO_CCW_MAX_REV),
19 DEFINE_PROP_END_OF_LIST(),
22 static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp)
24 VHostVSockCCWState *dev = VHOST_VSOCK_CCW(ccw_dev);
25 DeviceState *vdev = DEVICE(&dev->vdev);
27 qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
30 static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
32 DeviceClass *dc = DEVICE_CLASS(klass);
33 VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
35 k->realize = vhost_vsock_ccw_realize;
36 set_bit(DEVICE_CATEGORY_MISC, dc->categories);
37 device_class_set_props(dc, vhost_vsock_ccw_properties);
40 static void vhost_vsock_ccw_instance_init(Object *obj)
42 VHostVSockCCWState *dev = VHOST_VSOCK_CCW(obj);
43 VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
44 VirtIODevice *virtio_dev;
46 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
47 TYPE_VHOST_VSOCK);
49 virtio_dev = VIRTIO_DEVICE(&dev->vdev);
52 * To avoid migration issues, we force virtio version 1 only when
53 * legacy check is enabled in the new machine types (>= 5.1).
55 if (!virtio_legacy_check_disabled(virtio_dev)) {
56 ccw_dev->force_revision_1 = true;
60 static const TypeInfo vhost_vsock_ccw_info = {
61 .name = TYPE_VHOST_VSOCK_CCW,
62 .parent = TYPE_VIRTIO_CCW_DEVICE,
63 .instance_size = sizeof(VHostVSockCCWState),
64 .instance_init = vhost_vsock_ccw_instance_init,
65 .class_init = vhost_vsock_ccw_class_init,
68 static void vhost_vsock_ccw_register(void)
70 type_register_static(&vhost_vsock_ccw_info);
73 type_init(vhost_vsock_ccw_register)