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: Stefan Hajnoczi
Subject: Re: [PATCH v3 09/16] libqos: access VIRTIO 1.0 vring in little-endian
Date: Tue, 22 Oct 2019 16:54:00 +0100
User-agent: Mutt/1.12.1 (2019-06-15)

On Mon, Oct 21, 2019 at 02:48:08PM +0200, Thomas Huth wrote:
> 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?

Will fix in v4.

Attachment: signature.asc
Description: PGP signature


reply via email to

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