[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 26/33] virtio-pci: add virtio_pci_modern_region_map(
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 26/33] virtio-pci: add virtio_pci_modern_region_map() |
Date: |
Thu, 4 Jun 2015 12:34:35 +0200 |
Add function to map modern virtio regions.
Add offset to VirtIOPCIRegion.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/virtio/virtio-pci.c | 25 +++++++++++++++++++------
hw/virtio/virtio-pci.h | 1 +
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index fad8b80..b99d9fd 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1244,20 +1244,35 @@ static void
virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy)
&common_ops,
proxy,
"virtio-pci-common", 0x1000);
+ proxy->common.offset = 0x0;
+
memory_region_init_io(&proxy->isr.mr, OBJECT(proxy),
&isr_ops,
proxy,
"virtio-pci-isr", 0x1000);
+ proxy->isr.offset = 0x1000;
+
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;
+
memory_region_init_io(&proxy->notify.mr, OBJECT(proxy),
¬ify_ops,
virtio_bus_get_device(&proxy->bus),
"virtio-pci-notify",
QEMU_VIRTIO_PCI_QUEUE_MEM_MULT *
VIRTIO_QUEUE_MAX);
+ proxy->notify.offset = 0x3000;
+}
+
+static void virtio_pci_modern_region_map(VirtIOPCIProxy *proxy,
+ VirtIOPCIRegion *region)
+{
+ memory_region_add_subregion(&proxy->modern_bar,
+ region->offset,
+ ®ion->mr);
}
/* This is called by virtio-bus just after the device is plugged. */
@@ -1352,12 +1367,10 @@ static void virtio_pci_device_plugged(DeviceState *d,
Error **errp)
2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT *
VIRTIO_QUEUE_MAX);
virtio_pci_modern_regions_init(proxy);
- memory_region_add_subregion(&proxy->modern_bar, 0, &proxy->common.mr);
- memory_region_add_subregion(&proxy->modern_bar, 0x1000,
&proxy->isr.mr);
- memory_region_add_subregion(&proxy->modern_bar, 0x2000,
- &proxy->device.mr);
- memory_region_add_subregion(&proxy->modern_bar, 0x3000,
- &proxy->notify.mr);
+ virtio_pci_modern_region_map(proxy, &proxy->common);
+ virtio_pci_modern_region_map(proxy, &proxy->isr);
+ virtio_pci_modern_region_map(proxy, &proxy->device);
+ virtio_pci_modern_region_map(proxy, &proxy->notify);
pci_register_bar(&proxy->pci_dev, modern_mem_bar,
PCI_BASE_ADDRESS_SPACE_MEMORY |
PCI_BASE_ADDRESS_MEM_PREFETCH |
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 8f1fc02..f5829b0 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -93,6 +93,7 @@ typedef struct VirtioPCIClass {
typedef struct VirtIOPCIRegion {
MemoryRegion mr;
+ uint32_t offset;
} VirtIOPCIRegion;
struct VirtIOPCIProxy {
--
1.8.3.1
- Re: [Qemu-devel] [PATCH 17/33] virtio-pci: add flags to enable/disable legacy/modern, (continued)
- [Qemu-devel] [PATCH 08/33] virtio-net: support longer header, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 15/33] virtio: add modern config accessors, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 14/33] virtio: generation counter support, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 21/33] virtio-pci: correctly set host notifiers for modern bar, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 16/33] virtio-pci: switch to modern accessors for 1.0, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 11/33] vhost: 64 bit features, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 22/33] virtio_balloon: header update, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 19/33] virtio-pci: change & document virtio pci bar layout., Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 29/33] virtio-pci: drop identical virtio_pci_cap, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 26/33] virtio-pci: add virtio_pci_modern_region_map(),
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 06/33] virtio: allow to fail setting status, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 23/33] virtio-balloon: switch to virtio_add_feature, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 20/33] virtio-pci: make modern bar 64bit + prefetchable, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 27/33] virtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 12/33] linux-headers: add virtio_pci, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 13/33] virtio-pci: initial virtio 1.0 support, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 18/33] virtio-pci: make QEMU_VIRTIO_PCI_QUEUE_MEM_MULT smaller, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 28/33] virtio-pci: move cap type to VirtIOPCIRegion, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 33/33] virtio-input: emulated devices [pci], Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 30/33] virtio-pci: fill VirtIOPCIRegions early., Gerd Hoffmann, 2015/06/04