summaryrefslogtreecommitdiffstats
path: root/hw/virtio/virtio-pci.h
diff options
context:
space:
mode:
authorAlexey Kardashevskiy2017-10-09 05:19:41 +0200
committerMichael S. Tsirkin2017-10-15 04:54:44 +0200
commita93c8d828af186d9a6a1c915a1be8ba22fb89849 (patch)
treed0a820de897ff22c0efcbafb77b0ddee460b5627 /hw/virtio/virtio-pci.h
parentvirtio: fix descriptor counting in virtqueue_pop (diff)
downloadqemu-a93c8d828af186d9a6a1c915a1be8ba22fb89849.tar.gz
qemu-a93c8d828af186d9a6a1c915a1be8ba22fb89849.tar.xz
qemu-a93c8d828af186d9a6a1c915a1be8ba22fb89849.zip
virtio-pci: Replace modern_as with direct access to modern_bar
The modern bar is accessed now via yet another address space created just for that purpose and it does not really need FlatView and dispatch tree as it has a single memory region so it is just a waste of memory. Things get even worse when there are dozens or hundreds of virtio-pci devices - since these address spaces are global, changing any of them triggers rebuilding all address spaces. This replaces indirect accesses to the modern BAR with a simple lookup and direct calls to memory_region_dispatch_read/write. This is expected to save lots of memory at boot time after applying: [Qemu-devel] [PULL 00/32] Misc changes for 2017-09-22 Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/virtio-pci.h')
-rw-r--r--hw/virtio/virtio-pci.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 69f5959623..12d3a90686 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -155,15 +155,18 @@ typedef struct VirtIOPCIQueue {
struct VirtIOPCIProxy {
PCIDevice pci_dev;
MemoryRegion bar;
- VirtIOPCIRegion common;
- VirtIOPCIRegion isr;
- VirtIOPCIRegion device;
- VirtIOPCIRegion notify;
- VirtIOPCIRegion notify_pio;
+ union {
+ struct {
+ VirtIOPCIRegion common;
+ VirtIOPCIRegion isr;
+ VirtIOPCIRegion device;
+ VirtIOPCIRegion notify;
+ VirtIOPCIRegion notify_pio;
+ };
+ VirtIOPCIRegion regs[5];
+ };
MemoryRegion modern_bar;
MemoryRegion io_bar;
- MemoryRegion modern_cfg;
- AddressSpace modern_as;
uint32_t legacy_io_bar_idx;
uint32_t msix_bar_idx;
uint32_t modern_io_bar_idx;