From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Gordeev Subject: [PATCH v2 5/9] x86: Introduce lib/x86/asm/barrier.h Date: Wed, 27 Apr 2016 15:13:54 +0200 Message-ID: <533e152f9d355b42e7698f693795745ff52e0797.1461762419.git.agordeev@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Alexander Gordeev , Andrew Jones , Thomas Huth , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57158 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752816AbcD0NOK (ORCPT ); Wed, 27 Apr 2016 09:14:10 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F6108113B for ; Wed, 27 Apr 2016 13:14:10 +0000 (UTC) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Make x86 consistent with other architectures and put memory barrier defines to lib/x86/asm/barrier.h Cc: Andrew Jones Cc: Thomas Huth Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 Signed-off-by: Alexander Gordeev --- lib/x86/asm/barrier.h | 8 ++++++++ lib/x86/asm/io.h | 1 + lib/x86/smp.h | 4 ---- x86/kvmclock.c | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 lib/x86/asm/barrier.h diff --git a/lib/x86/asm/barrier.h b/lib/x86/asm/barrier.h new file mode 100644 index 0000000..0ca1c56 --- /dev/null +++ b/lib/x86/asm/barrier.h @@ -0,0 +1,8 @@ +#ifndef _ASM_X86_BARRIER_H_ +#define _ASM_X86_BARRIER_H_ + +#define mb() asm volatile("mfence":::"memory") +#define rmb() asm volatile("lfence":::"memory") +#define wmb() asm volatile("sfence" ::: "memory") + +#endif diff --git a/lib/x86/asm/io.h b/lib/x86/asm/io.h index 68b10e5..5b901a3 100644 --- a/lib/x86/asm/io.h +++ b/lib/x86/asm/io.h @@ -2,6 +2,7 @@ #define _ASM_X86_IO_H_ =20 #include "asm/page.h" +#include "asm/barrier.h" =20 static inline unsigned char inb(unsigned short port) { diff --git a/lib/x86/smp.h b/lib/x86/smp.h index 566018f..afabac8 100644 --- a/lib/x86/smp.h +++ b/lib/x86/smp.h @@ -2,10 +2,6 @@ #define __SMP_H #include =20 -#define mb() asm volatile("mfence":::"memory") -#define rmb() asm volatile("lfence":::"memory") -#define wmb() asm volatile("sfence" ::: "memory") - void smp_init(void); =20 int cpu_count(void); diff --git a/x86/kvmclock.c b/x86/kvmclock.c index 327e60d..208d43c 100644 --- a/x86/kvmclock.c +++ b/x86/kvmclock.c @@ -3,6 +3,7 @@ #include "atomic.h" #include "processor.h" #include "kvmclock.h" +#include "asm/barrier.h" =20 #define unlikely(x) __builtin_expect(!!(x), 0) #define likely(x) __builtin_expect(!!(x), 1) --=20 1.8.3.1