]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
libqos: make the virtio-pci BAR index configurable
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 23 Oct 2019 10:04:23 +0000 (11:04 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 25 Oct 2019 11:46:22 +0000 (07:46 -0400)
The Legacy virtio-pci interface always uses BAR 0.  VIRTIO 1.0 may need
to use a different BAR index, so make it configurable.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191023100425.12168-15-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
tests/libqos/virtio-pci.c
tests/libqos/virtio-pci.h

index c900742f96ba6c3073f95a78fb366e6b34a5ac49..e9595603f542e70a65854e7369dae2d4f17ae421 100644 (file)
@@ -310,7 +310,7 @@ static const QVirtioPCIMSIXOps qvirtio_pci_msix_ops_legacy = {
 void qvirtio_pci_device_enable(QVirtioPCIDevice *d)
 {
     qpci_device_enable(d->pdev);
-    d->bar = qpci_iomap(d->pdev, 0, NULL);
+    d->bar = qpci_iomap(d->pdev, d->bar_idx, NULL);
 }
 
 void qvirtio_pci_device_disable(QVirtioPCIDevice *d)
@@ -400,6 +400,7 @@ static void qvirtio_pci_init_from_pcidev(QVirtioPCIDevice *dev, QPCIDevice *pci_
 {
     dev->pdev = pci_dev;
     dev->vdev.device_type = qpci_config_readw(pci_dev, PCI_SUBSYSTEM_ID);
+    dev->bar_idx = 0;
 
     dev->config_msix_entry = -1;
     dev->msix_ops = &qvirtio_pci_msix_ops_legacy;
index 0e4a8b7b00f0cd92685258bc8806d4fe8694ac6d..78a1c15c2aeba670e00b3b11a2e08999d9f8fdfc 100644 (file)
@@ -25,6 +25,8 @@ typedef struct QVirtioPCIDevice {
     uint16_t config_msix_entry;
     uint64_t config_msix_addr;
     uint32_t config_msix_data;
+
+    int bar_idx;
 } QVirtioPCIDevice;
 
 struct QVirtioPCIMSIXOps {