[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/25] libqos: pass full QVirtQueue to set_queue_address()
From: |
Michael S. Tsirkin |
Subject: |
[PULL 19/25] libqos: pass full QVirtQueue to set_queue_address() |
Date: |
Sat, 26 Oct 2019 17:52:48 -0400 |
From: Stefan Hajnoczi <address@hidden>
Instead of just passing the vring page frame number, pass the full
QVirtQueue. This will allow the VIRTIO 1.0 transport to program the
fine-grained vring address registers in the future.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
tests/libqos/virtio-mmio.c | 6 ++++--
tests/libqos/virtio-pci.c | 6 ++++--
tests/libqos/virtio.h | 2 +-
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/tests/libqos/virtio-mmio.c b/tests/libqos/virtio-mmio.c
index 4db1f1b8bc..e0a2bd7bc6 100644
--- a/tests/libqos/virtio-mmio.c
+++ b/tests/libqos/virtio-mmio.c
@@ -143,9 +143,11 @@ static uint16_t qvirtio_mmio_get_queue_size(QVirtioDevice
*d)
return (uint16_t)qtest_readl(dev->qts, dev->addr +
QVIRTIO_MMIO_QUEUE_NUM_MAX);
}
-static void qvirtio_mmio_set_queue_address(QVirtioDevice *d, uint32_t pfn)
+static void qvirtio_mmio_set_queue_address(QVirtioDevice *d, QVirtQueue *vq)
{
QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
+ uint64_t pfn = vq->desc / dev->page_size;
+
qtest_writel(dev->qts, dev->addr + QVIRTIO_MMIO_QUEUE_PFN, pfn);
}
@@ -179,7 +181,7 @@ static QVirtQueue
*qvirtio_mmio_virtqueue_setup(QVirtioDevice *d,
addr = guest_alloc(alloc, qvring_size(vq->size, dev->page_size));
qvring_init(dev->qts, alloc, vq, addr);
- qvirtio_mmio_set_queue_address(d, vq->desc / dev->page_size);
+ qvirtio_mmio_set_queue_address(d, vq);
return vq;
}
diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c
index 7ecf5d0a52..e4fa318dcc 100644
--- a/tests/libqos/virtio-pci.c
+++ b/tests/libqos/virtio-pci.c
@@ -199,9 +199,11 @@ static uint16_t qvirtio_pci_get_queue_size(QVirtioDevice
*d)
return qpci_io_readw(dev->pdev, dev->bar, VIRTIO_PCI_QUEUE_NUM);
}
-static void qvirtio_pci_set_queue_address(QVirtioDevice *d, uint32_t pfn)
+static void qvirtio_pci_set_queue_address(QVirtioDevice *d, QVirtQueue *vq)
{
QVirtioPCIDevice *dev = container_of(d, QVirtioPCIDevice, vdev);
+ uint64_t pfn = vq->desc / VIRTIO_PCI_VRING_ALIGN;
+
qpci_io_writel(dev->pdev, dev->bar, VIRTIO_PCI_QUEUE_PFN, pfn);
}
@@ -239,7 +241,7 @@ static QVirtQueue
*qvirtio_pci_virtqueue_setup(QVirtioDevice *d,
addr = guest_alloc(alloc, qvring_size(vqpci->vq.size,
VIRTIO_PCI_VRING_ALIGN));
qvring_init(qvpcidev->pdev->bus->qts, alloc, &vqpci->vq, addr);
- qvirtio_pci_set_queue_address(d, vqpci->vq.desc / VIRTIO_PCI_VRING_ALIGN);
+ qvirtio_pci_set_queue_address(d, &vqpci->vq);
return &vqpci->vq;
}
diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h
index ebbff5193b..529ef7555a 100644
--- a/tests/libqos/virtio.h
+++ b/tests/libqos/virtio.h
@@ -81,7 +81,7 @@ struct QVirtioBus {
uint16_t (*get_queue_size)(QVirtioDevice *d);
/* Set the address of the selected queue */
- void (*set_queue_address)(QVirtioDevice *d, uint32_t pfn);
+ void (*set_queue_address)(QVirtioDevice *d, QVirtQueue *vq);
/* Setup the virtqueue specified by index */
QVirtQueue *(*virtqueue_setup)(QVirtioDevice *d, QGuestAllocator *alloc,
--
MST
- [PULL 05/25] virtio: basic packed virtqueue support, (continued)
- [PULL 05/25] virtio: basic packed virtqueue support, Michael S. Tsirkin, 2019/10/26
- [PULL 06/25] virtio: event suppression support for packed ring, Michael S. Tsirkin, 2019/10/26
- [PULL 07/25] vhost_net: enable packed ring support, Michael S. Tsirkin, 2019/10/26
- [PULL 08/25] virtio: add property to enable packed virtqueue, Michael S. Tsirkin, 2019/10/26
- [PULL 09/25] tests/virtio-blk-test: read config space after feature negotiation, Michael S. Tsirkin, 2019/10/26
- [PULL 10/25] libqos: read QVIRTIO_MMIO_VERSION register, Michael S. Tsirkin, 2019/10/26
- [PULL 11/25] libqos: extend feature bits to 64-bit, Michael S. Tsirkin, 2019/10/26
- [PULL 16/25] libqos: implement VIRTIO 1.0 FEATURES_OK step, Michael S. Tsirkin, 2019/10/26
- [PULL 17/25] libqos: access VIRTIO 1.0 vring in little-endian, Michael S. Tsirkin, 2019/10/26
- [PULL 18/25] libqos: add iteration support to qpci_find_capability(), Michael S. Tsirkin, 2019/10/26
- [PULL 19/25] libqos: pass full QVirtQueue to set_queue_address(),
Michael S. Tsirkin <=
- [PULL 20/25] libqos: add MSI-X callbacks to QVirtioPCIDevice, Michael S. Tsirkin, 2019/10/26
- [PULL 21/25] libqos: expose common virtqueue setup/cleanup functions, Michael S. Tsirkin, 2019/10/26
- [PULL 22/25] libqos: make the virtio-pci BAR index configurable, Michael S. Tsirkin, 2019/10/26
- [PULL 23/25] libqos: extract Legacy virtio-pci.c code, Michael S. Tsirkin, 2019/10/26
- [PULL 24/25] libqos: add VIRTIO PCI 1.0 support, Michael S. Tsirkin, 2019/10/26
- [PULL 25/25] virtio: drop unused virtio_device_stop_ioeventfd() function, Michael S. Tsirkin, 2019/10/26
- Re: [PULL 00/25] virtio: features, tests, Peter Maydell, 2019/10/28