From: Cyrill Gorcunov Date: Tue, 8 May 2012 09:52:40 +0000 (+0400) Subject: kvm tools: Add own barrier() definition X-Git-Tag: next-20120724~32^2~103^2~21 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=401ce06199254753ff45f1d6299244b9d370c58f;p=karo-tx-linux.git kvm tools: Add own barrier() definition Otherwise I'm getting the following compile problem on my Fedora machine. The helper is rather taken from linux kernel. | [cyrill@moon kvm]$ make tags | x86/include/kvm/barrier.h:11:25: fatal error: asm/barrier.h: No such file or directory compilation terminated. Acked-by: Ingo Molnar Signed-off-by: Cyrill Gorcunov Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/x86/include/kvm/barrier.h b/tools/kvm/x86/include/kvm/barrier.h index f1a71281ada9..46d14f67b027 100644 --- a/tools/kvm/x86/include/kvm/barrier.h +++ b/tools/kvm/x86/include/kvm/barrier.h @@ -1,13 +1,20 @@ #ifndef _KVM_BARRIER_H_ #define _KVM_BARRIER_H_ -/* - * asm/system.h cannot be #included standalone on 32-bit x86 yet. - * - * Provide the dependencies here - we can drop these wrappers once - * the header is fixed upstream: - */ - -#include +#define barrier() asm volatile("": : :"memory") + +#define mb() asm volatile ("mfence": : :"memory") +#define rmb() asm volatile ("lfence": : :"memory") +#define wmb() asm volatile ("sfence": : :"memory") + +#ifdef CONFIG_SMP +#define smp_mb() mb() +#define smp_rmb() rmb() +#define smp_wmb() wmb() +#else +#define smp_mb() barrier() +#define smp_rmb() barrier() +#define smp_wmb() barrier() +#endif #endif /* _KVM_BARRIER_H_ */