summaryrefslogtreecommitdiff
path: root/hw/virtio.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2009-10-26 15:17:15 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-30 08:39:34 -0500
commit79758e95d7f018dabd726bf7eb8cdd087692410c (patch)
tree2cf8a7cf6696a35bb3e0f8ad3d9bf8df48894c0b /hw/virtio.c
parent1e5b9d2fccb205ed8fc84fb38945b8fb3d225640 (diff)
downloadqemu-79758e95d7f018dabd726bf7eb8cdd087692410c.tar.gz
qemu-79758e95d7f018dabd726bf7eb8cdd087692410c.tar.bz2
qemu-79758e95d7f018dabd726bf7eb8cdd087692410c.zip
qemu/virtio: make wmb compiler barrier + comments
wmb must be at least a compiler barrier, even without SMP. Further, we likely need some rmb()/mb() as well: I have not audited the code but lguest has mb(), add a comment for now. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio.c')
-rw-r--r--hw/virtio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/virtio.c b/hw/virtio.c
index 337ff27ba9..1f92171f68 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -23,8 +23,11 @@
/* QEMU doesn't strictly need write barriers since everything runs in
* lock-step. We'll leave the calls to wmb() in though to make it obvious for
* KVM or if kqemu gets SMP support.
+ * In any case, we must prevent the compiler from reordering the code.
+ * TODO: we likely need some rmb()/mb() as well.
*/
-#define wmb() do { } while (0)
+
+#define wmb() __asm__ __volatile__("": : :"memory")
typedef struct VRingDesc
{