[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/7] libqos: make the virtio-pci BAR index configurable
From: |
Stefan Hajnoczi |
Subject: |
[PATCH 6/7] libqos: make the virtio-pci BAR index configurable |
Date: |
Thu, 10 Oct 2019 16:58:52 +0100 |
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 <address@hidden>
---
tests/libqos/virtio-pci.h | 2 ++
tests/libqos/virtio-pci.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/libqos/virtio-pci.h b/tests/libqos/virtio-pci.h
index b620c30451..f2d53aa377 100644
--- a/tests/libqos/virtio-pci.h
+++ b/tests/libqos/virtio-pci.h
@@ -25,6 +25,8 @@ typedef struct QVirtioPCIDevice {
uint16_t config_msix_entry;
uint64_t config_msix_addr;
uint32_t config_msix_data;
+
+ uint8_t bar_idx;
} QVirtioPCIDevice;
struct QVirtioPCIMSIXOps {
diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c
index 9625a262bd..08451cb7f7 100644
--- a/tests/libqos/virtio-pci.c
+++ b/tests/libqos/virtio-pci.c
@@ -299,7 +299,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)
@@ -388,6 +388,7 @@ void qvirtio_pci_start_hw(QOSGraphObject *obj)
static void qvirtio_pci_init_legacy(QVirtioPCIDevice *dev)
{
dev->vdev.device_type = qpci_config_readw(dev->pdev, PCI_SUBSYSTEM_ID);
+ dev->bar_idx = 0;
dev->vdev.bus = &qvirtio_pci_legacy;
dev->msix_ops = &qvirtio_pci_msix_ops_legacy;
dev->vdev.big_endian = qtest_big_endian(dev->pdev->bus->qts);
--
2.21.0
- [PATCH 0/7] libqos: add VIRTIO PCI 1.0 support, Stefan Hajnoczi, 2019/10/10
- [PATCH 1/7] libqos: extract Legacy virtio-pci.c code, Stefan Hajnoczi, 2019/10/10
- [PATCH 2/7] libqos: add iteration support to qpci_find_capability(), Stefan Hajnoczi, 2019/10/10
- [PATCH 3/7] libqos: pass full QVirtQueue to set_queue_address(), Stefan Hajnoczi, 2019/10/10
- [PATCH 4/7] libqos: add MSI-X callbacks to QVirtioPCIDevice, Stefan Hajnoczi, 2019/10/10
- [PATCH 5/7] libqos: expose common virtqueue setup/cleanup functions, Stefan Hajnoczi, 2019/10/10
- [PATCH 6/7] libqos: make the virtio-pci BAR index configurable,
Stefan Hajnoczi <=
- [PATCH 7/7] libqos: add VIRTIO PCI 1.0 support, Stefan Hajnoczi, 2019/10/10
- Re: [PATCH 0/7] libqos: add VIRTIO PCI 1.0 support, no-reply, 2019/10/10