]> Git Repo - qemu.git/commitdiff
dataplane: fix cross-endian issues
authorGreg Kurz <[email protected]>
Fri, 26 Jun 2015 07:32:28 +0000 (09:32 +0200)
committerMichael S. Tsirkin <[email protected]>
Tue, 7 Jul 2015 08:21:37 +0000 (11:21 +0300)
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 <[email protected]>
Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
hw/virtio/dataplane/vring.c

index 35891856ee06f2d6adb8c585d0ea50ed484acb78..bed9b11c31d2c8dea50a35e25572d8810e821b24 100644 (file)
@@ -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);
 }
 
 
@@ -407,7 +408,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;
This page took 0.026757 seconds and 4 git commands to generate.