From patchwork Mon Feb 22 21:26:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [8/8] kvm-all.c: define smp_wmb and use it for coalesced mmio Date: Mon, 22 Feb 2010 11:26:50 -0000 From: Marcelo Tosatti X-Patchwork-Id: 46015 Message-Id: <85199474d0df23b87f0b4a3e330401b59aac3ec0.1266874009.git.mtosatti@redhat.com> To: Anthony Liguori Cc: Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Avi Kivity Acked-by: "Michael S. Tsirkin" Signed-off-by: Marcelo Tosatti Signed-off-by: Avi Kivity --- kvm-all.c | 3 ++- qemu-barrier.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletions(-) create mode 100644 qemu-barrier.h diff --git a/kvm-all.c b/kvm-all.c index 91d3cbd..1a02076 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -21,6 +21,7 @@ #include #include "qemu-common.h" +#include "qemu-barrier.h" #include "sysemu.h" #include "hw/hw.h" #include "gdbstub.h" @@ -730,7 +731,7 @@ void kvm_flush_coalesced_mmio_buffer(void) ent = &ring->coalesced_mmio[ring->first]; cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len); - /* FIXME smp_wmb() */ + smp_wmb(); ring->first = (ring->first + 1) % KVM_COALESCED_MMIO_MAX; } } diff --git a/qemu-barrier.h b/qemu-barrier.h new file mode 100644 index 0000000..3bd1075 --- /dev/null +++ b/qemu-barrier.h @@ -0,0 +1,7 @@ +#ifndef __QEMU_BARRIER_H +#define __QEMU_BARRIER_H 1 + +/* FIXME: arch dependant, x86 version */ +#define smp_wmb() asm volatile("" ::: "memory") + +#endif