From patchwork Fri May 12 10:20:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 761537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wPQx14RFHz9s7k for ; Fri, 12 May 2017 20:21:09 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756592AbdELKVI (ORCPT ); Fri, 12 May 2017 06:21:08 -0400 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 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FA83448D82; Fri, 12 May 2017 10:21:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5FA83448D82 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5FA83448D82 Received: from t460s.redhat.com (ovpn-116-140.ams2.redhat.com [10.36.116.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0F0D8B966; Fri, 12 May 2017 10:21:01 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org 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 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> In-Reply-To: <20170512102042.4956-1-david@redhat.com> References: <20170512102042.4956-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 12 May 2017 10:21:07 +0000 (UTC) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org 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;