From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxCeV-0004Im-Jk for qemu-devel@nongnu.org; Wed, 18 Jun 2014 05:59:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxCeP-0003P6-8r for qemu-devel@nongnu.org; Wed, 18 Jun 2014 05:59:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18987) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxCeP-0003P0-0x for qemu-devel@nongnu.org; Wed, 18 Jun 2014 05:59:29 -0400 From: Stefan Hajnoczi Date: Wed, 18 Jun 2014 17:58:30 +0800 Message-Id: <1403085516-10340-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1403085516-10340-1-git-send-email-stefanha@redhat.com> References: <1403085516-10340-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v4 3/9] dataplane: bail out on unsupported transport List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, Paolo Bonzini , peter.crosthwaite@xilinx.com, Andreas Faerber , Stefan Hajnoczi From: Cornelia Huck 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 Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index c10b7b7..92ebb44 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -331,6 +331,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, { VirtIOBlockDataPlane *s; Error *local_err = NULL; + BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); *dataplane = NULL; @@ -338,6 +340,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. */ -- 1.9.3