From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0B8EC4361A for ; Thu, 3 Dec 2020 16:27:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55984221EC for ; Thu, 3 Dec 2020 16:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727345AbgLCQ0t (ORCPT ); Thu, 3 Dec 2020 11:26:49 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:65456 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726811AbgLCQ0s (ORCPT ); Thu, 3 Dec 2020 11:26:48 -0500 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id CB8C497A9C; Thu, 3 Dec 2020 11:26:05 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=SsF41bWK2/VOQbXL/fDJh0HyIq4=; b=rXOeAz bueE7KRSz0xyCVsJryOk/NVONjP0e7MqU7JdrnT64tLoJ9qSyO+JQhYEz+/snBjL SBsKyJb1hw+Eoz1cGUBSYxzPgug2+RTSiKx9XVZicfWiLBFdZssAd8eoDvm27acP GowQaFuhHmyLONtckgBhSc0XJ1nOlfqLDHCBk= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id B993797A9B; Thu, 3 Dec 2020 11:26:05 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=ngdZLDLTfBeh0afHFgm1CorSO481UJ51DdhdoMaESS4=; b=wwm8Iyp3J2rGNnPNxqFFN2IKegZ13UBSVVSy50IOeZ31EojqiTYWlVb572lYFOwdN6AOE3lSHwZd22utAe3egboQ3B857lTbGrWMQK5nX2El+bG+oAFZ9X0mf/ZG5W21eczHmzhpqbrMqC9N918rACNSIRqm5PJmdNTfHM1UMHw= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id AD96F97A9A; Thu, 3 Dec 2020 11:26:04 -0500 (EST) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id 9C9142DA0B35; Thu, 3 Dec 2020 11:26:03 -0500 (EST) Date: Thu, 3 Dec 2020 11:26:03 -0500 (EST) From: Nicolas Pitre To: Geert Uytterhoeven cc: Russell King , Ard Biesheuvel , Marek Szyprowski , Dmitry Osipenko , Linus Walleij , Arnd Bergmann , Eric Miao , =?ISO-8859-15?Q?Uwe_Kleine-K=F6nig?= , Lukasz Stelmach , Stephen Boyd , Chris Brandt , linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 1/3] ARM: uncompress: Add be32tocpu macro In-Reply-To: <20201203121916.2870975-2-geert+renesas@glider.be> Message-ID: <25r4pns0-srrp-nq3s-q4p5-11s925rq9sr0@syhkavp.arg> References: <20201203121916.2870975-1-geert+renesas@glider.be> <20201203121916.2870975-2-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: 3D6BA2B8-3584-11EB-B0DA-D152C8D8090B-78420484!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Dec 2020, Geert Uytterhoeven wrote: > DTB stores all values as 32-bit big-endian integers. > Add a macro to convert such values to native CPU endianness, to reduce > duplication. > > Signed-off-by: Geert Uytterhoeven I agree with Ard's suggestions. In any case: Reviewed-by: Nicolas Pitre > --- > v10: > - New. > --- > arch/arm/boot/compressed/head.S | 26 ++++++++++++-------------- > 1 file changed, 12 insertions(+), 14 deletions(-) > > diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S > index 835ce64f1674c9a2..aabdc544c03aafdc 100644 > --- a/arch/arm/boot/compressed/head.S > +++ b/arch/arm/boot/compressed/head.S > @@ -165,6 +165,16 @@ > orr \res, \res, \tmp1, lsl #24 > .endm > > + .macro be32tocpu, val, tmp > +#ifndef __ARMEB__ > + /* convert to little endian */ > + eor \tmp, \val, \val, ror #16 > + bic \tmp, \tmp, #0x00ff0000 > + mov \val, \val, ror #8 > + eor \val, \val, \tmp, lsr #8 > +#endif > + .endm > + > .section ".start", "ax" > /* > * sort out different calling conventions > @@ -345,13 +355,7 @@ restart: adr r0, LC1 > > /* Get the initial DTB size */ > ldr r5, [r6, #4] > -#ifndef __ARMEB__ > - /* convert to little endian */ > - eor r1, r5, r5, ror #16 > - bic r1, r1, #0x00ff0000 > - mov r5, r5, ror #8 > - eor r5, r5, r1, lsr #8 > -#endif > + be32tocpu r5, r1 > dbgadtb r6, r5 > /* 50% DTB growth should be good enough */ > add r5, r5, r5, lsr #1 > @@ -403,13 +407,7 @@ restart: adr r0, LC1 > > /* Get the current DTB size */ > ldr r5, [r6, #4] > -#ifndef __ARMEB__ > - /* convert r5 (dtb size) to little endian */ > - eor r1, r5, r5, ror #16 > - bic r1, r1, #0x00ff0000 > - mov r5, r5, ror #8 > - eor r5, r5, r1, lsr #8 > -#endif > + be32tocpu r5, r1 > > /* preserve 64-bit alignment */ > add r5, r5, #7 > -- > 2.25.1 > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CD29C4361B for ; Thu, 3 Dec 2020 16:27:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0A8A221EC for ; Thu, 3 Dec 2020 16:27:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0A8A221EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fluxnic.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=08KUwo25kbXXBPnpMhUBnIvnvLCYFySsokU/v3Ziz88=; b=c3vq6p6QWqvz9r6bsaauByMAt hma82O2HChNx/ZRI5kUNCKNA4icx58sekUU4y6fUS1T21NUFEEhs0fjvluzHZv6L0fym6vIYPCkl3 bw0Id0RUO6y6e8IuNlAlS2QxkLC8PUnSRnaQPkBPvsQ1chE6yGVjoYdR6qvwoWoQ+vQ8rrWbHGuwc Mmz5SqOsOPR1CLV5R3H6EeNsZyCoAx61hv1AnqwZ5ywy+Os5+4NKwKNQd9+MFQUHFtneeLIBG0Wsu TQyA26flreFOB39rXFXPA0GTZymDDwMbCtmQb4ssqeIl4Q07QHzGbAUP2EdXYJyEhPaqvAuoFtHNa tdIgTFKiA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkrQp-0005T2-Hq; Thu, 03 Dec 2020 16:26:11 +0000 Received: from pb-smtp1.pobox.com ([64.147.108.70]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkrQl-0005SQ-GS for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2020 16:26:08 +0000 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id CB8C497A9C; Thu, 3 Dec 2020 11:26:05 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=SsF41bWK2/VOQbXL/fDJh0HyIq4=; b=rXOeAz bueE7KRSz0xyCVsJryOk/NVONjP0e7MqU7JdrnT64tLoJ9qSyO+JQhYEz+/snBjL SBsKyJb1hw+Eoz1cGUBSYxzPgug2+RTSiKx9XVZicfWiLBFdZssAd8eoDvm27acP GowQaFuhHmyLONtckgBhSc0XJ1nOlfqLDHCBk= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id B993797A9B; Thu, 3 Dec 2020 11:26:05 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=ngdZLDLTfBeh0afHFgm1CorSO481UJ51DdhdoMaESS4=; b=wwm8Iyp3J2rGNnPNxqFFN2IKegZ13UBSVVSy50IOeZ31EojqiTYWlVb572lYFOwdN6AOE3lSHwZd22utAe3egboQ3B857lTbGrWMQK5nX2El+bG+oAFZ9X0mf/ZG5W21eczHmzhpqbrMqC9N918rACNSIRqm5PJmdNTfHM1UMHw= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id AD96F97A9A; Thu, 3 Dec 2020 11:26:04 -0500 (EST) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id 9C9142DA0B35; Thu, 3 Dec 2020 11:26:03 -0500 (EST) Date: Thu, 3 Dec 2020 11:26:03 -0500 (EST) From: Nicolas Pitre To: Geert Uytterhoeven Subject: Re: [PATCH v10 1/3] ARM: uncompress: Add be32tocpu macro In-Reply-To: <20201203121916.2870975-2-geert+renesas@glider.be> Message-ID: <25r4pns0-srrp-nq3s-q4p5-11s925rq9sr0@syhkavp.arg> References: <20201203121916.2870975-1-geert+renesas@glider.be> <20201203121916.2870975-2-geert+renesas@glider.be> MIME-Version: 1.0 X-Pobox-Relay-ID: 3D6BA2B8-3584-11EB-B0DA-D152C8D8090B-78420484!pb-smtp1.pobox.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201203_112607_726735_ED280CF7 X-CRM114-Status: GOOD ( 17.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Stephen Boyd , Linus Walleij , Lukasz Stelmach , Russell King , linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Chris Brandt , =?ISO-8859-15?Q?Uwe_Kleine-K=F6nig?= , Eric Miao , Dmitry Osipenko , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 3 Dec 2020, Geert Uytterhoeven wrote: > DTB stores all values as 32-bit big-endian integers. > Add a macro to convert such values to native CPU endianness, to reduce > duplication. > > Signed-off-by: Geert Uytterhoeven I agree with Ard's suggestions. In any case: Reviewed-by: Nicolas Pitre > --- > v10: > - New. > --- > arch/arm/boot/compressed/head.S | 26 ++++++++++++-------------- > 1 file changed, 12 insertions(+), 14 deletions(-) > > diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S > index 835ce64f1674c9a2..aabdc544c03aafdc 100644 > --- a/arch/arm/boot/compressed/head.S > +++ b/arch/arm/boot/compressed/head.S > @@ -165,6 +165,16 @@ > orr \res, \res, \tmp1, lsl #24 > .endm > > + .macro be32tocpu, val, tmp > +#ifndef __ARMEB__ > + /* convert to little endian */ > + eor \tmp, \val, \val, ror #16 > + bic \tmp, \tmp, #0x00ff0000 > + mov \val, \val, ror #8 > + eor \val, \val, \tmp, lsr #8 > +#endif > + .endm > + > .section ".start", "ax" > /* > * sort out different calling conventions > @@ -345,13 +355,7 @@ restart: adr r0, LC1 > > /* Get the initial DTB size */ > ldr r5, [r6, #4] > -#ifndef __ARMEB__ > - /* convert to little endian */ > - eor r1, r5, r5, ror #16 > - bic r1, r1, #0x00ff0000 > - mov r5, r5, ror #8 > - eor r5, r5, r1, lsr #8 > -#endif > + be32tocpu r5, r1 > dbgadtb r6, r5 > /* 50% DTB growth should be good enough */ > add r5, r5, r5, lsr #1 > @@ -403,13 +407,7 @@ restart: adr r0, LC1 > > /* Get the current DTB size */ > ldr r5, [r6, #4] > -#ifndef __ARMEB__ > - /* convert r5 (dtb size) to little endian */ > - eor r1, r5, r5, ror #16 > - bic r1, r1, #0x00ff0000 > - mov r5, r5, ror #8 > - eor r5, r5, r1, lsr #8 > -#endif > + be32tocpu r5, r1 > > /* preserve 64-bit alignment */ > add r5, r5, #7 > -- > 2.25.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel