From patchwork Fri May 20 23:40:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 624699 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 3rBQ0g3XJFz9sBR for ; Sat, 21 May 2016 10:00:03 +1000 (AEST) Received: from localhost ([::1]:38214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3uKn-0004NE-G3 for incoming@patchwork.ozlabs.org; Fri, 20 May 2016 20:00:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3u2V-0001mB-UR for qemu-devel@nongnu.org; Fri, 20 May 2016 19:41:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3u2O-0006YI-RF for qemu-devel@nongnu.org; Fri, 20 May 2016 19:41:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3u2O-0006Y8-J2 for qemu-devel@nongnu.org; Fri, 20 May 2016 19:41:00 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C63278222; Fri, 20 May 2016 23:41:00 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4KNeraM019407; Fri, 20 May 2016 19:40:57 -0400 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Fri, 20 May 2016 16:40:25 -0700 Message-Id: <1463787632-7241-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1463787632-7241-1-git-send-email-stefanha@redhat.com> References: <1463787632-7241-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 20 May 2016 23:41:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/9] virtio-blk: tell dataplane which vq to notify X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Paolo Bonzini , Ming Lei , Fam Zheng , Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Let the virtio_blk_data_plane_notify() caller decide which virtqueue to notify. This will allow the function to be used with multiqueue. Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 8 +++----- hw/block/dataplane/virtio-blk.h | 2 +- hw/block/virtio-blk.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index e0ac4f4..592aa95 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -34,7 +34,6 @@ struct VirtIOBlockDataPlane { VirtIODevice *vdev; VirtQueue *vq; /* virtqueue vring */ - EventNotifier *guest_notifier; /* irq */ Notifier insert_notifier, remove_notifier; @@ -51,13 +50,13 @@ struct VirtIOBlockDataPlane { }; /* Raise an interrupt to signal guest, if necessary */ -void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s) +void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s, VirtQueue *vq) { - if (!virtio_should_notify(s->vdev, s->vq)) { + if (!virtio_should_notify(s->vdev, vq)) { return; } - event_notifier_set(s->guest_notifier); + event_notifier_set(virtio_queue_get_guest_notifier(vq)); } static void data_plane_set_up_op_blockers(VirtIOBlockDataPlane *s) @@ -207,7 +206,6 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) "ensure -enable-kvm is set\n", r); goto fail_guest_notifiers; } - s->guest_notifier = virtio_queue_get_guest_notifier(s->vq); /* Set up virtqueue notify */ r = k->set_host_notifier(qbus->parent, 0, true); diff --git a/hw/block/dataplane/virtio-blk.h b/hw/block/dataplane/virtio-blk.h index 0714c11..b1f0b95 100644 --- a/hw/block/dataplane/virtio-blk.h +++ b/hw/block/dataplane/virtio-blk.h @@ -26,6 +26,6 @@ void virtio_blk_data_plane_destroy(VirtIOBlockDataPlane *s); void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s); void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s); void virtio_blk_data_plane_drain(VirtIOBlockDataPlane *s); -void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s); +void virtio_blk_data_plane_notify(VirtIOBlockDataPlane *s, VirtQueue *vq); #endif /* HW_DATAPLANE_VIRTIO_BLK_H */ diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 0eaf6bf..b78352b 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -54,7 +54,7 @@ static void virtio_blk_batch_notify_bh(void *opaque) VirtIODevice *vdev = VIRTIO_DEVICE(s); if (s->dataplane_started && !s->dataplane_disabled) { - virtio_blk_data_plane_notify(s->dataplane); + virtio_blk_data_plane_notify(s->dataplane, s->vq); } else { virtio_notify(vdev, s->vq); }