From patchwork Thu Jun 4 10:34:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 480609 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 0E6D21401F6 for ; Thu, 4 Jun 2015 20:45:15 +1000 (AEST) Received: from localhost ([::1]:41439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Se9-0003n0-6B for incoming@patchwork.ozlabs.org; Thu, 04 Jun 2015 06:45:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0SUJ-0001lt-6M for qemu-devel@nongnu.org; Thu, 04 Jun 2015 06:35:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0SUD-0006mI-GP for qemu-devel@nongnu.org; Thu, 04 Jun 2015 06:35:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0SUD-0006lt-9n for qemu-devel@nongnu.org; Thu, 04 Jun 2015 06:34:57 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D7857376B64; Thu, 4 Jun 2015 10:34:56 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-54.ams2.redhat.com [10.36.116.54]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t54AYt6P008395; Thu, 4 Jun 2015 06:34:56 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id F36468325C; Thu, 4 Jun 2015 12:34:51 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 4 Jun 2015 12:34:37 +0200 Message-Id: <1433414083-9720-29-git-send-email-kraxel@redhat.com> In-Reply-To: <1433414083-9720-1-git-send-email-kraxel@redhat.com> References: <1433414083-9720-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Cornelia Huck , Gerd Hoffmann , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 28/33] virtio-pci: move cap type to VirtIOPCIRegion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/virtio/virtio-pci.c | 9 +++++---- hw/virtio/virtio-pci.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 4481294..7cffe8a 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1245,18 +1245,21 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) proxy, "virtio-pci-common", 0x1000); proxy->common.offset = 0x0; + proxy->common.type = VIRTIO_PCI_CAP_COMMON_CFG; memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), &isr_ops, proxy, "virtio-pci-isr", 0x1000); proxy->isr.offset = 0x1000; + proxy->isr.type = VIRTIO_PCI_CAP_ISR_CFG; memory_region_init_io(&proxy->device.mr, OBJECT(proxy), &device_ops, virtio_bus_get_device(&proxy->bus), "virtio-pci-device", 0x1000); proxy->device.offset = 0x2000; + proxy->device.type = VIRTIO_PCI_CAP_DEVICE_CFG; memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), ¬ify_ops, @@ -1265,6 +1268,7 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * VIRTIO_QUEUE_MAX); proxy->notify.offset = 0x3000; + proxy->notify.type = VIRTIO_PCI_CAP_NOTIFY_CFG; } static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, @@ -1275,6 +1279,7 @@ static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy, region->offset, ®ion->mr); + cap->cfg_type = region->type; cap->offset = cpu_to_le32(region->offset); cap->length = cpu_to_le32(memory_region_size(®ion->mr)); virtio_pci_add_mem_cap(proxy, cap); @@ -1330,22 +1335,18 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) if (modern) { struct virtio_pci_cap common = { - .cfg_type = VIRTIO_PCI_CAP_COMMON_CFG, .cap_len = sizeof common, .bar = modern_mem_bar, }; struct virtio_pci_cap isr = { - .cfg_type = VIRTIO_PCI_CAP_ISR_CFG, .cap_len = sizeof isr, .bar = modern_mem_bar, }; struct virtio_pci_cap device = { - .cfg_type = VIRTIO_PCI_CAP_DEVICE_CFG, .cap_len = sizeof device, .bar = modern_mem_bar, }; struct virtio_pci_notify_cap notify = { - .cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG, .cap.cap_len = sizeof notify, .cap.bar = modern_mem_bar, .notify_off_multiplier = diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index f5829b0..ea1343d 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -94,6 +94,7 @@ typedef struct VirtioPCIClass { typedef struct VirtIOPCIRegion { MemoryRegion mr; uint32_t offset; + uint32_t type; } VirtIOPCIRegion; struct VirtIOPCIProxy {