2 * QEMU S390 virtio target
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #include "sysemu/block-backend.h"
22 #include "sysemu/sysemu.h"
23 #include "hw/boards.h"
24 #include "monitor/monitor.h"
25 #include "hw/loader.h"
27 #include "hw/virtio/virtio.h"
28 #include "hw/virtio/virtio-rng.h"
29 #include "hw/virtio/virtio-serial.h"
30 #include "hw/virtio/virtio-net.h"
31 #include "hw/virtio/vhost-scsi.h"
32 #include "hw/sysbus.h"
33 #include "sysemu/kvm.h"
35 #include "hw/s390x/s390-virtio-bus.h"
36 #include "hw/virtio/virtio-bus.h"
38 /* #define DEBUG_S390 */
41 #define DPRINTF(fmt, ...) \
42 do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
44 #define DPRINTF(fmt, ...) \
48 static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size,
49 VirtIOS390Device *dev);
51 static const TypeInfo s390_virtio_bus_info = {
52 .name = TYPE_S390_VIRTIO_BUS,
54 .instance_size = sizeof(VirtIOS390Bus),
57 static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev);
59 /* length of VirtIO device pages */
60 const hwaddr virtio_size = S390_DEVICE_PAGES * TARGET_PAGE_SIZE;
62 static void s390_virtio_bus_reset(void *opaque)
64 VirtIOS390Bus *bus = opaque;
65 bus->next_ring = bus->dev_page + TARGET_PAGE_SIZE;
68 void s390_virtio_reset_idx(VirtIOS390Device *dev)
74 num_vq = s390_virtio_device_num_vq(dev);
75 for (i = 0; i < num_vq; i++) {
76 idx_addr = virtio_queue_get_avail_addr(dev->vdev, i) +
77 VIRTIO_VRING_AVAIL_IDX_OFFS;
78 address_space_stw(&address_space_memory, idx_addr, 0,
79 MEMTXATTRS_UNSPECIFIED, NULL);
80 idx_addr = virtio_queue_get_used_addr(dev->vdev, i) +
81 VIRTIO_VRING_USED_IDX_OFFS;
82 address_space_stw(&address_space_memory, idx_addr, 0,
83 MEMTXATTRS_UNSPECIFIED, NULL);
87 VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)
93 /* Create bridge device */
94 dev = qdev_create(NULL, "s390-virtio-bridge");
95 qdev_init_nofail(dev);
97 /* Create bus on bridge device */
99 _bus = qbus_create(TYPE_S390_VIRTIO_BUS, dev, "s390-virtio");
100 bus = DO_UPCAST(VirtIOS390Bus, bus, _bus);
102 bus->dev_page = *ram_size;
103 bus->dev_offs = bus->dev_page;
104 bus->next_ring = bus->dev_page + TARGET_PAGE_SIZE;
106 /* Enable hotplugging */
107 qbus_set_hotplug_handler(_bus, dev, &error_abort);
109 /* Allocate RAM for VirtIO device pages (descriptors, queues, rings) */
110 *ram_size += S390_DEVICE_PAGES * TARGET_PAGE_SIZE;
112 qemu_register_reset(s390_virtio_bus_reset, bus);
116 static void s390_virtio_device_init(VirtIOS390Device *dev,
122 bus = DO_UPCAST(VirtIOS390Bus, bus, dev->qdev.parent_bus);
124 dev->dev_offs = bus->dev_offs;
125 dev->feat_len = sizeof(uint32_t); /* always keep 32 bits features */
127 dev_len = VIRTIO_DEV_OFFS_CONFIG;
128 dev_len += s390_virtio_device_num_vq(dev) * VIRTIO_VQCONFIG_LEN;
129 dev_len += dev->feat_len * 2;
130 dev_len += virtio_bus_get_vdev_config_len(&dev->bus);
132 bus->dev_offs += dev_len;
134 dev->host_features = virtio_bus_get_vdev_features(&dev->bus,
136 s390_virtio_device_sync(dev);
137 s390_virtio_reset_idx(dev);
138 if (dev->qdev.hotplugged) {
139 s390_virtio_irq(VIRTIO_PARAM_DEV_ADD, dev->dev_offs);
143 static void s390_virtio_net_realize(VirtIOS390Device *s390_dev, Error **errp)
145 DeviceState *qdev = DEVICE(s390_dev);
146 VirtIONetS390 *dev = VIRTIO_NET_S390(s390_dev);
147 DeviceState *vdev = DEVICE(&dev->vdev);
150 virtio_net_set_config_size(&dev->vdev, s390_dev->host_features);
151 virtio_net_set_netclient_name(&dev->vdev, qdev->id,
152 object_get_typename(OBJECT(qdev)));
153 qdev_set_parent_bus(vdev, BUS(&s390_dev->bus));
154 object_property_set_bool(OBJECT(vdev), true, "realized", &err);
156 error_propagate(errp, err);
160 s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
163 static void s390_virtio_net_instance_init(Object *obj)
165 VirtIONetS390 *dev = VIRTIO_NET_S390(obj);
167 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
169 object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev),
170 "bootindex", &error_abort);
173 static void s390_virtio_blk_realize(VirtIOS390Device *s390_dev, Error **errp)
175 VirtIOBlkS390 *dev = VIRTIO_BLK_S390(s390_dev);
176 DeviceState *vdev = DEVICE(&dev->vdev);
179 qdev_set_parent_bus(vdev, BUS(&s390_dev->bus));
180 object_property_set_bool(OBJECT(vdev), true, "realized", &err);
182 error_propagate(errp, err);
185 s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
188 static void s390_virtio_blk_instance_init(Object *obj)
190 VirtIOBlkS390 *dev = VIRTIO_BLK_S390(obj);
192 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
194 object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev),"iothread",
196 object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev),
197 "bootindex", &error_abort);
200 static void s390_virtio_serial_realize(VirtIOS390Device *s390_dev, Error **errp)
202 VirtIOSerialS390 *dev = VIRTIO_SERIAL_S390(s390_dev);
203 DeviceState *vdev = DEVICE(&dev->vdev);
204 DeviceState *qdev = DEVICE(s390_dev);
209 bus = DO_UPCAST(VirtIOS390Bus, bus, qdev->parent_bus);
212 * For command line compatibility, this sets the virtio-serial-device bus
216 bus_name = g_strdup_printf("%s.0", qdev->id);
217 virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name);
221 qdev_set_parent_bus(vdev, BUS(&s390_dev->bus));
222 object_property_set_bool(OBJECT(vdev), true, "realized", &err);
224 error_propagate(errp, err);
228 s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
229 bus->console = s390_dev;
232 static void s390_virtio_serial_instance_init(Object *obj)
234 VirtIOSerialS390 *dev = VIRTIO_SERIAL_S390(obj);
236 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
240 static void s390_virtio_scsi_realize(VirtIOS390Device *s390_dev, Error **errp)
242 VirtIOSCSIS390 *dev = VIRTIO_SCSI_S390(s390_dev);
243 DeviceState *vdev = DEVICE(&dev->vdev);
244 DeviceState *qdev = DEVICE(s390_dev);
249 * For command line compatibility, this sets the virtio-scsi-device bus
253 bus_name = g_strdup_printf("%s.0", qdev->id);
254 virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name);
258 qdev_set_parent_bus(vdev, BUS(&s390_dev->bus));
259 object_property_set_bool(OBJECT(vdev), true, "realized", &err);
261 error_propagate(errp, err);
265 s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
268 static void s390_virtio_scsi_instance_init(Object *obj)
270 VirtIOSCSIS390 *dev = VIRTIO_SCSI_S390(obj);
272 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
276 #ifdef CONFIG_VHOST_SCSI
277 static void s390_vhost_scsi_realize(VirtIOS390Device *s390_dev, Error **errp)
279 VHostSCSIS390 *dev = VHOST_SCSI_S390(s390_dev);
280 DeviceState *vdev = DEVICE(&dev->vdev);
283 qdev_set_parent_bus(vdev, BUS(&s390_dev->bus));
284 object_property_set_bool(OBJECT(vdev), true, "realized", &err);
286 error_propagate(errp, err);
290 s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
293 static void s390_vhost_scsi_instance_init(Object *obj)
295 VHostSCSIS390 *dev = VHOST_SCSI_S390(obj);
297 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
303 static void s390_virtio_rng_realize(VirtIOS390Device *s390_dev, Error **errp)
305 VirtIORNGS390 *dev = VIRTIO_RNG_S390(s390_dev);
306 DeviceState *vdev = DEVICE(&dev->vdev);
309 qdev_set_parent_bus(vdev, BUS(&s390_dev->bus));
310 object_property_set_bool(OBJECT(vdev), true, "realized", &err);
312 error_propagate(errp, err);
316 object_property_set_link(OBJECT(dev),
317 OBJECT(dev->vdev.conf.rng), "rng",
320 s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
323 static void s390_virtio_rng_instance_init(Object *obj)
325 VirtIORNGS390 *dev = VIRTIO_RNG_S390(obj);
327 virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
329 object_property_add_alias(obj, "rng", OBJECT(&dev->vdev),
330 "rng", &error_abort);
333 static uint64_t s390_virtio_device_vq_token(VirtIOS390Device *dev, int vq)
335 ram_addr_t token_off;
337 token_off = (dev->dev_offs + VIRTIO_DEV_OFFS_CONFIG) +
338 (vq * VIRTIO_VQCONFIG_LEN) +
339 VIRTIO_VQCONFIG_OFFS_TOKEN;
341 return address_space_ldq_be(&address_space_memory, token_off,
342 MEMTXATTRS_UNSPECIFIED, NULL);
345 static ram_addr_t s390_virtio_device_num_vq(VirtIOS390Device *dev)
347 VirtIODevice *vdev = dev->vdev;
350 for (num_vq = 0; num_vq < VIRTIO_PCI_QUEUE_MAX; num_vq++) {
351 if (!virtio_queue_get_num(vdev, num_vq)) {
359 static ram_addr_t s390_virtio_next_ring(VirtIOS390Bus *bus)
361 ram_addr_t r = bus->next_ring;
363 bus->next_ring += VIRTIO_RING_LEN;
367 void s390_virtio_device_sync(VirtIOS390Device *dev)
369 VirtIOS390Bus *bus = DO_UPCAST(VirtIOS390Bus, bus, dev->qdev.parent_bus);
374 virtio_reset(dev->vdev);
377 address_space_stb(&address_space_memory,
378 dev->dev_offs + VIRTIO_DEV_OFFS_TYPE,
379 dev->vdev->device_id,
380 MEMTXATTRS_UNSPECIFIED,
383 address_space_stb(&address_space_memory,
384 dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ,
385 s390_virtio_device_num_vq(dev),
386 MEMTXATTRS_UNSPECIFIED,
388 address_space_stb(&address_space_memory,
389 dev->dev_offs + VIRTIO_DEV_OFFS_FEATURE_LEN,
391 MEMTXATTRS_UNSPECIFIED,
394 address_space_stb(&address_space_memory,
395 dev->dev_offs + VIRTIO_DEV_OFFS_CONFIG_LEN,
396 dev->vdev->config_len,
397 MEMTXATTRS_UNSPECIFIED,
400 num_vq = s390_virtio_device_num_vq(dev);
401 address_space_stb(&address_space_memory,
402 dev->dev_offs + VIRTIO_DEV_OFFS_NUM_VQ, num_vq,
403 MEMTXATTRS_UNSPECIFIED, NULL);
405 /* Sync virtqueues */
406 for (i = 0; i < num_vq; i++) {
407 ram_addr_t vq = (dev->dev_offs + VIRTIO_DEV_OFFS_CONFIG) +
408 (i * VIRTIO_VQCONFIG_LEN);
411 vring = s390_virtio_next_ring(bus);
412 virtio_queue_set_addr(dev->vdev, i, vring);
413 virtio_queue_set_vector(dev->vdev, i, i);
414 address_space_stq_be(&address_space_memory,
415 vq + VIRTIO_VQCONFIG_OFFS_ADDRESS, vring,
416 MEMTXATTRS_UNSPECIFIED, NULL);
417 address_space_stw_be(&address_space_memory,
418 vq + VIRTIO_VQCONFIG_OFFS_NUM,
419 virtio_queue_get_num(dev->vdev, i),
420 MEMTXATTRS_UNSPECIFIED,
424 cur_offs = dev->dev_offs;
425 cur_offs += VIRTIO_DEV_OFFS_CONFIG;
426 cur_offs += num_vq * VIRTIO_VQCONFIG_LEN;
428 /* Sync feature bitmap */
429 address_space_stl_le(&address_space_memory, cur_offs, dev->host_features,
430 MEMTXATTRS_UNSPECIFIED, NULL);
432 dev->feat_offs = cur_offs + dev->feat_len;
433 cur_offs += dev->feat_len * 2;
435 /* Sync config space */
436 virtio_bus_get_vdev_config(&dev->bus, dev->vdev->config);
438 cpu_physical_memory_write(cur_offs,
439 dev->vdev->config, dev->vdev->config_len);
440 cur_offs += dev->vdev->config_len;
443 void s390_virtio_device_update_status(VirtIOS390Device *dev)
445 VirtIODevice *vdev = dev->vdev;
448 virtio_set_status(vdev,
449 address_space_ldub(&address_space_memory,
450 dev->dev_offs + VIRTIO_DEV_OFFS_STATUS,
451 MEMTXATTRS_UNSPECIFIED, NULL));
453 /* Update guest supported feature bitmap */
455 features = bswap32(address_space_ldl_be(&address_space_memory,
457 MEMTXATTRS_UNSPECIFIED, NULL));
458 virtio_set_features(vdev, features);
461 /* Find a device by vring address */
462 VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus,
469 QTAILQ_FOREACH(kid, &bus->bus.children, sibling) {
470 VirtIOS390Device *dev = (VirtIOS390Device *)kid->child;
472 for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
473 if (!virtio_queue_get_addr(dev->vdev, i))
475 if (virtio_queue_get_addr(dev->vdev, i) == mem) {
487 /* Find a device by device descriptor location */
488 VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus, ram_addr_t mem)
492 QTAILQ_FOREACH(kid, &bus->bus.children, sibling) {
493 VirtIOS390Device *dev = (VirtIOS390Device *)kid->child;
494 if (dev->dev_offs == mem) {
502 /* DeviceState to VirtIOS390Device. Note: used on datapath,
503 * be careful and test performance if you change this.
505 static inline VirtIOS390Device *to_virtio_s390_device_fast(DeviceState *d)
507 return container_of(d, VirtIOS390Device, qdev);
510 /* DeviceState to VirtIOS390Device. TODO: use QOM. */
511 static inline VirtIOS390Device *to_virtio_s390_device(DeviceState *d)
513 return container_of(d, VirtIOS390Device, qdev);
516 static void virtio_s390_notify(DeviceState *d, uint16_t vector)
518 VirtIOS390Device *dev = to_virtio_s390_device_fast(d);
519 uint64_t token = s390_virtio_device_vq_token(dev, vector);
521 s390_virtio_irq(0, token);
524 static unsigned virtio_s390_get_features(DeviceState *d)
526 VirtIOS390Device *dev = to_virtio_s390_device(d);
527 return dev->host_features;
530 /**************** S390 Virtio Bus Device Descriptions *******************/
532 static Property s390_virtio_net_properties[] = {
533 DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features),
534 DEFINE_VIRTIO_NET_FEATURES(VirtIOS390Device, host_features),
535 DEFINE_PROP_END_OF_LIST(),
538 static void s390_virtio_net_class_init(ObjectClass *klass, void *data)
540 DeviceClass *dc = DEVICE_CLASS(klass);
541 VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
543 k->realize = s390_virtio_net_realize;
544 dc->props = s390_virtio_net_properties;
547 static const TypeInfo s390_virtio_net = {
548 .name = TYPE_VIRTIO_NET_S390,
549 .parent = TYPE_VIRTIO_S390_DEVICE,
550 .instance_size = sizeof(VirtIONetS390),
551 .instance_init = s390_virtio_net_instance_init,
552 .class_init = s390_virtio_net_class_init,
555 static void s390_virtio_blk_class_init(ObjectClass *klass, void *data)
557 VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
559 k->realize = s390_virtio_blk_realize;
562 static const TypeInfo s390_virtio_blk = {
563 .name = "virtio-blk-s390",
564 .parent = TYPE_VIRTIO_S390_DEVICE,
565 .instance_size = sizeof(VirtIOBlkS390),
566 .instance_init = s390_virtio_blk_instance_init,
567 .class_init = s390_virtio_blk_class_init,
570 static Property s390_virtio_serial_properties[] = {
571 DEFINE_PROP_END_OF_LIST(),
574 static void s390_virtio_serial_class_init(ObjectClass *klass, void *data)
576 DeviceClass *dc = DEVICE_CLASS(klass);
577 VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
579 k->realize = s390_virtio_serial_realize;
580 dc->props = s390_virtio_serial_properties;
583 static const TypeInfo s390_virtio_serial = {
584 .name = TYPE_VIRTIO_SERIAL_S390,
585 .parent = TYPE_VIRTIO_S390_DEVICE,
586 .instance_size = sizeof(VirtIOSerialS390),
587 .instance_init = s390_virtio_serial_instance_init,
588 .class_init = s390_virtio_serial_class_init,
591 static Property s390_virtio_rng_properties[] = {
592 DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features),
593 DEFINE_PROP_END_OF_LIST(),
596 static void s390_virtio_rng_class_init(ObjectClass *klass, void *data)
598 DeviceClass *dc = DEVICE_CLASS(klass);
599 VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
601 k->realize = s390_virtio_rng_realize;
602 dc->props = s390_virtio_rng_properties;
605 static const TypeInfo s390_virtio_rng = {
606 .name = TYPE_VIRTIO_RNG_S390,
607 .parent = TYPE_VIRTIO_S390_DEVICE,
608 .instance_size = sizeof(VirtIORNGS390),
609 .instance_init = s390_virtio_rng_instance_init,
610 .class_init = s390_virtio_rng_class_init,
613 static void s390_virtio_busdev_realize(DeviceState *dev, Error **errp)
615 VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
616 VirtIOS390DeviceClass *_info = VIRTIO_S390_DEVICE_GET_CLASS(dev);
618 virtio_s390_bus_new(&_dev->bus, sizeof(_dev->bus), _dev);
620 _info->realize(_dev, errp);
623 static void s390_virtio_busdev_reset(DeviceState *dev)
625 VirtIOS390Device *_dev = (VirtIOS390Device *)dev;
627 virtio_reset(_dev->vdev);
630 static void virtio_s390_device_class_init(ObjectClass *klass, void *data)
632 DeviceClass *dc = DEVICE_CLASS(klass);
634 dc->realize = s390_virtio_busdev_realize;
635 dc->bus_type = TYPE_S390_VIRTIO_BUS;
636 dc->reset = s390_virtio_busdev_reset;
639 static const TypeInfo virtio_s390_device_info = {
640 .name = TYPE_VIRTIO_S390_DEVICE,
641 .parent = TYPE_DEVICE,
642 .instance_size = sizeof(VirtIOS390Device),
643 .class_init = virtio_s390_device_class_init,
644 .class_size = sizeof(VirtIOS390DeviceClass),
648 static Property s390_virtio_scsi_properties[] = {
649 DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features),
650 DEFINE_VIRTIO_SCSI_FEATURES(VirtIOS390Device, host_features),
651 DEFINE_PROP_END_OF_LIST(),
654 static void s390_virtio_scsi_class_init(ObjectClass *klass, void *data)
656 DeviceClass *dc = DEVICE_CLASS(klass);
657 VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
659 k->realize = s390_virtio_scsi_realize;
660 dc->props = s390_virtio_scsi_properties;
663 static const TypeInfo s390_virtio_scsi = {
664 .name = TYPE_VIRTIO_SCSI_S390,
665 .parent = TYPE_VIRTIO_S390_DEVICE,
666 .instance_size = sizeof(VirtIOSCSIS390),
667 .instance_init = s390_virtio_scsi_instance_init,
668 .class_init = s390_virtio_scsi_class_init,
671 #ifdef CONFIG_VHOST_SCSI
672 static Property s390_vhost_scsi_properties[] = {
673 DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features),
674 DEFINE_PROP_END_OF_LIST(),
677 static void s390_vhost_scsi_class_init(ObjectClass *klass, void *data)
679 DeviceClass *dc = DEVICE_CLASS(klass);
680 VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass);
682 k->realize = s390_vhost_scsi_realize;
683 dc->props = s390_vhost_scsi_properties;
686 static const TypeInfo s390_vhost_scsi = {
687 .name = TYPE_VHOST_SCSI_S390,
688 .parent = TYPE_VIRTIO_S390_DEVICE,
689 .instance_size = sizeof(VHostSCSIS390),
690 .instance_init = s390_vhost_scsi_instance_init,
691 .class_init = s390_vhost_scsi_class_init,
695 /***************** S390 Virtio Bus Bridge Device *******************/
696 /* Only required to have the virtio bus as child in the system bus */
698 static int s390_virtio_bridge_init(SysBusDevice *dev)
704 static void s390_virtio_bridge_class_init(ObjectClass *klass, void *data)
706 SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
708 k->init = s390_virtio_bridge_init;
711 static const TypeInfo s390_virtio_bridge_info = {
712 .name = "s390-virtio-bridge",
713 .parent = TYPE_SYS_BUS_DEVICE,
714 .instance_size = sizeof(SysBusDevice),
715 .class_init = s390_virtio_bridge_class_init,
716 .interfaces = (InterfaceInfo[]) {
717 { TYPE_HOTPLUG_HANDLER },
722 /* virtio-s390-bus */
724 static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size,
725 VirtIOS390Device *dev)
727 DeviceState *qdev = DEVICE(dev);
728 char virtio_bus_name[] = "virtio-bus";
730 qbus_create_inplace(bus, bus_size, TYPE_VIRTIO_S390_BUS,
731 qdev, virtio_bus_name);
734 static void virtio_s390_bus_class_init(ObjectClass *klass, void *data)
736 VirtioBusClass *k = VIRTIO_BUS_CLASS(klass);
737 BusClass *bus_class = BUS_CLASS(klass);
738 bus_class->max_dev = 1;
739 k->notify = virtio_s390_notify;
740 k->get_features = virtio_s390_get_features;
743 static const TypeInfo virtio_s390_bus_info = {
744 .name = TYPE_VIRTIO_S390_BUS,
745 .parent = TYPE_VIRTIO_BUS,
746 .instance_size = sizeof(VirtioS390BusState),
747 .class_init = virtio_s390_bus_class_init,
750 static void s390_virtio_register_types(void)
752 type_register_static(&virtio_s390_bus_info);
753 type_register_static(&s390_virtio_bus_info);
754 type_register_static(&virtio_s390_device_info);
755 type_register_static(&s390_virtio_serial);
756 type_register_static(&s390_virtio_blk);
757 type_register_static(&s390_virtio_net);
758 type_register_static(&s390_virtio_scsi);
759 #ifdef CONFIG_VHOST_SCSI
760 type_register_static(&s390_vhost_scsi);
762 type_register_static(&s390_virtio_rng);
763 type_register_static(&s390_virtio_bridge_info);
766 type_init(s390_virtio_register_types)