qemu-devel
[Top][All Lists]
Advanced

[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>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]