From patchwork Wed Dec 2 12:04:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 40011 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 B8FA0B7BE0 for ; Thu, 3 Dec 2009 00:10:23 +1100 (EST) Received: from localhost ([127.0.0.1]:53854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFoyJ-0001yx-KY for incoming@patchwork.ozlabs.org; Wed, 02 Dec 2009 08:10:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFnxi-0004MH-75 for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFnxc-0004Ju-RB for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:36 -0500 Received: from [199.232.76.173] (port=42910 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFnxc-0004Jr-Ea for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39782) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NFnxb-0004BZ-Vn for qemu-devel@nongnu.org; Wed, 02 Dec 2009 07:05:32 -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 nB2C5V0h020897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Dec 2009 07:05:31 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB2C5IL5029769; Wed, 2 Dec 2009 07:05:30 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 2 Dec 2009 13:04:05 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: 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: mst@redhat.com Subject: [Qemu-devel] [PATCH 07/41] virtio-pci: Remove duplicate test 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 We already do the test for msix on the caller, just use that test Signed-off-by: Juan Quintela --- hw/msix.c | 8 -------- hw/virtio-pci.c | 7 ++++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/hw/msix.c b/hw/msix.c index 4bc6147..8dca9fd 100644 --- a/hw/msix.c +++ b/hw/msix.c @@ -295,10 +295,6 @@ void msix_save(PCIDevice *dev, QEMUFile *f) { unsigned n = dev->msix_entries_nr; - if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) { - return; - } - qemu_put_buffer(f, dev->msix_table_page, n * MSIX_ENTRY_SIZE); qemu_put_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8); } @@ -308,10 +304,6 @@ void msix_load(PCIDevice *dev, QEMUFile *f) { unsigned n = dev->msix_entries_nr; - if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) { - return; - } - msix_free_irq_entries(dev); qemu_get_buffer(f, dev->msix_table_page, n * MSIX_ENTRY_SIZE); qemu_get_buffer(f, dev->msix_table_page + MSIX_PAGE_PENDING, (n + 7) / 8); diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index d222ce0..25b6380 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -109,9 +109,10 @@ static void virtio_pci_save_config(void * opaque, QEMUFile *f) { VirtIOPCIProxy *proxy = opaque; pci_device_save(&proxy->pci_dev, f); - msix_save(&proxy->pci_dev, f); - if (msix_present(&proxy->pci_dev)) + if (msix_present(&proxy->pci_dev)) { + msix_save(&proxy->pci_dev, f); qemu_put_be16(f, proxy->vdev->config_vector); + } } static void virtio_pci_save_queue(void * opaque, int n, QEMUFile *f) @@ -129,8 +130,8 @@ 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)) { + msix_load(&proxy->pci_dev, f); qemu_get_be16s(f, &proxy->vdev->config_vector); } else { proxy->vdev->config_vector = VIRTIO_NO_VECTOR;