From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [PATCH 01/18] x86: expose spin_lock/unlock to lib code Date: Sun, 1 Feb 2015 19:34:29 +0100 Message-ID: <1422815686-24591-2-git-send-email-drjones@redhat.com> References: <1422815686-24591-1-git-send-email-drjones@redhat.com> Cc: christoffer.dall@linaro.org, pbonzini@redhat.com To: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60300 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753627AbbBASe4 (ORCPT ); Sun, 1 Feb 2015 13:34:56 -0500 In-Reply-To: <1422815686-24591-1-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Move the spin_lock/unlock declarations to lib/x86/asm/spinlock.h, allowing lib code, e.g. lib/report.c, to use spinlocks. Signed-off-by: Andrew Jones --- lib/x86/asm/spinlock.h | 11 +++++++++++ lib/x86/smp.h | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 lib/x86/asm/spinlock.h diff --git a/lib/x86/asm/spinlock.h b/lib/x86/asm/spinlock.h new file mode 100644 index 0000000000000..4b0cb331c048b --- /dev/null +++ b/lib/x86/asm/spinlock.h @@ -0,0 +1,11 @@ +#ifndef __ASM_SPINLOCK_H +#define __ASM_SPINLOCK_H + +struct spinlock { + int v; +}; + +void spin_lock(struct spinlock *lock); +void spin_unlock(struct spinlock *lock); + +#endif diff --git a/lib/x86/smp.h b/lib/x86/smp.h index df5fdba9b9288..566018f49ba31 100644 --- a/lib/x86/smp.h +++ b/lib/x86/smp.h @@ -1,21 +1,16 @@ #ifndef __SMP_H #define __SMP_H +#include #define mb() asm volatile("mfence":::"memory") #define rmb() asm volatile("lfence":::"memory") #define wmb() asm volatile("sfence" ::: "memory") -struct spinlock { - int v; -}; - void smp_init(void); int cpu_count(void); int smp_id(void); void on_cpu(int cpu, void (*function)(void *data), void *data); void on_cpu_async(int cpu, void (*function)(void *data), void *data); -void spin_lock(struct spinlock *lock); -void spin_unlock(struct spinlock *lock); #endif -- 1.9.3