From patchwork Mon Sep 7 18:20:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 33110 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 bilbo.ozlabs.org (Postfix) with ESMTPS id EC856B7099 for ; Tue, 8 Sep 2009 04:22:59 +1000 (EST) Received: from localhost ([127.0.0.1]:49245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mkire-0002Fh-O9 for incoming@patchwork.ozlabs.org; Mon, 07 Sep 2009 14:22:54 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mkiqq-0001x5-Dq for qemu-devel@nongnu.org; Mon, 07 Sep 2009 14:22:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mkiql-0001ob-Px for qemu-devel@nongnu.org; Mon, 07 Sep 2009 14:22:03 -0400 Received: from [199.232.76.173] (port=52385 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mkiql-0001oI-7s for qemu-devel@nongnu.org; Mon, 07 Sep 2009 14:21:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1027) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mkiqk-0002Mg-Pm for qemu-devel@nongnu.org; Mon, 07 Sep 2009 14:21:59 -0400 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 n87ILtEM002719; Mon, 7 Sep 2009 14:21:55 -0400 Received: from redhat.com (vpn-6-95.tlv.redhat.com [10.35.6.95]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n87ILm9L031448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 7 Sep 2009 14:21:52 -0400 Date: Mon, 7 Sep 2009 21:20:15 +0300 From: "Michael S. Tsirkin" To: anthony@codemonkey.ws, qemu-devel@nongnu.org, john.cooper@redhat.com Message-ID: <20090907182015.GA8565@redhat.com> MIME-Version: 1.0 Content-Disposition: inline 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 Subject: [Qemu-devel] [PATCH] qemu: init all queues to NO_VECTOR value 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 initialize vectors for all vqs to VIRTIO_NO_VECTOR rather than 0 which is a valid vector. This fixes migration which happened before driver was loaded. Signed-off-by: Michael S. Tsirkin Reported-by: Amit Shah Tested-by: Amit Shah --- hw/virtio.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index 41e7ca2..337ff27 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -694,6 +694,7 @@ VirtIODevice *virtio_common_init(const char *name, uint16_t device_id, size_t config_size, size_t struct_size) { VirtIODevice *vdev; + int i; vdev = qemu_mallocz(struct_size); @@ -703,6 +704,8 @@ 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++) + vdev->vq[i].vector = VIRTIO_NO_VECTOR; vdev->name = name; vdev->config_len = config_size;