Patchwork [PATCH-RFC,2/3] virtio: use a real wmb

login
register
mail settings
Submitter Michael S. Tsirkin
Date Dec. 8, 2009, 4:18 p.m.
Message ID <20091208161832.GC32188@redhat.com>
Download mbox | patch
Permalink /patch/40643/
State New
Headers show

Comments

Michael S. Tsirkin - Dec. 8, 2009, 4:18 p.m.
include barriers.h and remove a non-portable
wmb implementation from virtio.c (it will work
for intel but not for other architectures).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

Patch

diff --git a/hw/virtio.c b/hw/virtio.c
index 1f92171..9f020cf 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -15,20 +15,12 @@ 
 
 #include "virtio.h"
 #include "sysemu.h"
+#include "barriers.h"
 
 /* The alignment to use between consumer and producer parts of vring.
  * x86 pagesize again. */
 #define VIRTIO_PCI_VRING_ALIGN         4096
 
-/* 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() __asm__ __volatile__("": : :"memory")
-
 typedef struct VRingDesc
 {
     uint64_t addr;