From patchwork Thu Jul 2 17:51:51 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: 33741 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n62HqS3M009427 for ; Thu, 2 Jul 2009 17:52:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752265AbZGBRwX (ORCPT ); Thu, 2 Jul 2009 13:52:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751678AbZGBRwX (ORCPT ); Thu, 2 Jul 2009 13:52:23 -0400 Received: from mx2.redhat.com ([66.187.237.31]:43327 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751171AbZGBRwW (ORCPT ); Thu, 2 Jul 2009 13:52:22 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n62HqNrp001346; Thu, 2 Jul 2009 13:52:23 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n62HqM35019416; Thu, 2 Jul 2009 13:52:23 -0400 Received: from redhat.com (vpn-6-112.tlv.redhat.com [10.35.6.112]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n62HqKnk024971; Thu, 2 Jul 2009 13:52:20 -0400 Date: Thu, 2 Jul 2009 20:51:51 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org, avi@redhat.com, kvm@vger.kernel.org, aliguori@us.ibm.com, kwolf@redhat.com Subject: [PATCH] qemu/virtio: enable msi vectors on load Message-ID: <20090702175150.GA27511@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On load, enable msi vectors used by the virtio device. Signed-off-by: Michael S. Tsirkin --- hw/virtio-pci.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index f7da503..4bbdca4 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -129,8 +129,11 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f) if (ret) return ret; msix_load(&proxy->pci_dev, f); - if (msix_present(&proxy->pci_dev)) + if (msix_present(&proxy->pci_dev)) { + msix_vector_unuse(&proxy->pci_dev, proxy->vdev->config_vector); qemu_get_be16s(f, &proxy->vdev->config_vector); + return msix_vector_use(&proxy->pci_dev, proxy->vdev->config_vector); + } return 0; } @@ -140,9 +143,10 @@ static int virtio_pci_load_queue(void * opaque, int n, QEMUFile *f) uint16_t vector; if (!msix_present(&proxy->pci_dev)) return 0; + msix_vector_unuse(&proxy->pci_dev, virtio_queue_vector(proxy->vdev, n)); qemu_get_be16s(f, &vector); virtio_queue_set_vector(proxy->vdev, n, vector); - return 0; + return msix_vector_use(&proxy->pci_dev, vector); } static void virtio_pci_reset(void *opaque)