From patchwork Sat Apr 20 02:28:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 238136 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7BBC42C0220 for ; Sat, 20 Apr 2013 12:29:55 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTNYf-0001h2-9R; Sat, 20 Apr 2013 02:29:45 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTNYc-0001Ac-Qd; Sat, 20 Apr 2013 02:29:42 +0000 Received: from intranet.asianux.com ([58.214.24.6]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTNYZ-0001AI-63 for linux-arm-kernel@lists.infradead.org; Sat, 20 Apr 2013 02:29:40 +0000 Received: by intranet.asianux.com (Postfix, from userid 103) id 1586418402BC; Sat, 20 Apr 2013 10:29:37 +0800 (CST) X-Spam-Score: -100.8 X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on intranet.asianux.com X-Spam-Level: X-Spam-Status: No, score=-100.8 required=5.0 tests=AWL,BAYES_00, RATWARE_GECKO_BUILD, TW_PX, USER_IN_WHITELIST autolearn=no version=3.1.9 Received: from [10.1.0.143] (unknown [219.143.36.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by intranet.asianux.com (Postfix) with ESMTP id 943201840242; Sat, 20 Apr 2013 10:29:36 +0800 (CST) Message-ID: <5171FD67.2080104@asianux.com> Date: Sat, 20 Apr 2013 10:28:55 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Arnd Bergmann Subject: Re: [Suggestion] ARM64: kernel: compiling issue, need implement cmpxchg64 with assembler language. References: <51712E5E.2020809@asianux.com> <201304191412.54601.arnd@arndb.de> In-Reply-To: <201304191412.54601.arnd@arndb.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130419_222939_657449_48A76087 X-CRM114-Status: GOOD ( 18.47 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Tony Lindgren , Catalin Marinas , Will Deacon , "linux-kernel@vger.kernel.org" , Santosh Shilimkar , "olof@lixom.net" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org On 2013年04月19日 20:12, Arnd Bergmann wrote: > On Friday 19 April 2013, Chen Gang wrote: >> in arch/arm64/include/asm, not define the function cmpxchg64 >> >> when compiling with allmodconfig, >> drivers/block/blockconsole.c will need this function. >> >> I am not quite familiar with ARM64 (neither ARM64 assembler) >> >> can any member helps to send related patch ? >> if no one have time to send related patch, I should try. >> and I am glad to try, but need additional time resources, >> if I try, I should finish it within this month (2013-4-30). >> >> welcome any suggestions or completions. > > cmpxchg64 is the same as cmpxchg on 64-bit platforms, can't the > driver be changed to use the latter? > > Arnd > > can we be sure that cmpxchg64 is equal to cmpchg on all 64-bit platforms ? (I guess, the driver may need cross multiple platforms) (it seems, under x86, s390, better use cmpxchg64, at least they define it). whether we can be sure or not, I still prefer to define the macro cmpxchg64 just the alias of cmpxchg. (and I also guess ARM64 is always on 64-bit platform) the related patch may be like below. -------------------------------patch begin-------------------------------------- -------------------------------patch end---------------------------------------- I think, we can also reference the implementation of s390: it is in arch/s390/include/asm/cmpxchg.h. since we are ARM64, excluding ARM(32,16...), we can only consider 64-bit. if in the future, ARM64 and ARM are merged together: we can use CONFIG_64BIT to switch the cmpxchg64 definition. if define CONFIG_64BIT, use cmpxchg instead of cmpxchg64. else, use the definition of ARM (arch/arm/include/asm/cmpxchg.h already defines cmpxchg64) -------------------------------reference begin---------------------------------- #ifdef CONFIG_64BIT #define cmpxchg64(ptr, o, n) \ ({ \ cmpxchg((ptr), (o), (n)); \ }) #else /* CONFIG_64BIT */ ... -------------------------------reference end------------------------------------ :-) diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index 968b5cb..b572d2b 100644 --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h @@ -170,4 +170,6 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old, (unsigned long)(n), \ sizeof(*(ptr)))) +#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) + #endif /* __ASM_CMPXCHG_H */