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=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 A2EA2C07E99 for ; Mon, 12 Jul 2021 15:43:28 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B486D60FF1 for ; Mon, 12 Jul 2021 15:43:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B486D60FF1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B59FF82D22; Mon, 12 Jul 2021 17:43:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="KfjHpVXh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AAF9C82DDE; Mon, 12 Jul 2021 17:43:23 +0200 (CEST) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 704EC82C04 for ; Mon, 12 Jul 2021 17:43:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x830.google.com with SMTP id k3so5111321qtq.7 for ; Mon, 12 Jul 2021 08:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wnDn4uyKWrALqrKAvF9rBDT9LHj8VGqxTJw8shoG9l0=; b=KfjHpVXhDLeTZZGDXMwLl6wTeqGiAfSgcCsqcqEdIIkw/nCdRwU0Co4VoGx4awvW8f GAbA6M/6p1Ye9zob/TiZZ49K/3X58lLJJSmXLbiIDRNVxrBztXxucIm+trgo9nmrPRas Xo7Ogeubc0DlXNebutaU9Mu5LLylyXkV+Umk0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wnDn4uyKWrALqrKAvF9rBDT9LHj8VGqxTJw8shoG9l0=; b=kb4JCMQ3Ur8vm6Uxemx9m3kOsiq6maXMglZoDEASQfvclAw6m/398qxCdR12PXtdLd 9fvKc/gMTDW1mnW8QPDlKBLEe9Sr1saQNiU/NempFPSN5Wsj/YEl3yHgqfj25HEKvZUr a347+AuWN1qTRFQRyNDn9dob23kXfUKchUu7dnGVMgbfAfT7cSPObOAQ66di+wkfW0Gm pE9n9hqsbLSvNwpMOZKuFBHYl5I1gvK1popWVZ/j7CI66B0nKor30uocRLywV1ifGu/j O2cVD6xiPS/7qjgUfsGYNKrde0WoeQ6qnv67jwfXLy/vQvkuRaI8IG0XBmBAd0vvRbzR ETqA== X-Gm-Message-State: AOAM533y6W0978fGYVLhPYPa2vXuFDHs0ffdn5v4tKR+mXNRjz5OYCyB wan2fEupaKEzByUJblQo9L9Vgg== X-Google-Smtp-Source: ABdhPJz13eSVrr00aDKfNrsBh/AanS8rnUgV56XQnCuMpJ08Au871Dlv3sZ+RJ501H+Xvbo09ViR7g== X-Received: by 2002:ac8:7f07:: with SMTP id f7mr47156120qtk.120.1626104599062; Mon, 12 Jul 2021 08:43:19 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-8124-e22d-adbc-1eeb.res6.spectrum.com. [2603:6081:7b01:cbda:8124:e22d:adbc:1eeb]) by smtp.gmail.com with ESMTPSA id az37sm3058584qkb.91.2021.07.12.08.43.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Jul 2021 08:43:18 -0700 (PDT) Date: Mon, 12 Jul 2021 11:43:16 -0400 From: Tom Rini To: Marek Vasut Cc: Bin Meng , Reuben Dowle , Simon Glass , "u-boot@lists.denx.de" Subject: Re: [PATCH] spl: Align device tree blob address at 8-byte boundary Message-ID: <20210712154316.GX9516@bill-the-cat> References: <20210712035231.26475-1-bmeng.cn@gmail.com> <58187afcb4aa481a8302777aca599fa7@4rf.com> <20210712151510.GT9516@bill-the-cat> <1fed7815-de64-27b4-77ed-4e888fb882da@denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="L/Z8CcqZ6itta5ah" Content-Disposition: inline In-Reply-To: <1fed7815-de64-27b4-77ed-4e888fb882da@denx.de> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean --L/Z8CcqZ6itta5ah Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 12, 2021 at 05:38:33PM +0200, Marek Vasut wrote: > On 7/12/21 5:15 PM, Tom Rini wrote: > > On Mon, Jul 12, 2021 at 01:36:14PM +0800, Bin Meng wrote: > > > On Mon, Jul 12, 2021 at 1:21 PM Reuben Dowle w= rote: > > > >=20 > > > > I submitted an almost identical patch. See https://github.com/u-boo= t/u-boot/commit/eb39d8ba5f0d1468b01b89a2a464d18612d3ea76 > > > >=20 > > > > This patch eventually had to be reverted (https://github.com/u-boot= /u-boot/commit/5675ed7cb645f5ec13958726992daeeed16fd114), because it was ca= using issues on some platforms that had FIT on 32 bit boundary. However I c= ontinue to use it in production code, as without it the boot on my platform= aborts. > > > >=20 > > > > I don't have time to investigate why this was happening, but you ne= ed to check this code won't just cause exactly the same faults. > > >=20 > > > Thanks for your information. > > >=20 > > > +Marek who did the revert > > >=20 > > > The revert commit message says: > > >=20 > > > "The commit breaks booting of fitImage by SPL, the system simply > > > hangs. This is because on arm32, the fitImage and all of its content > > > can be aligned to 4 bytes and U-Boot expects just that." > > >=20 > > > I don't understand this. If an address is aligned to 8, it is already > > > aligned to 4, so how did this commit make the system hang on arm32? > >=20 > > I think this had something to do with embedding contents somewhere in > > the image? There is a thread on the ML from then but I don't know how > > informative it will end up being. >=20 > If I recall this correctly, DT node alignment is 4 byte and that is what = DTC > emits. If you have fitImage with embedded data, you basically end up with >=20 > / { > prop1 =3D "string1"; > prop2 =3D "string2"; > }; >=20 > where the "string2" is aligned to 4 bytes. And that is what U-Boot expects > when it tries to access those data in-place in SPL. >=20 > The problem with the reverted patch was that it made U-Boot assume the > alignment is 8 bytes, and that actually works only if you use fitImage wi= th > external data (mkimage -E), but with embedded data (mkimage default) not = so > much. That caused off-by-4 error in some cases and that made the SPL hang. >=20 > > > Note, as I indicated in this patch, now with libfdt 1.6.1, the > > > alignment to 8 byte is a must-have. So we have to do such alignment > > > anyway. > > >=20 > > > @Tom may fill in why libfdt commit commit 5e735860c478 ("libfdt: Check > > > for 8-byte address alignment in fdt_ro_probe_()") was made to have the > > > 8-byte alignment requirement. > >=20 > > Note that it's not so much since libfdt 1.6.1 but that since always the > > device tree has required 8 byte alignment. >=20 > DT alignment was always 4 byte , no ? I'm pretty sure, no, 8 byte base alignment is a pretty much always thing. I don't have a reference handy but I also know I couldn't have convinced dgibson to add the check otherwise. --=20 Tom --L/Z8CcqZ6itta5ah Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmDsYxAACgkQFHw5/5Y0 tyyzhAv/SzYBWzkie90HOtly462Yl0IyN252Eo1t8az9AD5zpHqoQMExYBWSs28d /7KGhYBdyFBuhOynpJutIIKyrJQr9i0+t5pu2Fk3kotHRewF9112iYQLA/T8Rb8M 4mCcYqdR2VS0kaeeZE4dlO9yzert4zt39jndZHvO0OWKF2yQ9K2cTuF7/611rNxt 2jqcmNGyno2JXLsXJnuvdUqUpf0bxlKTThpu432aK4VsvRx7PaJgq2HbGdM8gRMp 5kXtlOkJJGEclybvfea10wTfhxqO++dNiPpBAARfkFs74+/7H/h4cINZSlLI/8b3 jClprl9tKjsO3Phh8Q90LFYjTyfhD6HYGH2wa6Szk19XUUqiTcs/WK+PVTxJmm0B Q2+tyWSHb/TBIGFu8+B8LQoCdwbfSzd9+cKE4AiqYP04rNMNwajoXOGulyUBqZkk 2VUdUAW1zliWmgRhTeTdoArnYyigrFtV87Dpe7Fn1KA8ukz9KVUonXrqWJKdDuHA UpisZqeS =5R4r -----END PGP SIGNATURE----- --L/Z8CcqZ6itta5ah--