From patchwork Tue Mar 2 18:43:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 46693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B5AC1B7C33 for ; Wed, 3 Mar 2010 06:01:53 +1100 (EST) Received: from localhost ([127.0.0.1]:54242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmXJC-0003Rk-3Y for incoming@patchwork.ozlabs.org; Tue, 02 Mar 2010 13:59:06 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmX7Z-0005vL-1p for qemu-devel@nongnu.org; Tue, 02 Mar 2010 13:47:05 -0500 Received: from [199.232.76.173] (port=39596 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmX7Y-0005uu-0z for qemu-devel@nongnu.org; Tue, 02 Mar 2010 13:47:04 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NmX7W-0003pS-FX for qemu-devel@nongnu.org; Tue, 02 Mar 2010 13:47:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64537) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NmX7W-0003pM-2n for qemu-devel@nongnu.org; Tue, 02 Mar 2010 13:47:02 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o22Il0af029208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Mar 2010 13:47:00 -0500 Received: from redhat.com (dhcp-0-94.tlv.redhat.com [10.35.0.94]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o22IkuaX015125; Tue, 2 Mar 2010 13:46:57 -0500 Date: Tue, 2 Mar 2010 20:43:39 +0200 From: "Michael S. Tsirkin" To: Anthony Liguori , qemu-devel@nongnu.org Message-ID: <93d1f67f3e92dc3925ef74911d146051b043e9fb.1267555267.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: amit.shah@redhat.com, kraxel@redhat.com, quintela@redhat.com Subject: [Qemu-devel] [PATCHv3 04/12] virtio: add notifier support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add binding API to set host/guest notifiers. Will be used by vhost. Signed-off-by: Michael S. Tsirkin --- hw/virtio.c | 5 ++++- hw/virtio.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 7c020a3..1f5e7be 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -73,6 +73,7 @@ struct VirtQueue int inuse; uint16_t vector; void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); + VirtIODevice *vdev; }; /* virt queue functions */ @@ -714,8 +715,10 @@ VirtIODevice *virtio_common_init(const char *name, uint16_t device_id, vdev->queue_sel = 0; vdev->config_vector = VIRTIO_NO_VECTOR; vdev->vq = qemu_mallocz(sizeof(VirtQueue) * VIRTIO_PCI_QUEUE_MAX); - for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) + for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) { vdev->vq[i].vector = VIRTIO_NO_VECTOR; + vdev->vq[i].vdev = vdev; + } vdev->name = name; vdev->config_len = config_size; diff --git a/hw/virtio.h b/hw/virtio.h index 3baa2a3..af87889 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -19,6 +19,7 @@ #include "qdev.h" #include "sysemu.h" #include "block_int.h" +#include "notifier.h" /* from Linux's linux/virtio_config.h */ @@ -89,6 +90,8 @@ typedef struct { int (*load_config)(void * opaque, QEMUFile *f); int (*load_queue)(void * opaque, int n, QEMUFile *f); unsigned (*get_features)(void * opaque); + int (*guest_notifier)(void * opaque, int n, bool assigned); + int (*host_notifier)(void * opaque, int n, bool assigned); } VirtIOBindings; #define VIRTIO_PCI_QUEUE_MAX 64