public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Marek Vasut <marex@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>,
	Reuben Dowle <reuben.dowle@4rf.com>,
	Simon Glass <sjg@chromium.org>,
	"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Re: [PATCH] spl: Align device tree blob address at 8-byte boundary
Date: Mon, 12 Jul 2021 11:43:16 -0400	[thread overview]
Message-ID: <20210712154316.GX9516@bill-the-cat> (raw)
In-Reply-To: <1fed7815-de64-27b4-77ed-4e888fb882da@denx.de>

[-- Attachment #1: Type: text/plain, Size: 2989 bytes --]

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 <reuben.dowle@4rf.com> wrote:
> > > > 
> > > > I submitted an almost identical patch. See https://github.com/u-boot/u-boot/commit/eb39d8ba5f0d1468b01b89a2a464d18612d3ea76
> > > > 
> > > > This patch eventually had to be reverted (https://github.com/u-boot/u-boot/commit/5675ed7cb645f5ec13958726992daeeed16fd114), because it was causing issues on some platforms that had FIT on 32 bit boundary. However I continue to use it in production code, as without it the boot on my platform aborts.
> > > > 
> > > > I don't have time to investigate why this was happening, but you need to check this code won't just cause exactly the same faults.
> > > 
> > > Thanks for your information.
> > > 
> > > +Marek who did the revert
> > > 
> > > The revert commit message says:
> > > 
> > >      "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."
> > > 
> > > 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?
> > 
> > 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.
> 
> 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
> 
> / {
>  prop1 = "string1";
>  prop2 = "string2";
> };
> 
> 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.
> 
> 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 with
> 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.
> 
> > > 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.
> > > 
> > > @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.
> > 
> > Note that it's not so much since libfdt 1.6.1 but that since always the
> > device tree has required 8 byte alignment.
> 
> 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.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2021-07-12 15:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12  3:52 [PATCH] spl: Align device tree blob address at 8-byte boundary Bin Meng
2021-07-12  5:21 ` Reuben Dowle
2021-07-12  5:36   ` Bin Meng
2021-07-12 15:15     ` Tom Rini
2021-07-12 15:38       ` Marek Vasut
2021-07-12 15:43         ` Tom Rini [this message]
2021-07-12 15:51           ` Marek Vasut
2021-07-12 16:02             ` Tom Rini
2021-07-12 16:09               ` Marek Vasut
2021-07-12 16:01       ` Alex G.
2021-07-12 19:46         ` Simon Glass
2021-07-13  3:09         ` Bin Meng
2021-07-13 13:47         ` Tom Rini
2021-07-13 14:35           ` Marek Vasut
2021-07-13 14:41             ` Tom Rini
2021-07-13 14:53               ` Marek Vasut
2021-07-13 16:47                 ` Simon Glass
2021-07-13 17:50                   ` Marek Vasut
2021-07-13 18:11                     ` Tom Rini
2021-07-13 20:35                       ` Marek Vasut
2021-07-13 20:46                         ` Alex G
2021-07-13 21:11                         ` Tom Rini
2021-07-26 13:26                           ` Bin Meng
2021-07-26 13:38                             ` Tom Rini
2021-07-13 21:06                       ` Alex G
2021-07-13 17:20         ` Tom Rini
2021-07-13  3:00       ` Bin Meng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210712154316.GX9516@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=bmeng.cn@gmail.com \
    --cc=marex@denx.de \
    --cc=reuben.dowle@4rf.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox