From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Subject: [kvm-unit-tests PATCH v1 3/3] x86: use asm-generic spinlock Date: Fri, 12 May 2017 12:20:42 +0200 Message-ID: <20170512102042.4956-4-david@redhat.com> References: <20170512102042.4956-1-david@redhat.com> Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Huth , david@redhat.com, Laurent Vivier , kvm-ppc@vger.kernel.org To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38400 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756428AbdELKVH (ORCPT ); Fri, 12 May 2017 06:21:07 -0400 In-Reply-To: <20170512102042.4956-1-david@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: David Hildenbrand --- lib/x86/asm/spinlock.h | 9 ++------- lib/x86/smp.c | 16 ---------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/lib/x86/asm/spinlock.h b/lib/x86/asm/spinlock.h index 4b0cb33..e302b56 100644 --- a/lib/x86/asm/spinlock.h +++ b/lib/x86/asm/spinlock.h @@ -1,11 +1,6 @@ +#include + #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.c b/lib/x86/smp.c index 1eb49f2..4bdbeae 100644 --- a/lib/x86/smp.c +++ b/lib/x86/smp.c @@ -43,22 +43,6 @@ asm ( #endif ); -void spin_lock(struct spinlock *lock) -{ - int v = 1; - - do { - asm volatile ("xchg %1, %0" : "+m"(lock->v), "+r"(v)); - } while (v); - asm volatile ("" : : : "memory"); -} - -void spin_unlock(struct spinlock *lock) -{ - asm volatile ("" : : : "memory"); - lock->v = 0; -} - int cpu_count(void) { return _cpu_count; -- 2.9.3