[PATCH 11/14] bloblist: Reduce blob-header size
Julius Werner
jwerner at chromium.org
Wed Jul 26 22:20:01 CEST 2023
> - rec->tag = tag;
> - rec->hdr_size = sizeof(struct bloblist_rec);
> + rec->tag_and_hdr_size = tag | sizeof(*rec) << BLOBLISTR_HDR_SIZE_SHIFT;
nit: Might be a good idea to mask the tag or double-check that it fits
the field size here.
> - * 5. Bloblist uses 16-byte alignment internally and is designed to start on a
> - * 16-byte boundary. Its headers are multiples of 16 bytes. This makes it easier
> - * to deal with data structures which need this level of alignment, such as ACPI
> - * tables. For use in SPL and TPL the alignment can be relaxed, since it can be
> - * relocated to an aligned address in U-Boot proper.
> + * 5. Bloblist uses 8-byte alignment internally and is designed to start on a
> + * 8-byte boundary. Its headers are 8 bytes long. It is possible to achieve
> + * larger alignment (e.g. 16 bytes) by adding a dummy header, For use in SPL and
nit: I would call it a "dummy entry", it's not always just a header.
> + BLOBLIST_BLOB_ALIGN_LOG2 = 3,
> + BLOBLIST_BLOB_ALIGN = 1 << BLOBLIST_BLOB_ALIGN_LOG2,
> +
> BLOBLIST_ALIGN_LOG2 = 4,
> BLOBLIST_ALIGN = 1 << BLOBLIST_ALIGN_LOG2,
> };
> @@ -181,17 +184,25 @@ struct bloblist_hdr {
Note that there's no specific requirement for the TL header to be
aligned to 16 bytes. Even though it is 16 bytes long, 8 bytes
alignment is enough (so you shouldn't really need a BLOBLIST_ALIGN
that's different from BLOBLIST_BLOB_ALIGN).
There's also some text above this in the docstring for this struct
that refers to 16 bytes and should be updated. (I would recommend also
updating the "it can be safely moved around" part to point to the
instructions for relocation in the firmware_handoff spec, since while
it can be relocated, special care must be taken to preserve alignment
restrictions.
More information about the U-Boot
mailing list