From patchwork Tue Jul 1 08:48:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 365968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5ABC1140103 for ; Tue, 1 Jul 2014 18:53:30 +1000 (EST) Received: from localhost ([::1]:39601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1tod-0004uB-SL for incoming@patchwork.ozlabs.org; Tue, 01 Jul 2014 04:53:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1tkg-0007Ul-65 for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:49:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1tkY-00069I-LT for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:49:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1tkY-000696-DA for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:49:14 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s618n8PD028539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 1 Jul 2014 04:49:08 -0400 Received: from localhost (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s618n7e8022207; Tue, 1 Jul 2014 04:49:08 -0400 From: Stefan Hajnoczi To: Date: Tue, 1 Jul 2014 10:48:36 +0200 Message-Id: <1404204537-5082-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1404204537-5082-1-git-send-email-stefanha@redhat.com> References: <1404204537-5082-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Cornelia Huck , Peter Maydell , Stefan Hajnoczi Subject: [Qemu-devel] [PULL for-2.1 03/24] dataplane: bail out on unsupported transport X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 09bd2c7..f6e1a5d 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. */