From: David Vrabel Subject: [PATCHv4 2/8] arm: provide arch_fetch_and_add() Date: Thu, 30 Apr 2015 16:33:16 +0100 Message-ID: <1430408002-30666-3-git-send-email-david.vrabel@citrix.com> References: <1430408002-30666-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YnqXi-0002Kh-VZ for xen-devel@lists.xenproject.org; Thu, 30 Apr 2015 15:38:31 +0000 In-Reply-To: <1430408002-30666-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Keir Fraser , Ian Campbell , Andrew Cooper , Tim Deegan , David Vrabel , Jan Beulich , Jennifer Herbert List-Id: xen-devel@lists.xenproject.org arch_fetch_and_add() atomically adds a value and returns the previous value. This generic arm implementation uses the GCC __sync_fetch_and_add() builtin. This builtin resulted in suitable inlined asm for GCC 4.8.3 (arm64) and GCC 4.6.3 (arm32). This is needed to implement ticket locks. Signed-off-by: David Vrabel Acked-by: Ian Campbell --- xen/include/asm-arm/system.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/include/asm-arm/system.h b/xen/include/asm-arm/system.h index ce3d38a..2eb96e8 100644 --- a/xen/include/asm-arm/system.h +++ b/xen/include/asm-arm/system.h @@ -51,6 +51,8 @@ # error "unknown ARM variant" #endif +#define arch_fetch_and_add(x, v) __sync_fetch_and_add(x, v) + extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next); #endif -- 1.7.10.4