From patchwork Mon Feb 22 21:26:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 46015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4F415B7CEC for ; Tue, 23 Feb 2010 08:43:37 +1100 (EST) Received: from localhost ([127.0.0.1]:47502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NjfsU-0007aa-Rj for incoming@patchwork.ozlabs.org; Mon, 22 Feb 2010 16:31:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Njfop-0006tw-8l for qemu-devel@nongnu.org; Mon, 22 Feb 2010 16:27:55 -0500 Received: from [199.232.76.173] (port=56401 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Njfoo-0006td-IT for qemu-devel@nongnu.org; Mon, 22 Feb 2010 16:27:54 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Njfol-00036O-El for qemu-devel@nongnu.org; Mon, 22 Feb 2010 16:27:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32203) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Njfok-000361-Jn for qemu-devel@nongnu.org; Mon, 22 Feb 2010 16:27:51 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1MLRlvp029094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 22 Feb 2010 16:27:47 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1MLRkjU031789; Mon, 22 Feb 2010 16:27:46 -0500 Received: from amt.cnet (vpn-11-163.rdu.redhat.com [10.11.11.163]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o1MLRikT016391; Mon, 22 Feb 2010 16:27:45 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 89FCD66E139; Mon, 22 Feb 2010 18:27:22 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o1MLRJBr000792; Mon, 22 Feb 2010 18:27:19 -0300 From: Marcelo Tosatti To: Anthony Liguori Date: Mon, 22 Feb 2010 18:26:50 -0300 Message-Id: <85199474d0df23b87f0b4a3e330401b59aac3ec0.1266874009.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Avi Kivity Subject: [Qemu-devel] [PATCH 8/8] kvm-all.c: define smp_wmb and use it for coalesced mmio X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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