[PATCH v3 1/8] spl: fit: Drop 'length' argument to board_spl_fit_post_load()

Tom Rini
2021-01-18T16:59:08Z

On Mon, Jan 18, 2021 at 10:28:45AM -0600, Alex G. wrote:
> On 1/15/21 8:33 PM, Tom Rini wrote:
> > On Wed, Dec 23, 2020 at 08:44:05AM -0600, Alexandru Gagniuc wrote:
> >
> > > The size is derived from the FIT image itself. Any alignment
> > > requirements are machine-specific and known by the board code. Thus
> > > the total length can be derived from the FIT image and knowledge of
> > > the platform. The 'length' argument is redundant. Remove it.
> > >
> > > Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
> > > Reviewed-by: Peng Fan <peng.fan@nxp.com>
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > > ---
> > > arch/arm/mach-imx/spl.c | 5 +++--
> > > common/spl/spl_fit.c | 4 ++--
> > > include/spl.h | 4 ++--
> > > 3 files changed, 7 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> > > index aa2686bb92..11255798d3 100644
> > > --- a/arch/arm/mach-imx/spl.c
> > > +++ b/arch/arm/mach-imx/spl.c
> > > @@ -18,6 +18,7 @@
> > > #include <asm/mach-imx/hab.h>
> > > #include <asm/mach-imx/boot_mode.h>
> > > #include <g_dnl.h>
> > > +#include <linux/libfdt.h>
> > > DECLARE_GLOBAL_DATA_PTR;
> > > @@ -318,9 +319,9 @@ ulong board_spl_fit_size_align(ulong size)
> > > return size;
> > > }
> > > -void board_spl_fit_post_load(ulong load_addr, size_t length)
> > > +void board_spl_fit_post_load(const void *fit)
> > > {
> > > - u32 offset = length - CONFIG_CSF_SIZE;
> > > + u32 offset = ALIGN(fdt_totalsize(fit), 0x1000);
> > > if (imx_hab_authenticate_image(load_addr,
> > > offset + IVT_SIZE + CSF_PAD_SIZE,
> >
> > OK, this is a problem right here. First, the code no longer compiles as
> > we don't pass in "load_addr", which is what
> > imx_hab_authenticate_image() takes to know where in DDR the image is to
> > validate. While I could probably work out that value from what we use
> > now for offset, I would rather someone that can test the code do so.
> > Thanks!
> >
>
> Hi Tom,
>
> I'm sorry I missed that. I seemed to have, again, solved the hard problem
> and choked on something simple. Being able to eliminate the 'length'
> argument is essential simplifying the FIT code, and the rest of this series.
> Fixing the compilation issue is trivial, but how do we get this tested? Do
> you know someone with the hardware who'd be willing to give it a shot?

Actually, yes. Please cc Matt Porter on the next re-spin and he can run
a boot test on fused hardware. Thanks!

--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210118/ad7ccbb2/attachment.sig>