[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 09/16] libqos: access VIRTIO 1.0 vring in little-endian
From: |
Thomas Huth |
Subject: |
Re: [PATCH v3 09/16] libqos: access VIRTIO 1.0 vring in little-endian |
Date: |
Mon, 21 Oct 2019 14:48:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 19/10/2019 08.38, Stefan Hajnoczi wrote:
> VIRTIO 1.0 uses little-endian for the vring. Legacy VIRTIO uses guest
> endianness. Adjust the code to handle both.
>
> Note that qvirtio_readq() is not defined because it has no users. All
> the other accessors are really needed.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> tests/libqos/virtio.h | 4 +-
> tests/libqos/virtio-mmio.c | 1 +
> tests/libqos/virtio-pci.c | 1 +
> tests/libqos/virtio.c | 131 +++++++++++++++++++++++++++----------
> tests/virtio-blk-test.c | 8 +--
> 5 files changed, 106 insertions(+), 39 deletions(-)
[...]
> @@ -191,23 +248,23 @@ void qvring_init(QTestState *qts, const QGuestAllocator
> *alloc, QVirtQueue *vq,
>
> for (i = 0; i < vq->size - 1; i++) {
> /* vq->desc[i].addr */
> - qtest_writeq(qts, vq->desc + (16 * i), 0);
> + qvirtio_writeq(vq->vdev, qts, vq->desc + (16 * i), 0);
> /* vq->desc[i].next */
> - qtest_writew(qts, vq->desc + (16 * i) + 14, i + 1);
> + qvirtio_writew(vq->vdev, qts, vq->desc + (16 * i) + 14, i + 1);
> }
>
> /* vq->avail->flags */
> - qtest_writew(qts, vq->avail, 0);
> + qvirtio_writew(vq->vdev, qts, vq->avail, 0);
> /* vq->avail->idx */
> - qtest_writew(qts, vq->avail + 2, 0);
> + qvirtio_writew(vq->vdev, qts, vq->avail + 2, 0);
> /* vq->avail->used_event */
> - qtest_writew(qts, vq->avail + 4 + (2 * vq->size), 0);
> + qvirtio_writew(vq->vdev, qts, vq->avail + 4 + (2 * vq->size), 0);
>
> /* vq->used->flags */
> - qtest_writew(qts, vq->used, 0);
> + qvirtio_writew(vq->vdev, qts, vq->used, 0);
> /* vq->used->avail_event */
> - qtest_writew(qts, vq->used + 2 + sizeof(struct vring_used_elem) *
> vq->size,
> - 0);
> + qvirtio_writew(vq->vdev, qts, vq->used + 2 +
> + sizeof(struct vring_used_elem) * vq->size, 0);
Fix indentation in the above line?
Apart from that, patch looks fine to me.
Reviewed-by: Thomas Huth <address@hidden>
- Re: [PATCH v3 06/16] libqos: add missing virtio-9p feature negotiation, (continued)
[PATCH v3 08/16] libqos: implement VIRTIO 1.0 FEATURES_OK step, Stefan Hajnoczi, 2019/10/19
[PATCH v3 09/16] libqos: access VIRTIO 1.0 vring in little-endian, Stefan Hajnoczi, 2019/10/19
[PATCH v3 10/16] libqos: add iteration support to qpci_find_capability(), Stefan Hajnoczi, 2019/10/19
[PATCH v3 11/16] libqos: pass full QVirtQueue to set_queue_address(), Stefan Hajnoczi, 2019/10/19
[PATCH v3 12/16] libqos: add MSI-X callbacks to QVirtioPCIDevice, Stefan Hajnoczi, 2019/10/19
[PATCH v3 13/16] libqos: expose common virtqueue setup/cleanup functions, Stefan Hajnoczi, 2019/10/19
[PATCH v3 14/16] libqos: make the virtio-pci BAR index configurable, Stefan Hajnoczi, 2019/10/19