Lines Matching +full:04 +full:- +full:s390x +full:- +full:all +full:- +full:linux +full:- +full:static
6 * Pierre Morel <pmorel@linux.vnet.ibm.com>
9 * your option) any later version. See the COPYING file in the top-level
15 #include "exec/address-spaces.h"
19 #include "migration/qemu-file-types.h"
20 #include "hw/virtio/virtio-net.h"
22 #include "qemu/error-report.h"
25 #include "hw/virtio/virtio-bus.h"
26 #include "hw/s390x/adapter.h"
27 #include "hw/s390x/s390_flic.h"
29 #include "hw/s390x/ioinst.h"
30 #include "hw/s390x/css.h"
31 #include "virtio-ccw.h"
33 #include "hw/s390x/css-bridge.h"
34 #include "hw/s390x/s390-virtio-ccw.h"
41 static int virtio_ccw_dev_post_load(void *opaque, int version_id) in virtio_ccw_dev_post_load()
47 ccw_dev->sch->driver_data = dev; in virtio_ccw_dev_post_load()
48 if (ccw_dev->sch->thinint_active) { in virtio_ccw_dev_post_load()
49 dev->routes.adapter.adapter_id = css_get_adapter_id( in virtio_ccw_dev_post_load()
51 dev->thinint_isc); in virtio_ccw_dev_post_load()
53 /* Re-fill subch_id after loading the subchannel states.*/ in virtio_ccw_dev_post_load()
54 if (ck->refill_ids) { in virtio_ccw_dev_post_load()
55 ck->refill_ids(ccw_dev); in virtio_ccw_dev_post_load()
65 static int virtio_ccw_dev_tmp_pre_save(void *opaque) in virtio_ccw_dev_tmp_pre_save()
68 VirtioCcwDevice *dev = tmp->parent; in virtio_ccw_dev_tmp_pre_save()
69 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_dev_tmp_pre_save()
71 tmp->config_vector = vdev->config_vector; in virtio_ccw_dev_tmp_pre_save()
76 static int virtio_ccw_dev_tmp_post_load(void *opaque, int version_id) in virtio_ccw_dev_tmp_post_load()
79 VirtioCcwDevice *dev = tmp->parent; in virtio_ccw_dev_tmp_post_load()
80 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_dev_tmp_post_load()
82 vdev->config_vector = tmp->config_vector; in virtio_ccw_dev_tmp_post_load()
120 static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size,
126 VirtioCcwDevice *dev = sch->driver_data; in virtio_ccw_get_vdev()
129 vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_get_vdev()
134 static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) in virtio_ccw_start_ioeventfd()
136 virtio_bus_start_ioeventfd(&dev->bus); in virtio_ccw_start_ioeventfd()
139 static void virtio_ccw_stop_ioeventfd(VirtioCcwDevice *dev) in virtio_ccw_stop_ioeventfd()
141 virtio_bus_stop_ioeventfd(&dev->bus); in virtio_ccw_stop_ioeventfd()
144 static bool virtio_ccw_ioeventfd_enabled(DeviceState *d) in virtio_ccw_ioeventfd_enabled()
148 return (dev->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD) != 0; in virtio_ccw_ioeventfd_enabled()
151 static int virtio_ccw_ioeventfd_assign(DeviceState *d, EventNotifier *notifier, in virtio_ccw_ioeventfd_assign()
156 SubchDev *sch = ccw_dev->sch; in virtio_ccw_ioeventfd_assign()
157 uint32_t sch_id = (css_build_subchannel_id(sch) << 16) | sch->schid; in virtio_ccw_ioeventfd_assign()
203 static int virtio_ccw_set_vqs(SubchDev *sch, VqInfoBlock *info, in virtio_ccw_set_vqs()
207 uint16_t index = info ? info->index : linfo->index; in virtio_ccw_set_vqs()
208 uint16_t num = info ? info->num : linfo->num; in virtio_ccw_set_vqs()
209 uint64_t desc = info ? info->desc : linfo->queue; in virtio_ccw_set_vqs()
212 return -EINVAL; in virtio_ccw_set_vqs()
216 if (linfo && desc && (linfo->align != 4096)) { in virtio_ccw_set_vqs()
217 return -EINVAL; in virtio_ccw_set_vqs()
221 return -EINVAL; in virtio_ccw_set_vqs()
225 virtio_queue_set_rings(vdev, index, desc, info->avail, info->used); in virtio_ccw_set_vqs()
233 /* virtio-1 allows changing the ring size. */ in virtio_ccw_set_vqs()
236 return -EINVAL; in virtio_ccw_set_vqs()
242 return -EINVAL; in virtio_ccw_set_vqs()
248 vdev->config_vector = VIRTIO_QUEUE_MAX; in virtio_ccw_set_vqs()
252 static void virtio_ccw_reset_virtio(VirtioCcwDevice *dev) in virtio_ccw_reset_virtio()
256 virtio_bus_reset(&dev->bus); in virtio_ccw_reset_virtio()
257 if (dev->indicators) { in virtio_ccw_reset_virtio()
258 release_indicator(&dev->routes.adapter, dev->indicators); in virtio_ccw_reset_virtio()
259 dev->indicators = NULL; in virtio_ccw_reset_virtio()
261 if (dev->indicators2) { in virtio_ccw_reset_virtio()
262 release_indicator(&dev->routes.adapter, dev->indicators2); in virtio_ccw_reset_virtio()
263 dev->indicators2 = NULL; in virtio_ccw_reset_virtio()
265 if (dev->summary_indicator) { in virtio_ccw_reset_virtio()
266 release_indicator(&dev->routes.adapter, dev->summary_indicator); in virtio_ccw_reset_virtio()
267 dev->summary_indicator = NULL; in virtio_ccw_reset_virtio()
269 ccw_dev->sch->thinint_active = false; in virtio_ccw_reset_virtio()
272 static int virtio_ccw_handle_set_vq(SubchDev *sch, CCW1 ccw, bool check_len, in virtio_ccw_handle_set_vq()
282 return -EINVAL; in virtio_ccw_handle_set_vq()
286 return -EINVAL; in virtio_ccw_handle_set_vq()
289 return -EFAULT; in virtio_ccw_handle_set_vq()
292 ret = ccw_dstream_read(&sch->cds, linfo); in virtio_ccw_handle_set_vq()
302 ret = ccw_dstream_read(&sch->cds, info); in virtio_ccw_handle_set_vq()
313 sch->curr_status.scsw.count = 0; in virtio_ccw_handle_set_vq()
317 static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) in virtio_ccw_cb()
325 VirtioCcwDevice *dev = sch->driver_data; in virtio_ccw_cb()
332 return -EINVAL; in virtio_ccw_cb()
335 trace_virtio_ccw_interpret_ccw(sch->cssid, sch->ssid, sch->schid, in virtio_ccw_cb()
339 if (dev->revision < 0 && ccw.cmd_code != CCW_CMD_SET_VIRTIO_REV) { in virtio_ccw_cb()
340 if (dev->force_revision_1) { in virtio_ccw_cb()
342 * virtio-1 drivers must start with negotiating to a revision >= 1, in virtio_ccw_cb()
343 * so post a command reject for all other commands in virtio_ccw_cb()
345 return -ENOSYS; in virtio_ccw_cb()
351 dev->revision = 0; in virtio_ccw_cb()
358 ret = virtio_ccw_handle_set_vq(sch, ccw, check_len, dev->revision < 1); in virtio_ccw_cb()
367 ret = -EINVAL; in virtio_ccw_cb()
372 ret = -EINVAL; in virtio_ccw_cb()
376 ret = -EFAULT; in virtio_ccw_cb()
380 ccw_dstream_advance(&sch->cds, sizeof(features.features)); in virtio_ccw_cb()
381 ret = ccw_dstream_read(&sch->cds, features.index); in virtio_ccw_cb()
386 if (dev->revision >= 1) { in virtio_ccw_cb()
389 (vdev->host_features & ~vdc->legacy_features); in virtio_ccw_cb()
391 features.features = (uint32_t)vdev->host_features; in virtio_ccw_cb()
393 } else if ((features.index == 1) && (dev->revision >= 1)) { in virtio_ccw_cb()
398 features.features = (uint32_t)(vdev->host_features >> 32); in virtio_ccw_cb()
403 ccw_dstream_rewind(&sch->cds); in virtio_ccw_cb()
405 ret = ccw_dstream_write(&sch->cds, features.features); in virtio_ccw_cb()
407 sch->curr_status.scsw.count = ccw.count - sizeof(features); in virtio_ccw_cb()
414 ret = -EINVAL; in virtio_ccw_cb()
419 ret = -EINVAL; in virtio_ccw_cb()
423 ret = -EFAULT; in virtio_ccw_cb()
425 ret = ccw_dstream_read(&sch->cds, features); in virtio_ccw_cb()
432 (vdev->guest_features & 0xffffffff00000000ULL) | in virtio_ccw_cb()
434 } else if ((features.index == 1) && (dev->revision >= 1)) { in virtio_ccw_cb()
441 (vdev->guest_features & 0x00000000ffffffffULL) | in virtio_ccw_cb()
455 sch->curr_status.scsw.count = ccw.count - sizeof(features); in virtio_ccw_cb()
461 if (ccw.count > vdev->config_len) { in virtio_ccw_cb()
462 ret = -EINVAL; in virtio_ccw_cb()
466 len = MIN(ccw.count, vdev->config_len); in virtio_ccw_cb()
468 ret = -EFAULT; in virtio_ccw_cb()
470 virtio_bus_get_vdev_config(&dev->bus, vdev->config); in virtio_ccw_cb()
471 ret = ccw_dstream_write_buf(&sch->cds, vdev->config, len); in virtio_ccw_cb()
473 sch->curr_status.scsw.count = ccw.count - len; in virtio_ccw_cb()
479 if (ccw.count > vdev->config_len) { in virtio_ccw_cb()
480 ret = -EINVAL; in virtio_ccw_cb()
484 len = MIN(ccw.count, vdev->config_len); in virtio_ccw_cb()
486 ret = -EFAULT; in virtio_ccw_cb()
488 ret = ccw_dstream_read_buf(&sch->cds, vdev->config, len); in virtio_ccw_cb()
490 virtio_bus_set_vdev_config(&dev->bus, vdev->config); in virtio_ccw_cb()
491 sch->curr_status.scsw.count = ccw.count - len; in virtio_ccw_cb()
498 ret = -EINVAL; in virtio_ccw_cb()
503 ret = -EINVAL; in virtio_ccw_cb()
507 ret = -EFAULT; in virtio_ccw_cb()
509 address_space_stb(&address_space_memory, ccw.cda, vdev->status, in virtio_ccw_cb()
511 sch->curr_status.scsw.count = ccw.count - sizeof(vdev->status); in virtio_ccw_cb()
518 ret = -EINVAL; in virtio_ccw_cb()
523 ret = -EINVAL; in virtio_ccw_cb()
527 ret = -EFAULT; in virtio_ccw_cb()
529 ret = ccw_dstream_read(&sch->cds, status); in virtio_ccw_cb()
537 if (vdev->status == 0) { in virtio_ccw_cb()
543 sch->curr_status.scsw.count = ccw.count - sizeof(status); in virtio_ccw_cb()
547 ret = -ENOSYS; in virtio_ccw_cb()
554 ret = -EINVAL; in virtio_ccw_cb()
559 ret = -EINVAL; in virtio_ccw_cb()
562 if (sch->thinint_active) { in virtio_ccw_cb()
564 ret = -ENOSYS; in virtio_ccw_cb()
568 /* More queues than indicator bits --> trigger a reject */ in virtio_ccw_cb()
569 ret = -ENOSYS; in virtio_ccw_cb()
573 ret = -EFAULT; in virtio_ccw_cb()
575 ret = ccw_dstream_read(&sch->cds, indicators); in virtio_ccw_cb()
580 dev->indicators = get_indicator(indicators, sizeof(uint64_t)); in virtio_ccw_cb()
581 sch->curr_status.scsw.count = ccw.count - sizeof(indicators); in virtio_ccw_cb()
588 ret = -EINVAL; in virtio_ccw_cb()
593 ret = -EINVAL; in virtio_ccw_cb()
597 ret = -EFAULT; in virtio_ccw_cb()
599 ret = ccw_dstream_read(&sch->cds, indicators); in virtio_ccw_cb()
604 dev->indicators2 = get_indicator(indicators, sizeof(uint64_t)); in virtio_ccw_cb()
605 sch->curr_status.scsw.count = ccw.count - sizeof(indicators); in virtio_ccw_cb()
612 ret = -EINVAL; in virtio_ccw_cb()
617 ret = -EINVAL; in virtio_ccw_cb()
621 ret = -EFAULT; in virtio_ccw_cb()
623 ret = ccw_dstream_read(&sch->cds, vq_config.index); in virtio_ccw_cb()
629 ret = -EINVAL; in virtio_ccw_cb()
635 ret = ccw_dstream_write(&sch->cds, vq_config.num_max); in virtio_ccw_cb()
637 sch->curr_status.scsw.count = ccw.count - sizeof(vq_config); in virtio_ccw_cb()
644 ret = -EINVAL; in virtio_ccw_cb()
649 ret = -EINVAL; in virtio_ccw_cb()
653 ret = -EFAULT; in virtio_ccw_cb()
654 } else if (dev->indicators && !sch->thinint_active) { in virtio_ccw_cb()
656 ret = -ENOSYS; in virtio_ccw_cb()
658 if (ccw_dstream_read(&sch->cds, thinint)) { in virtio_ccw_cb()
659 ret = -EFAULT; in virtio_ccw_cb()
667 dev->summary_indicator = in virtio_ccw_cb()
669 dev->indicators = in virtio_ccw_cb()
672 dev->thinint_isc = thinint.isc; in virtio_ccw_cb()
673 dev->routes.adapter.ind_offset = thinint.ind_bit; in virtio_ccw_cb()
674 dev->routes.adapter.summary_offset = 7; in virtio_ccw_cb()
675 dev->routes.adapter.adapter_id = css_get_adapter_id( in virtio_ccw_cb()
677 dev->thinint_isc); in virtio_ccw_cb()
678 sch->thinint_active = ((dev->indicators != NULL) && in virtio_ccw_cb()
679 (dev->summary_indicator != NULL)); in virtio_ccw_cb()
680 sch->curr_status.scsw.count = ccw.count - sizeof(thinint); in virtio_ccw_cb()
688 ret = -EINVAL; in virtio_ccw_cb()
692 ret = -EFAULT; in virtio_ccw_cb()
695 ret = ccw_dstream_read_buf(&sch->cds, &revinfo, 4); in virtio_ccw_cb()
703 ret = -EINVAL; in virtio_ccw_cb()
710 if (dev->revision >= 0 || in virtio_ccw_cb()
712 (dev->force_revision_1 && !revinfo.revision)) { in virtio_ccw_cb()
713 ret = -ENOSYS; in virtio_ccw_cb()
717 dev->revision = revinfo.revision; in virtio_ccw_cb()
720 ret = -ENOSYS; in virtio_ccw_cb()
726 static void virtio_sch_disable_cb(SubchDev *sch) in virtio_sch_disable_cb()
728 VirtioCcwDevice *dev = sch->driver_data; in virtio_sch_disable_cb()
730 dev->revision = -1; in virtio_sch_disable_cb()
733 static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) in virtio_ccw_device_realize()
742 sch = css_create_sch(ccw_dev->devno, errp); in virtio_ccw_device_realize()
746 if (!virtio_ccw_rev_max(dev) && dev->force_revision_1) { in virtio_ccw_device_realize()
752 sch->driver_data = dev; in virtio_ccw_device_realize()
753 sch->ccw_cb = virtio_ccw_cb; in virtio_ccw_device_realize()
754 sch->disable_cb = virtio_sch_disable_cb; in virtio_ccw_device_realize()
755 sch->id.reserved = 0xff; in virtio_ccw_device_realize()
756 sch->id.cu_type = VIRTIO_CCW_CU_TYPE; in virtio_ccw_device_realize()
757 sch->do_subchannel_work = do_subchannel_work_virtual; in virtio_ccw_device_realize()
758 sch->irb_cb = build_irb_virtual; in virtio_ccw_device_realize()
759 ccw_dev->sch = sch; in virtio_ccw_device_realize()
760 dev->indicators = NULL; in virtio_ccw_device_realize()
761 dev->revision = -1; in virtio_ccw_device_realize()
763 dev->routes.gsi[i] = -1; in virtio_ccw_device_realize()
768 sch->cssid, sch->ssid, sch->schid, sch->devno, in virtio_ccw_device_realize()
769 ccw_dev->devno.valid ? "user-configured" : "auto-configured"); in virtio_ccw_device_realize()
771 /* fd-based ioevents can't be synchronized in record/replay */ in virtio_ccw_device_realize()
773 dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD; in virtio_ccw_device_realize()
776 if (k->realize) { in virtio_ccw_device_realize()
777 k->realize(dev, &err); in virtio_ccw_device_realize()
783 ck->realize(ccw_dev, &err); in virtio_ccw_device_realize()
792 css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL); in virtio_ccw_device_realize()
793 ccw_dev->sch = NULL; in virtio_ccw_device_realize()
797 static void virtio_ccw_device_unrealize(VirtioCcwDevice *dev) in virtio_ccw_device_unrealize()
801 SubchDev *sch = ccw_dev->sch; in virtio_ccw_device_unrealize()
803 if (dc->unrealize) { in virtio_ccw_device_unrealize()
804 dc->unrealize(dev); in virtio_ccw_device_unrealize()
808 css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL); in virtio_ccw_device_unrealize()
810 ccw_dev->sch = NULL; in virtio_ccw_device_unrealize()
812 if (dev->indicators) { in virtio_ccw_device_unrealize()
813 release_indicator(&dev->routes.adapter, dev->indicators); in virtio_ccw_device_unrealize()
814 dev->indicators = NULL; in virtio_ccw_device_unrealize()
821 static inline VirtioCcwDevice *to_virtio_ccw_dev_fast(DeviceState *d) in to_virtio_ccw_dev_fast()
828 static uint8_t virtio_set_ind_atomic(SubchDev *sch, uint64_t ind_loc, in virtio_set_ind_atomic()
838 error_report("%s(%x.%x.%04x): unable to access indicator", in virtio_set_ind_atomic()
839 __func__, sch->cssid, sch->ssid, sch->schid); in virtio_set_ind_atomic()
840 return -1; in virtio_set_ind_atomic()
853 static void virtio_ccw_notify(DeviceState *d, uint16_t vector) in virtio_ccw_notify()
857 SubchDev *sch = ccw_dev->sch; in virtio_ccw_notify()
871 if (!dev->indicators) { in virtio_ccw_notify()
874 if (sch->thinint_active) { in virtio_ccw_notify()
881 uint64_t ind_bit = dev->routes.adapter.ind_offset; in virtio_ccw_notify()
883 virtio_set_ind_atomic(sch, dev->indicators->addr + in virtio_ccw_notify()
886 if (!virtio_set_ind_atomic(sch, dev->summary_indicator->addr, in virtio_ccw_notify()
888 css_adapter_interrupt(CSS_IO_ADAPTER_VIRTIO, dev->thinint_isc); in virtio_ccw_notify()
893 dev->indicators->addr, in virtio_ccw_notify()
897 address_space_stq(&address_space_memory, dev->indicators->addr, in virtio_ccw_notify()
902 if (!dev->indicators2) { in virtio_ccw_notify()
906 dev->indicators2->addr, in virtio_ccw_notify()
910 address_space_stq(&address_space_memory, dev->indicators2->addr, in virtio_ccw_notify()
916 static void virtio_ccw_reset_hold(Object *obj, ResetType type) in virtio_ccw_reset_hold()
923 if (vdc->parent_phases.hold) { in virtio_ccw_reset_hold()
924 vdc->parent_phases.hold(obj, type); in virtio_ccw_reset_hold()
928 static void virtio_ccw_vmstate_change(DeviceState *d, bool running) in virtio_ccw_vmstate_change()
939 static bool virtio_ccw_query_guest_notifiers(DeviceState *d) in virtio_ccw_query_guest_notifiers()
943 return !!(dev->sch->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ENA); in virtio_ccw_query_guest_notifiers()
946 static int virtio_ccw_get_mappings(VirtioCcwDevice *dev) in virtio_ccw_get_mappings()
951 if (!ccw_dev->sch->thinint_active) { in virtio_ccw_get_mappings()
952 return -EINVAL; in virtio_ccw_get_mappings()
955 r = map_indicator(&dev->routes.adapter, dev->summary_indicator); in virtio_ccw_get_mappings()
959 r = map_indicator(&dev->routes.adapter, dev->indicators); in virtio_ccw_get_mappings()
963 dev->routes.adapter.summary_addr = dev->summary_indicator->map; in virtio_ccw_get_mappings()
964 dev->routes.adapter.ind_addr = dev->indicators->map; in virtio_ccw_get_mappings()
969 static int virtio_ccw_setup_irqroutes(VirtioCcwDevice *dev, int nvqs) in virtio_ccw_setup_irqroutes()
972 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_setup_irqroutes()
986 dev->routes.num_routes = i; in virtio_ccw_setup_irqroutes()
987 return fsc->add_adapter_routes(fs, &dev->routes); in virtio_ccw_setup_irqroutes()
990 static void virtio_ccw_release_irqroutes(VirtioCcwDevice *dev, int nvqs) in virtio_ccw_release_irqroutes()
995 fsc->release_adapter_routes(fs, &dev->routes); in virtio_ccw_release_irqroutes()
998 static int virtio_ccw_add_irqfd(VirtioCcwDevice *dev, int n) in virtio_ccw_add_irqfd()
1000 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_add_irqfd()
1005 dev->routes.gsi[n]); in virtio_ccw_add_irqfd()
1008 static void virtio_ccw_remove_irqfd(VirtioCcwDevice *dev, int n) in virtio_ccw_remove_irqfd()
1010 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_remove_irqfd()
1016 dev->routes.gsi[n]); in virtio_ccw_remove_irqfd()
1020 static int virtio_ccw_set_guest_notifier(VirtioCcwDevice *dev, int n, in virtio_ccw_set_guest_notifier()
1023 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_set_guest_notifier()
1047 if (k->guest_notifier_mask && vdev->use_guest_notifier_mask) { in virtio_ccw_set_guest_notifier()
1048 k->guest_notifier_mask(vdev, n, false); in virtio_ccw_set_guest_notifier()
1050 /* get lost events and re-inject */ in virtio_ccw_set_guest_notifier()
1051 if (k->guest_notifier_pending && in virtio_ccw_set_guest_notifier()
1052 k->guest_notifier_pending(vdev, n)) { in virtio_ccw_set_guest_notifier()
1056 if (k->guest_notifier_mask && vdev->use_guest_notifier_mask) { in virtio_ccw_set_guest_notifier()
1057 k->guest_notifier_mask(vdev, n, true); in virtio_ccw_set_guest_notifier()
1068 static int virtio_ccw_set_guest_notifiers(DeviceState *d, int nvqs, in virtio_ccw_set_guest_notifiers()
1072 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_set_guest_notifiers()
1074 bool with_irqfd = ccw_dev->sch->thinint_active && kvm_irqfds_enabled(); in virtio_ccw_set_guest_notifiers()
1100 while (--n >= 0) { in virtio_ccw_set_guest_notifiers()
1110 static void virtio_ccw_save_queue(DeviceState *d, int n, QEMUFile *f) in virtio_ccw_save_queue()
1113 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_save_queue()
1118 static int virtio_ccw_load_queue(DeviceState *d, int n, QEMUFile *f) in virtio_ccw_load_queue()
1121 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_load_queue()
1130 static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f) in virtio_ccw_save_config()
1136 static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) in virtio_ccw_load_config()
1142 static void virtio_ccw_pre_plugged(DeviceState *d, Error **errp) in virtio_ccw_pre_plugged()
1145 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_pre_plugged()
1147 if (dev->max_rev >= 1) { in virtio_ccw_pre_plugged()
1148 virtio_add_feature(&vdev->host_features, VIRTIO_F_VERSION_1); in virtio_ccw_pre_plugged()
1152 /* This is called by virtio-bus just after the device is plugged. */
1153 static void virtio_ccw_device_plugged(DeviceState *d, Error **errp) in virtio_ccw_device_plugged()
1156 VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); in virtio_ccw_device_plugged()
1158 SubchDev *sch = ccw_dev->sch; in virtio_ccw_device_plugged()
1162 if (!virtio_has_feature(vdev->host_features, VIRTIO_F_VERSION_1)) { in virtio_ccw_device_plugged()
1163 dev->max_rev = 0; in virtio_ccw_device_plugged()
1187 if (virtio_get_num_queues(vdev) > flic->adapter_routes_max_batch) { in virtio_ccw_device_plugged()
1190 flic->adapter_routes_max_batch); in virtio_ccw_device_plugged()
1194 sch->id.cu_model = virtio_bus_get_vdev_id(&dev->bus); in virtio_ccw_device_plugged()
1197 css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, in virtio_ccw_device_plugged()
1198 d->hotplugged, 1); in virtio_ccw_device_plugged()
1201 static void virtio_ccw_device_unplugged(DeviceState *d) in virtio_ccw_device_unplugged()
1207 /**************** Virtio-ccw Bus Device Descriptions *******************/
1209 static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp) in virtio_ccw_busdev_realize()
1213 virtio_ccw_bus_new(&_dev->bus, sizeof(_dev->bus), _dev); in virtio_ccw_busdev_realize()
1217 static void virtio_ccw_busdev_unrealize(DeviceState *dev) in virtio_ccw_busdev_unrealize()
1224 static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev, in virtio_ccw_busdev_unplug()
1232 static void virtio_ccw_device_class_init(ObjectClass *klass, void *data) in virtio_ccw_device_class_init()
1239 k->unplug = virtio_ccw_busdev_unplug; in virtio_ccw_device_class_init()
1240 dc->realize = virtio_ccw_busdev_realize; in virtio_ccw_device_class_init()
1241 dc->unrealize = virtio_ccw_busdev_unrealize; in virtio_ccw_device_class_init()
1243 &vdc->parent_phases); in virtio_ccw_device_class_init()
1246 static const TypeInfo virtio_ccw_device_info = {
1255 /* virtio-ccw-bus */
1257 static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size, in virtio_ccw_bus_new()
1261 char virtio_bus_name[] = "virtio-bus"; in virtio_ccw_bus_new()
1266 static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data) in virtio_ccw_bus_class_init()
1271 bus_class->max_dev = 1; in virtio_ccw_bus_class_init()
1272 k->notify = virtio_ccw_notify; in virtio_ccw_bus_class_init()
1273 k->vmstate_change = virtio_ccw_vmstate_change; in virtio_ccw_bus_class_init()
1274 k->query_guest_notifiers = virtio_ccw_query_guest_notifiers; in virtio_ccw_bus_class_init()
1275 k->set_guest_notifiers = virtio_ccw_set_guest_notifiers; in virtio_ccw_bus_class_init()
1276 k->save_queue = virtio_ccw_save_queue; in virtio_ccw_bus_class_init()
1277 k->load_queue = virtio_ccw_load_queue; in virtio_ccw_bus_class_init()
1278 k->save_config = virtio_ccw_save_config; in virtio_ccw_bus_class_init()
1279 k->load_config = virtio_ccw_load_config; in virtio_ccw_bus_class_init()
1280 k->pre_plugged = virtio_ccw_pre_plugged; in virtio_ccw_bus_class_init()
1281 k->device_plugged = virtio_ccw_device_plugged; in virtio_ccw_bus_class_init()
1282 k->device_unplugged = virtio_ccw_device_unplugged; in virtio_ccw_bus_class_init()
1283 k->ioeventfd_enabled = virtio_ccw_ioeventfd_enabled; in virtio_ccw_bus_class_init()
1284 k->ioeventfd_assign = virtio_ccw_ioeventfd_assign; in virtio_ccw_bus_class_init()
1287 static const TypeInfo virtio_ccw_bus_info = {
1295 static void virtio_ccw_register(void) in virtio_ccw_register()