virtio-pci: Replace modern_as with direct access to modern_bar
commita93c8d828af186d9a6a1c915a1be8ba22fb89849
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 9 Oct 2017 03:19:41 +0000 (9 14:19 +1100)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 15 Oct 2017 02:54:44 +0000 (15 05:54 +0300)
treed0a820de897ff22c0efcbafb77b0ddee460b5627
parent37ef70be6af7e9f2a6f852c68f74bd98dac2664b
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>
hw/virtio/virtio-pci.c
hw/virtio/virtio-pci.h