[PATCH 12/14] bloblist: Reduce bloblist header size

Simon Glass sjg at chromium.org
Wed Aug 2 23:31:41 CEST 2023


Hi Jose,

On Wed, 2 Aug 2023 at 04:15, Jose Marinho <Jose.Marinho at arm.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Simon Glass <sjg at chromium.org>
> > Sent: Tuesday, July 25, 2023 10:36 PM
> > To: U-Boot Mailing List <u-boot at lists.denx.de>
> > Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>; Tom Rini
> > <trini at konsulko.com>; Julius Werner <jwerner at chromium.org>; Dan Handley
> > <Dan.Handley at arm.com>; Jose Marinho <Jose.Marinho at arm.com>; Simon
> > Glass <sjg at chromium.org>; Bin Meng <bmeng.cn at gmail.com>; Nikhil M Jain <n-
> > jain1 at ti.com>
> > Subject: [PATCH 12/14] bloblist: Reduce bloblist header size
> >
> > The v0.9 spec provides for a 16-byte header with fewer fields. Update the
> > implementation to match this.
> >
> > This also adds an alignment field.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >  include/bloblist.h | 26 +++++++++++++-------------
> >  test/bloblist.c    |  6 +++---
> >  2 files changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/include/bloblist.h b/include/bloblist.h index
> > d1e52cf888f..13b619cd019 100644
> > --- a/include/bloblist.h
> > +++ b/include/bloblist.h
> > @@ -150,30 +150,30 @@ enum bloblist_tag_t {
> >   * from the last.
> >   *
> >   * @magic: BLOBLIST_MAGIC
> > + * @chksum: checksum for the entire bloblist allocated area. Since any of the
> > + *   blobs can be altered after being created, this checksum is only valid
> > + *   when the bloblist is finalised before jumping to the next stage of boot.
> > + *   This is the value needed to make all chechksummed bytes sum to 0
> >   * @version: BLOBLIST_VERSION
> >   * @hdr_size: Size of this header, normally sizeof(struct bloblist_hdr). The
> >   *   first bloblist_rec starts at this offset from the start of the header
> > - * @size: Total size of the bloblist (non-zero if valid) including this header.
> > - *   The bloblist extends for this many bytes from the start of this header.
> > - *   When adding new records, the bloblist can grow up to this size.
> > + * @align_log2: Power of two of the maximum alignment required by this
> > + list
> >   * @alloced: Total size allocated so far for this bloblist. This starts out as
> >   *   sizeof(bloblist_hdr) since we need at least that much space to store a
> >   *   valid bloblist
> > - * @chksum: checksum for the entire bloblist allocated area. Since any of the
> > - *   blobs can be altered after being created, this checksum is only valid
> > - *   when the bloblist is finalised before jumping to the next stage of boot.
> > - *   This is the value needed to make all checksummed bytes sum to 0
> > + * @size: Total size of the bloblist (non-zero if valid) including this header.
> > + *   The bloblist extends for this many bytes from the start of this header.
> > + *   When adding new records, the bloblist can grow up to this size.
> >   */
> >  struct bloblist_hdr {
> >       u32 magic;
> > -     u32 version;
> > -     u32 hdr_size;
> > -     u32 _flags;
> > +     u8 chksum;
> > +     u8 version;
> > +     u8 hdr_size;
> > +     u8 align_log2;
> >
> > -     u32 size;
> >       u32 alloced;
> > -     u32 _spare;
> > -     u32 chksum;
> > +     u32 size;
> >  };
>
> Being (overly) cautious, does it make sense for this struct to be __packed?

I prefer not, since we require it to be aligned and don't want the
compiler adding unnecessary access code.

Regards,
Simon


More information about the U-Boot mailing list