[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] dataplane: fix cross-endian issues
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH 2/2] dataplane: fix cross-endian issues |
Date: |
Fri, 26 Jun 2015 09:32:28 +0200 |
User-agent: |
StGit/0.17.1-dirty |
Accesses to vring_avail_event and vring_used_event must honor the queue
endianness.
This patch allows cross-endian setups to use dataplane (tested with ppc64
on ppc64le, and vice-versa).
Suggested-by: Cornelia Huck <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
---
hw/virtio/dataplane/vring.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c
index 3fa421b9d773..67d411919d22 100644
--- a/hw/virtio/dataplane/vring.c
+++ b/hw/virtio/dataplane/vring.c
@@ -153,7 +153,8 @@ bool vring_should_notify(VirtIODevice *vdev, Vring *vring)
return true;
}
- return vring_need_event(vring_used_event(&vring->vr), new, old);
+ return vring_need_event(virtio_tswap16(vdev, vring_used_event(&vring->vr)),
+ new, old);
}
@@ -397,7 +398,8 @@ int vring_pop(VirtIODevice *vdev, Vring *vring,
/* On success, increment avail index. */
vring->last_avail_idx++;
if (virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX)) {
- vring_avail_event(&vring->vr) = vring->last_avail_idx;
+ vring_avail_event(&vring->vr) =
+ virtio_tswap16(vdev, vring->last_avail_idx);
}
return head;
- [Qemu-devel] [PATCH 0/2] dataplane: cross-endian fixes, Greg Kurz, 2015/06/26
- [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Greg Kurz, 2015/06/26
- Re: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Cornelia Huck, 2015/06/26
- Re: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Greg Kurz, 2015/06/26
- Re: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Michael S. Tsirkin, 2015/06/26
- Re: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Greg Kurz, 2015/06/26
- Re: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Michael S. Tsirkin, 2015/06/28
- Re: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Greg Kurz, 2015/06/28
- Re: [Qemu-devel] [PATCH 1/2] dataplane: drop copy_in_vring_desc(), Greg Kurz, 2015/06/29
[Qemu-devel] [PATCH 2/2] dataplane: fix cross-endian issues,
Greg Kurz <=
Re: [Qemu-devel] [PATCH 0/2] dataplane: cross-endian fixes, Stefan Hajnoczi, 2015/06/26