From patchwork Sun Feb 1 18:34:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 5757321 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D2659F39E for ; Sun, 1 Feb 2015 18:35:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B04032026F for ; Sun, 1 Feb 2015 18:35:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C713520260 for ; Sun, 1 Feb 2015 18:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753695AbbBASe6 (ORCPT ); Sun, 1 Feb 2015 13:34:58 -0500 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 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t11IYrcF014630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 1 Feb 2015 13:34:53 -0500 Received: from hawk.usersys.redhat.com ([10.34.1.145]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t11IYnLR003050; Sun, 1 Feb 2015 13:34:52 -0500 From: Andrew Jones To: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: christoffer.dall@linaro.org, pbonzini@redhat.com 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> In-Reply-To: <1422815686-24591-1-git-send-email-drjones@redhat.com> References: <1422815686-24591-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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