virtio-pci: fill VirtIOPCIRegions early.

Initialize the modern bar and the VirtIOPCIRegion fields early, in
realize.  Also add a size field to VirtIOPCIRegion and variables for
pci bars to VirtIOPCIProxy.

This allows virtio-pci subclasses to change things before the
device_plugged callback applies them.  virtio-vga will use that to
arrange regions in a way that virtio-vga is compatible to both stdvga
(in vga mode) and virtio-gpu-pci (in pci mode).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Gerd Hoffmann 2015-06-04 12:34:39 +02:00 committed by Michael S. Tsirkin
parent cc52ea90f8
commit b6ce27a593
2 changed files with 55 additions and 41 deletions

View file

@ -94,6 +94,7 @@ typedef struct VirtioPCIClass {
typedef struct VirtIOPCIRegion {
MemoryRegion mr;
uint32_t offset;
uint32_t size;
uint32_t type;
} VirtIOPCIRegion;
@ -105,6 +106,9 @@ struct VirtIOPCIProxy {
VirtIOPCIRegion device;
VirtIOPCIRegion notify;
MemoryRegion modern_bar;
uint32_t legacy_io_bar;
uint32_t msix_bar;
uint32_t modern_mem_bar;
uint32_t flags;
uint32_t class_code;
uint32_t nvectors;