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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1DBC2C43334 for ; Fri, 3 Jun 2022 14:24:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 979F483DCB; Fri, 3 Jun 2022 16:24:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="KspnCOhN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0EE7983EE8; Fri, 3 Jun 2022 16:24:08 +0200 (CEST) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [IPv6:2001:4b98:dc4:8::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1FA0D8395F for ; Fri, 3 Jun 2022 16:24:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=miquel.raynal@bootlin.com Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 9F979100005; Fri, 3 Jun 2022 14:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1654266244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kb3UbQJ4BGpudj6oeAWhB+fjApqubk0X0eserpRcVsg=; b=KspnCOhNYxckd2vmlOVuaEEmgyVOX0UG0JehA1ADi8pbBT/dYNRlpvXaPGt7qd2ugYWDxw BqEOK8rHRNPvQm5pp6griHgu7bthdZxDEjM6MufDwyUIPsnebLIIoBdP8pYDa6V7Wdm4Yb 97utmM4ScRwM4sgHY4C1ug61i0qeM6Dw9vzBK646t6/tAbeKKPXTcuKxi7XV1w1z42vNlr BrgT1XsKZn8S25Sz2W+iHXWXxdZU1XAEntUfQm2f/DGYol6pwQzN7BHf+h8RnJ4dP0eA4Z Y8Ilwr7iS9jIwwyS7gdWay4VGtwiMr3WAV+7wyX8vafXmozoVfP7whtZKrJ4ng== Date: Fri, 3 Jun 2022 16:24:01 +0200 From: Miquel Raynal To: Tom Rini Cc: Pali =?UTF-8?B?Um9ow6Fy?= , wJoao Marcos Costa , Thomas Petazzoni , u-boot@lists.denx.de Subject: Re: [PATCH] squashfs: Fix compilation on big endian systems Message-ID: <20220603162401.2b3567e6@xps-13> In-Reply-To: <20220601140820.GE25375@bill-the-cat> References: <20220406213153.30437-1-pali@kernel.org> <20220407095421.7a3a2508@xps13> <20220407094159.ntw7vt5mcmdtmfp6@pali> <20220407115455.265f0cf3@xps13> <20220407095855.2b4dq37xdrqd5o37@pali> <20220601140820.GE25375@bill-the-cat> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Tom, trini@konsulko.com wrote on Wed, 1 Jun 2022 10:08:20 -0400: > On Thu, Apr 07, 2022 at 11:58:55AM +0200, Pali Roh=C3=A1r wrote: > > On Thursday 07 April 2022 11:54:55 Miquel Raynal wrote: =20 > > > Hi Pali, > > >=20 > > > pali@kernel.org wrote on Thu, 7 Apr 2022 11:41:59 +0200: > > > =20 > > > > On Thursday 07 April 2022 09:54:21 Miquel Raynal wrote: =20 > > > > > Hi Pali, > > > > >=20 > > > > > pali@kernel.org wrote on Wed, 6 Apr 2022 23:31:53 +0200: > > > > >=20 > > > > > Would you mind explaining a little bit how this change fixes it? = It > > > > > does not look straightforward to me. =20 > > > >=20 > > > > Yes! I though that it is straightforward this change... > > > > byteorder/little_endian.h defines cpu_to_le* macros for Little Endi= an > > > > systems and byteorder/big_endian.h for Big Endian systems. > > > >=20 > > > > File asm/byteorder.h is then ARCH-specific and implements macros fo= r the > > > > current architecture (by including the correct header file). > > > >=20 > > > > So currently if you try to compile squashfs for big endian systems = you > > > > get compile error: > > > >=20 > > > > In file included from ./arch/powerpc/include/asm/byteorder.h:82, > > > > from include/linux/unaligned/access_ok.h:4, > > > > from ./arch/powerpc/include/asm/unaligned.h:9, > > > > from fs/squashfs/sqfs_filesystem.h:11, > > > > from fs/squashfs/sqfs_dir.c:16: > > > > include/linux/byteorder/big_endian.h:34: warning: "__cpu_to_le32"= redefined > > > > #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) > > > >=20 > > > > In file included from fs/squashfs/sqfs_dir.c:10: > > > > include/linux/byteorder/little_endian.h:34: note: this is the loc= ation of the previous definition > > > > #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) > > > >=20 > > > > Or: > > > >=20 > > > > In file included from fs/squashfs/sqfs.c:14: > > > > include/linux/byteorder/little_endian.h:89:21: error: redefinitio= n of =E2=80=98__be16_to_cpup=E2=80=99 > > > > static inline __u16 __be16_to_cpup(const __be16 *p) > > > > ^~~~~~~~~~~~~~ > > > > In file included from ./arch/powerpc/include/asm/byteorder.h:82, > > > > from include/linux/unaligned/access_ok.h:4, > > > > from ./arch/powerpc/include/asm/unaligned.h:9, > > > > from fs/squashfs/sqfs.c:10: > > > > include/linux/byteorder/big_endian.h:89:21: note: previous defini= tion of =E2=80=98__be16_to_cpup=E2=80=99 was here > > > > static inline __u16 __be16_to_cpup(const __be16 *p) > > > > ^~~~~~~~~~~~~~ > > > >=20 > > > > As some header files include correct asm/byteorder.h file and this > > > > squashfs includes additional little_endian.h. =20 > > >=20 > > > Great, thanks for the thorough explanation. Based on what you said, > > > wouldn't it be cleaner to just get rid of the little_endian.h include > > > rather than also use the ARCH specific byteorder.h header? =20 > >=20 > > I think that this is not possible. squashfs code uses le16_to_cpu() > > macro and its correct definition is provided only by arch specific > > asm/byteorder.h. =20 >=20 > Miquel, is this sufficient explanation? Thanks. Yes, sorry, it seems like in U-Boot including the asm header is the way to go, so: Reviewed-by: Miquel Raynal Thanks, Miqu=C3=A8l