From patchwork Fri Jul 15 06:48:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corneliu ZUZU X-Patchwork-Id: 9231199 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7FFC160574 for ; Fri, 15 Jul 2016 06:51:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D8922816B for ; Fri, 15 Jul 2016 06:51:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60A6A28307; Fri, 15 Jul 2016 06:51:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BD8502816B for ; Fri, 15 Jul 2016 06:51:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNwvH-0007uy-8w; Fri, 15 Jul 2016 06:48:31 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bNwvG-0007ur-9f for xen-devel@lists.xen.org; Fri, 15 Jul 2016 06:48:30 +0000 Received: from [193.109.254.147] by server-13.bemta-14.messagelabs.com id DC/9B-09524-D3788875; Fri, 15 Jul 2016 06:48:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsUSfTxjoa5te0e 4wYslTBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa0bjhn+MBct0Kg7OXMDSwHhIrYuRk0NIwENi 4905rF2MXED2WkaJRZuWs0M4JxklHq5tZ4ap2j/lLjNEYjWjxIO7+9hBEmwC2hLnDt1jArFFB KQlrn2+zAhiMwuESkz9+4AFxBYW8JFYvXIRG4jNIqAqsXNCO1icV8BVYmnLUaBeDg4JATmJBR fSQUxOATeJ06cLIda6SmzcewLsBAmBHIm9h79AVUtJ/G9VArlGQmAZi8St88tYIWpkJB5NvMk 2gVFoASPDKkaN4tSistQiXSMLvaSizPSMktzEzBxdQ0MTvdzU4uLE9NScxKRiveT83E2MwDCs Z2Bg3MG47rjfIUZJDiYlUd6NKR3hQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4L7UC5QSLUtNTK 9Iyc4ARAZOW4OBREuH9BJLmLS5IzC3OTIdInWLU5Tg298ZaJiGWvPy8VClx3s8gRQIgRRmleX AjYNF5iVFWSpiXkYGBQYinILUoN7MEVf4VozgHo5Iw7zuQKTyZeSVwm14BHcEEdIS1eTvIESW JCCmpBkbxf4cO7Ll1NNCjf2LO9N2Ld8UvuS5+/8e2/Z6bY1LYrdTbU08/WuHzX00hSlpeNXSP 7nbu+Y+mtctNrj3t4LDsxs/zL2y+3ZxZ/eD9OpXOuLA73utSErzt/j7X1V9xfCrLRhGRnOf1x 0wPWSfuc667vDx+9bMZzwtvxXUnCHopyPG0BJTPKlRXYinOSDTUYi4qTgQArFZar8kCAAA= X-Env-Sender: czuzu@bitdefender.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1468565308!54003757!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25162 invoked from network); 15 Jul 2016 06:48:28 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-5.tower-27.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 15 Jul 2016 06:48:28 -0000 Received: (qmail 13126 invoked from network); 15 Jul 2016 09:48:27 +0300 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 15 Jul 2016 09:48:27 +0300 Received: from smtp01.buh.bitdefender.com (unknown [10.17.80.75]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id BF75A7FC06 for ; Fri, 15 Jul 2016 09:48:27 +0300 (EEST) Received: (qmail 10720 invoked from network); 15 Jul 2016 09:48:27 +0300 Received: from unknown (HELO czuzu-dev-vm.clj.bitdefender.biz) (czuzu@bitdefender.com@91.199.104.243) by smtp01.buh.bitdefender.com with SMTP; 15 Jul 2016 09:48:27 +0300 From: Corneliu ZUZU To: xen-devel@lists.xen.org Date: Fri, 15 Jul 2016 09:48:07 +0300 Message-Id: <1468565287-32581-1-git-send-email-czuzu@bitdefender.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1468565278-32535-1-git-send-email-czuzu@bitdefender.com> References: <1468565278-32535-1-git-send-email-czuzu@bitdefender.com> X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp01.buh.bitdefender.com, sigver: 7.66328 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 426550, Stamp: 3], Multi: [Enabled, t: (0.000010, 0.005727)], BW: [Enabled, t: (0.000007,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.004399), Flags: 85D2ED72; NN_TP_TAG_HTTP; NN_NO_CONTENT_TYPE; NN_LEGIT_SUMM_400_WORDS; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.011112)], URL: [Enabled, t: (0.000014)], RTDA: [Enabled, t: (0.021820), Hit: No, Details: v2.3.10; Id: 2m1ghic.1aml0sh1c.1nkm2], total: 0(775) X-BitDefender-CF-Stamp: none Cc: Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v4 1/7] asm-arm/atomic.h: fix arm32|arm64 macros duplication X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Move duplicate macros between asm-arm/arm32/atomic.h and asm-arm/arm64/atomic.h to asm-arm/atomic.h. Adjust README.LinuxPrimitives in the process. Also empty line fixes. Signed-off-by: Corneliu ZUZU Reviewed-by: Stefano Stabellini --- Changed since v3: * update README.LinuxPrimitives file --- xen/arch/arm/README.LinuxPrimitives | 20 ++++++++++++++++++++ xen/include/asm-arm/arm32/atomic.h | 15 ++------------- xen/include/asm-arm/arm64/atomic.h | 15 ++------------- xen/include/asm-arm/atomic.h | 14 ++++++++++++++ 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/xen/arch/arm/README.LinuxPrimitives b/xen/arch/arm/README.LinuxPrimitives index 3115f51..4906593 100644 --- a/xen/arch/arm/README.LinuxPrimitives +++ b/xen/arch/arm/README.LinuxPrimitives @@ -23,6 +23,16 @@ atomics: last sync @ v3.16-rc6 (last commit: 8715466b6027) linux/arch/arm64/include/asm/atomic.h xen/include/asm-arm/arm64/atomic.h +The following functions were taken from Linux: + atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(), + atomic_cmpxchg(), __atomic_add_unless() + +Also, the following macros which were in the meantime moved to asm-arm/atomic.h: + atomic_xchg(v, new), atomic_inc(v), atomic_dec(v), + atomic_inc_and_test(v), atomic_dec_and_test(v), + atomic_inc_return(v), atomic_dec_return(v), + atomic_sub_and_test(i, v), atomic_add_negative(i,v) + --------------------------------------------------------------------- mem*: last sync @ v3.16-rc6 (last commit: d875c9b37240) @@ -91,6 +101,16 @@ atomics: last sync @ v3.16-rc6 (last commit: 030d0178bdbd) linux/arch/arm/include/asm/atomic.h xen/include/asm-arm/arm32/atomic.h +The following functions were taken from Linux: + atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(), + atomic_cmpxchg(), __atomic_add_unless() + +Also, the following macros which were in the meantime moved to asm-arm/atomic.h: + atomic_xchg(v, new), atomic_inc(v), atomic_dec(v), + atomic_inc_and_test(v), atomic_dec_and_test(v), + atomic_inc_return(v), atomic_dec_return(v), + atomic_sub_and_test(i, v), atomic_add_negative(i,v) + --------------------------------------------------------------------- mem*: last sync @ v3.16-rc6 (last commit: d98b90ea22b0) diff --git a/xen/include/asm-arm/arm32/atomic.h b/xen/include/asm-arm/arm32/atomic.h index 7ec712f..78de60f 100644 --- a/xen/include/asm-arm/arm32/atomic.h +++ b/xen/include/asm-arm/arm32/atomic.h @@ -8,6 +8,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ + #ifndef __ARCH_ARM_ARM32_ATOMIC__ #define __ARCH_ARM_ARM32_ATOMIC__ @@ -147,20 +148,8 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) return oldval; } -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) - -#define atomic_inc(v) atomic_add(1, v) -#define atomic_dec(v) atomic_sub(1, v) - -#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) -#define atomic_inc_return(v) (atomic_add_return(1, v)) -#define atomic_dec_return(v) (atomic_sub_return(1, v)) -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) - -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) - #endif /* __ARCH_ARM_ARM32_ATOMIC__ */ + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/arm64/atomic.h b/xen/include/asm-arm/arm64/atomic.h index b49219e..d640bef 100644 --- a/xen/include/asm-arm/arm64/atomic.h +++ b/xen/include/asm-arm/arm64/atomic.h @@ -19,6 +19,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #ifndef __ARCH_ARM_ARM64_ATOMIC #define __ARCH_ARM_ARM64_ATOMIC @@ -113,8 +114,6 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new) return oldval; } -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) - static inline int __atomic_add_unless(atomic_t *v, int a, int u) { int c, old; @@ -125,18 +124,8 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) return c; } -#define atomic_inc(v) atomic_add(1, v) -#define atomic_dec(v) atomic_sub(1, v) - -#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) -#define atomic_inc_return(v) (atomic_add_return(1, v)) -#define atomic_dec_return(v) (atomic_sub_return(1, v)) -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) - -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) - #endif + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h index 29ab265..32771e9 100644 --- a/xen/include/asm-arm/atomic.h +++ b/xen/include/asm-arm/atomic.h @@ -138,7 +138,21 @@ static inline void _atomic_set(atomic_t *v, int i) # error "unknown ARM variant" #endif +#define atomic_inc(v) atomic_add(1, v) +#define atomic_dec(v) atomic_sub(1, v) + +#define atomic_inc_and_test(v) (atomic_add_return(1, v) == 0) +#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) +#define atomic_inc_return(v) (atomic_add_return(1, v)) +#define atomic_dec_return(v) (atomic_sub_return(1, v)) +#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0) + +#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0) + +#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) + #endif /* __ARCH_ARM_ATOMIC__ */ + /* * Local variables: * mode: C