And make virtio use it. Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- hw/pci.c | 8 ++++++++ hw/pci.h | 2 ++ hw/virtio-pci.c | 5 +---- 3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c index 5460f27..50ae917 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -28,6 +28,7 @@ #include "sysemu.h" #include "loader.h" #include "qemu-objects.h" +#include "msix.h" //#define DEBUG_PCI #ifdef DEBUG_PCI @@ -823,6 +824,13 @@ void pci_register_io_region(PCIDevice *d, int region_num, } } +void pci_register_msix_region(PCIDevice *d, int region_num) +{ + pci_register_bar(d, region_num, msix_bar_size(d), + PCI_BASE_ADDRESS_SPACE_MEMORY, + msix_mmio_map); +} + static uint32_t pci_config_get_io_base(PCIDevice *d, uint32_t base, uint32_t base_upper16) { diff --git a/hw/pci.h b/hw/pci.h index 3edf28f..9645fce 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -202,6 +202,8 @@ void pci_register_io_region(PCIDevice *d, int region_num, pcibus_t size, int type, PCIIOReadFunc *readcb, PCIIOWriteFunc *writecb); +void pci_register_msix_region(PCIDevice *d, int region_num); + void pci_memory_read(PCIDevice *pci_dev, pcibus_t addr, void *buf, int len); void pci_memory_write(PCIDevice *pci_dev, pcibus_t addr, const void *buf, int len); diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index a2ba294..81c4d37 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -372,10 +372,7 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev, config[0x3d] = 1; if (vdev->nvectors && !msix_init(&proxy->pci_dev, vdev->nvectors, 1, 0)) { - pci_register_bar(&proxy->pci_dev, 1, - msix_bar_size(&proxy->pci_dev), - PCI_BASE_ADDRESS_SPACE_MEMORY, - msix_mmio_map); + pci_register_msix_region(&proxy->pci_dev, 1); } else vdev->nvectors = 0; -- 1.6.5.2