summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2014-06-18 17:58:30 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2014-07-01 09:15:02 +0200
commita9968c77d5a56211ae22be2e6a1dcb07f2016010 (patch)
treede7003b4ba08fe747b36a015c24a59744a7280aa
parentdc80ca6cd6cafdee174af3c883d85e19b7fd70a5 (diff)
downloadfocaccia-qemu-a9968c77d5a56211ae22be2e6a1dcb07f2016010.tar.gz
focaccia-qemu-a9968c77d5a56211ae22be2e6a1dcb07f2016010.zip
dataplane: bail out on unsupported transport
If the virtio transport does not support notifiers (like s390-virtio),
we can't use dataplane. Bail out early and let the user know what is
wrong.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--hw/block/dataplane/virtio-blk.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 09bd2c70ab..f6e1a5d919 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -127,6 +127,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
     VirtIOBlockDataPlane *s;
     VirtIOBlock *vblk = VIRTIO_BLK(vdev);
     Error *local_err = NULL;
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
 
     *dataplane = NULL;
 
@@ -134,6 +136,14 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
         return;
     }
 
+    /* Don't try if transport does not support notifiers. */
+    if (!k->set_guest_notifiers || !k->set_host_notifier) {
+        error_setg(errp,
+                   "device is incompatible with x-data-plane "
+                   "(transport does not support notifiers)");
+        return;
+    }
+
     /* If dataplane is (re-)enabled while the guest is running there could be
      * block jobs that can conflict.
      */