[PATCH] spl: Align device tree blob address at 8-byte boundary

Bin Meng bmeng.cn at gmail.com
Tue Jul 13 05:00:25 CEST 2021


On Mon, Jul 12, 2021 at 11:15 PM Tom Rini <trini at konsulko.com> 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 at 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.
>
> > 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.  It's just that on 32bit
> platforms 4-but-not-8 byte alignment tends to not be fatal but on 64bit
> platforms it is.

But with libfdt v1.6.1 commit 5e735860c478 ("libfdt: Check for 8-byte
address alignment in fdt_ro_probe_()"), now this is fatal error if DT
address is not 8-bytes aligned, as that commit adds a check in
fdt_ro_probe_().

Regards,
Bin


More information about the U-Boot mailing list