[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.
signature.asc
Description: PGP signature
- [PATCH v3 07/16] libqos: enforce Device Initialization order, (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