[PATCH v3 00/14] Support Firmware Handoff spec via bloblist

Major changes:
Update bloblist to align to Firmware Handoff spec v0.9 (up to commit #3592349 of the spec) (https://github.com/FirmwareHandoff/firmware_handoff).
Includes: - Align bloblist tags with the FW handoff spec - Add an explicit alignment field in the header - Update bloblist magic and version - Use a packed format for blob record header - Change the checksum alorigthm - Use a void entry to handle the alignment - Adjust the headers of bloblist and blob record - Align the bloblist record data section start address
In v3, the implementation from boot arguments to bloblist and how to load the FDT from the bloblist are moved to a forthcoming patch serie.
Raymond Mao (1): bloblist: Align bloblist used_size and total_size to spec
Simon Glass (13): bloblist: Update the tag numbering bloblist: Adjust API to align in powers of 2 bloblist: Change the magic value bloblist: Set version to 1 bloblist: Access record hdr_size and tag via a function bloblist: Drop spare value from bloblist record bloblist: Change the checksum algorithm bloblist: Checksum the entire bloblist bloblist: Handle alignment with a void entry bloblist: Reduce blob-header size bloblist: Adjust the bloblist header bloblist: Add alignment to bloblist_new() bloblist: Update documentation and header comment
arch/x86/lib/tables.c | 3 +- common/bloblist.c | 205 ++++++++++++++++++++++++--------------- doc/develop/bloblist.rst | 4 +- include/bloblist.h | 166 ++++++++++++++++++------------- test/bloblist.c | 105 +++++++++++--------- 5 files changed, 287 insertions(+), 196 deletions(-)

From: Simon Glass sjg@chromium.org
Align bloblist tags with the FW handoff spec v0.9. The most common ones are from 0. TF related ones are from 0x100. All non-standard ones from 0xfff000.
Added new defined tags: BLOBLISTT_OPTEE_PAGABLE_PART for TF. BLOBLISTT_TPM_EVLOG and BLOBLISTT_TPM_CRB_BASE for TPM.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v2 - Align bloblist tags to FW handoff spec v0.9. Changes in v3 - Add TPM related tags
common/bloblist.c | 18 ++++++++++--- include/bloblist.h | 67 +++++++++++++++++++++++++--------------------- test/bloblist.c | 4 +-- 3 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index a22f6c12b0..5606487f5b 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -36,16 +36,26 @@ static struct tag_name { enum bloblist_tag_t tag; const char *name; } tag_name[] = { - { BLOBLISTT_NONE, "(none)" }, + { BLOBLISTT_VOID, "(void)" },
/* BLOBLISTT_AREA_FIRMWARE_TOP */ + { BLOBLISTT_CONTROL_FDT, "Control FDT" }, + { BLOBLISTT_HOB_BLOCK, "HOB block" }, + { BLOBLISTT_HOB_LIST, "HOB list" }, + { BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" }, + { BLOBLISTT_TPM_EVLOG, "TPM event log defined by TCG EFI" }, + { BLOBLISTT_TPM_CRB_BASE, "TPM Command Response Buffer address" },
/* BLOBLISTT_AREA_FIRMWARE */ - { BLOBLISTT_ACPI_GNVS, "ACPI GNVS" }, - { BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_TPM2_TCG_LOG, "TPM v2 log space" }, { BLOBLISTT_TCPA_LOG, "TPM log space" }, - { BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" }, + { BLOBLISTT_ACPI_GNVS, "ACPI GNVS" }, + + /* BLOBLISTT_AREA_TF */ + { BLOBLISTT_OPTEE_PAGABLE_PART, "OP-TEE pagable part" }, + + /* BLOBLISTT_AREA_OTHER */ + { BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" }, { BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
diff --git a/include/bloblist.h b/include/bloblist.h index 080cc46a12..92dbfda21b 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -81,7 +81,7 @@ enum {
/* Supported tags - add new ones to tag_name in bloblist.c */ enum bloblist_tag_t { - BLOBLISTT_NONE = 0, + BLOBLISTT_VOID = 0,
/* * Standard area to allocate blobs used across firmware components, for @@ -89,42 +89,36 @@ enum bloblist_tag_t { * projects. */ BLOBLISTT_AREA_FIRMWARE_TOP = 0x1, + /* + * Devicetree for use by firmware. On some platforms this is passed to + * the OS also + */ + BLOBLISTT_CONTROL_FDT = 1, + BLOBLISTT_HOB_BLOCK = 2, + BLOBLISTT_HOB_LIST = 3, + BLOBLISTT_ACPI_TABLES = 4, + BLOBLISTT_TPM_EVLOG = 5, + BLOBLISTT_TPM_CRB_BASE = 6,
/* Standard area to allocate blobs used across firmware components */ - BLOBLISTT_AREA_FIRMWARE = 0x100, + BLOBLISTT_AREA_FIRMWARE = 0x10, + BLOBLISTT_TPM2_TCG_LOG = 0x10, /* TPM v2 log space */ + BLOBLISTT_TCPA_LOG = 0x11, /* TPM log space */ /* * Advanced Configuration and Power Interface Global Non-Volatile * Sleeping table. This forms part of the ACPI tables passed to Linux. */ - BLOBLISTT_ACPI_GNVS = 0x100, - BLOBLISTT_INTEL_VBT = 0x101, /* Intel Video-BIOS table */ - BLOBLISTT_TPM2_TCG_LOG = 0x102, /* TPM v2 log space */ - BLOBLISTT_TCPA_LOG = 0x103, /* TPM log space */ - BLOBLISTT_ACPI_TABLES = 0x104, /* ACPI tables for x86 */ - BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */ - BLOBLISTT_VBOOT_CTX = 0x106, /* Chromium OS verified boot context */ + BLOBLISTT_ACPI_GNVS = 0x12,
- /* - * Project-specific tags are permitted here. Projects can be open source - * or not, but the format of the data must be fuily documented in an - * open source project, including all fields, bits, etc. Naming should - * be: BLOBLISTT_<project>_<purpose_here> - */ - BLOBLISTT_PROJECT_AREA = 0x8000, - BLOBLISTT_U_BOOT_SPL_HANDOFF = 0x8000, /* Hand-off info from SPL */ - BLOBLISTT_VBE = 0x8001, /* VBE per-phase state */ - BLOBLISTT_U_BOOT_VIDEO = 0x8002, /* Video information from SPL */ - - /* - * Vendor-specific tags are permitted here. Projects can be open source - * or not, but the format of the data must be fuily documented in an - * open source project, including all fields, bits, etc. Naming should - * be BLOBLISTT_<vendor>_<purpose_here> - */ - BLOBLISTT_VENDOR_AREA = 0xc000, + /* Standard area to allocate blobs used for Trusted Firmware */ + BLOBLISTT_AREA_TF = 0x100, + BLOBLISTT_OPTEE_PAGABLE_PART = 0x100,
- /* Tags after this are not allocated for now */ - BLOBLISTT_EXPANSION = 0x10000, + /* Other standard area to allocate blobs */ + BLOBLISTT_AREA_OTHER = 0x200, + BLOBLISTT_INTEL_VBT = 0x200, /* Intel Video-BIOS table */ + BLOBLISTT_SMBIOS_TABLES = 0x201, /* SMBIOS tables for x86 */ + BLOBLISTT_VBOOT_CTX = 0x202, /* Chromium OS verified boot context */
/* * Tags from here are on reserved for private use within a single @@ -133,9 +127,20 @@ enum bloblist_tag_t { * implementation, but cannot be used in upstream code. Allocate a * tag in one of the areas above if you want that. * - * This area may move in future. + * Project-specific tags are permitted here. Projects can be open source + * or not, but the format of the data must be fuily documented in an + * open source project, including all fields, bits, etc. Naming should + * be: BLOBLISTT_<project>_<purpose_here> + * + * Vendor-specific tags are also permitted. Projects can be open source + * or not, but the format of the data must be fuily documented in an + * open source project, including all fields, bits, etc. Naming should + * be BLOBLISTT_<vendor>_<purpose_here> */ - BLOBLISTT_PRIVATE_AREA = 0xffff0000, + BLOBLISTT_PRIVATE_AREA = 0xfff000, + BLOBLISTT_U_BOOT_SPL_HANDOFF = 0xfff000, /* Hand-off info from SPL */ + BLOBLISTT_VBE = 0xfff001, /* VBE per-phase state */ + BLOBLISTT_U_BOOT_VIDEO = 0xfff002, /* Video info from SPL */ };
/** diff --git a/test/bloblist.c b/test/bloblist.c index 720be7e244..efa1e32afd 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -291,9 +291,9 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts) console_record_reset(); run_command("bloblist list", 0); ut_assert_nextline("Address Size Tag Name"); - ut_assert_nextline("%08lx %8x 8000 SPL hand-off", + ut_assert_nextline("%08lx %8x fff000 SPL hand-off", (ulong)map_to_sysmem(data), TEST_SIZE); - ut_assert_nextline("%08lx %8x 106 Chrome OS vboot context", + ut_assert_nextline("%08lx %8x 202 Chrome OS vboot context", (ulong)map_to_sysmem(data2), TEST_SIZE2); ut_assert_console_end(); ut_unsilence_console(uts);

Hi Raymond,
On Mon, 18 Dec 2023 at 20:19, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Align bloblist tags with the FW handoff spec v0.9. The most common ones are from 0. TF related ones are from 0x100. All non-standard ones from 0xfff000.
Added new defined tags: BLOBLISTT_OPTEE_PAGABLE_PART for TF. BLOBLISTT_TPM_EVLOG and BLOBLISTT_TPM_CRB_BASE for TPM.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v2
- Align bloblist tags to FW handoff spec v0.9.
Changes in v3
- Add TPM related tags
common/bloblist.c | 18 ++++++++++--- include/bloblist.h | 67 +++++++++++++++++++++++++--------------------- test/bloblist.c | 4 +-- 3 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index a22f6c12b0..5606487f5b 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -36,16 +36,26 @@ static struct tag_name { enum bloblist_tag_t tag; const char *name; } tag_name[] = {
{ BLOBLISTT_NONE, "(none)" },
{ BLOBLISTT_VOID, "(void)" }, /* BLOBLISTT_AREA_FIRMWARE_TOP */
{ BLOBLISTT_CONTROL_FDT, "Control FDT" },
{ BLOBLISTT_HOB_BLOCK, "HOB block" },
{ BLOBLISTT_HOB_LIST, "HOB list" },
{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
{ BLOBLISTT_TPM_EVLOG, "TPM event log defined by TCG EFI" },
{ BLOBLISTT_TPM_CRB_BASE, "TPM Command Response Buffer address" }, /* BLOBLISTT_AREA_FIRMWARE */
{ BLOBLISTT_ACPI_GNVS, "ACPI GNVS" },
{ BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_TPM2_TCG_LOG, "TPM v2 log space" }, { BLOBLISTT_TCPA_LOG, "TPM log space" },
{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
{ BLOBLISTT_ACPI_GNVS, "ACPI GNVS" },
/* BLOBLISTT_AREA_TF */
{ BLOBLISTT_OPTEE_PAGABLE_PART, "OP-TEE pagable part" },
/* BLOBLISTT_AREA_OTHER */
{ BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" }, { BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
diff --git a/include/bloblist.h b/include/bloblist.h index 080cc46a12..92dbfda21b 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -81,7 +81,7 @@ enum {
/* Supported tags - add new ones to tag_name in bloblist.c */ enum bloblist_tag_t {
BLOBLISTT_NONE = 0,
BLOBLISTT_VOID = 0, /* * Standard area to allocate blobs used across firmware components, for
@@ -89,42 +89,36 @@ enum bloblist_tag_t { * projects. */ BLOBLISTT_AREA_FIRMWARE_TOP = 0x1,
/*
* Devicetree for use by firmware. On some platforms this is passed to
* the OS also
*/
BLOBLISTT_CONTROL_FDT = 1,
BLOBLISTT_HOB_BLOCK = 2,
BLOBLISTT_HOB_LIST = 3,
BLOBLISTT_ACPI_TABLES = 4,
BLOBLISTT_TPM_EVLOG = 5,
BLOBLISTT_TPM_CRB_BASE = 6, /* Standard area to allocate blobs used across firmware components */
BLOBLISTT_AREA_FIRMWARE = 0x100,
BLOBLISTT_AREA_FIRMWARE = 0x10,
BLOBLISTT_TPM2_TCG_LOG = 0x10, /* TPM v2 log space */
BLOBLISTT_TCPA_LOG = 0x11, /* TPM log space */ /* * Advanced Configuration and Power Interface Global Non-Volatile * Sleeping table. This forms part of the ACPI tables passed to Linux. */
BLOBLISTT_ACPI_GNVS = 0x100,
BLOBLISTT_INTEL_VBT = 0x101, /* Intel Video-BIOS table */
BLOBLISTT_TPM2_TCG_LOG = 0x102, /* TPM v2 log space */
BLOBLISTT_TCPA_LOG = 0x103, /* TPM log space */
BLOBLISTT_ACPI_TABLES = 0x104, /* ACPI tables for x86 */
BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
BLOBLISTT_VBOOT_CTX = 0x106, /* Chromium OS verified boot context */
BLOBLISTT_ACPI_GNVS = 0x12,
Any idea if we have users that would be affected by this value change?
[...]
Thanks /Ilias

Hi Ilias,
On Wed, 27 Dec 2023 at 04:48, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
Hi Raymond,
On Mon, 18 Dec 2023 at 20:19, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Align bloblist tags with the FW handoff spec v0.9. The most common ones are from 0. TF related ones are from 0x100. All non-standard ones from 0xfff000.
Added new defined tags: BLOBLISTT_OPTEE_PAGABLE_PART for TF. BLOBLISTT_TPM_EVLOG and BLOBLISTT_TPM_CRB_BASE for TPM.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v2
- Align bloblist tags to FW handoff spec v0.9.
Changes in v3
- Add TPM related tags
common/bloblist.c | 18 ++++++++++--- include/bloblist.h | 67 +++++++++++++++++++++++++--------------------- test/bloblist.c | 4 +-- 3 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index a22f6c12b0..5606487f5b 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -36,16 +36,26 @@ static struct tag_name { enum bloblist_tag_t tag; const char *name; } tag_name[] = {
{ BLOBLISTT_NONE, "(none)" },
{ BLOBLISTT_VOID, "(void)" }, /* BLOBLISTT_AREA_FIRMWARE_TOP */
{ BLOBLISTT_CONTROL_FDT, "Control FDT" },
{ BLOBLISTT_HOB_BLOCK, "HOB block" },
{ BLOBLISTT_HOB_LIST, "HOB list" },
{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
{ BLOBLISTT_TPM_EVLOG, "TPM event log defined by TCG EFI" },
{ BLOBLISTT_TPM_CRB_BASE, "TPM Command Response Buffer address"
},
/* BLOBLISTT_AREA_FIRMWARE */
{ BLOBLISTT_ACPI_GNVS, "ACPI GNVS" },
{ BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_TPM2_TCG_LOG, "TPM v2 log space" }, { BLOBLISTT_TCPA_LOG, "TPM log space" },
{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
{ BLOBLISTT_ACPI_GNVS, "ACPI GNVS" },
/* BLOBLISTT_AREA_TF */
{ BLOBLISTT_OPTEE_PAGABLE_PART, "OP-TEE pagable part" },
/* BLOBLISTT_AREA_OTHER */
{ BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" }, { BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
diff --git a/include/bloblist.h b/include/bloblist.h index 080cc46a12..92dbfda21b 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -81,7 +81,7 @@ enum {
/* Supported tags - add new ones to tag_name in bloblist.c */ enum bloblist_tag_t {
BLOBLISTT_NONE = 0,
BLOBLISTT_VOID = 0, /* * Standard area to allocate blobs used across firmware
components, for
@@ -89,42 +89,36 @@ enum bloblist_tag_t { * projects. */ BLOBLISTT_AREA_FIRMWARE_TOP = 0x1,
/*
* Devicetree for use by firmware. On some platforms this is
passed to
* the OS also
*/
BLOBLISTT_CONTROL_FDT = 1,
BLOBLISTT_HOB_BLOCK = 2,
BLOBLISTT_HOB_LIST = 3,
BLOBLISTT_ACPI_TABLES = 4,
BLOBLISTT_TPM_EVLOG = 5,
BLOBLISTT_TPM_CRB_BASE = 6, /* Standard area to allocate blobs used across firmware
components */
BLOBLISTT_AREA_FIRMWARE = 0x100,
BLOBLISTT_AREA_FIRMWARE = 0x10,
BLOBLISTT_TPM2_TCG_LOG = 0x10, /* TPM v2 log space */
BLOBLISTT_TCPA_LOG = 0x11, /* TPM log space */ /* * Advanced Configuration and Power Interface Global Non-Volatile * Sleeping table. This forms part of the ACPI tables passed to
Linux.
*/
BLOBLISTT_ACPI_GNVS = 0x100,
BLOBLISTT_INTEL_VBT = 0x101, /* Intel Video-BIOS table */
BLOBLISTT_TPM2_TCG_LOG = 0x102, /* TPM v2 log space */
BLOBLISTT_TCPA_LOG = 0x103, /* TPM log space */
BLOBLISTT_ACPI_TABLES = 0x104, /* ACPI tables for x86 */
BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
BLOBLISTT_VBOOT_CTX = 0x106, /* Chromium OS verified boot
context */
BLOBLISTT_ACPI_GNVS = 0x12,
Any idea if we have users that would be affected by this value change?
BLOBLISTT_ACPI_TABLES, BLOBLISTT_TPM2_TCG_LOG and BLOBLISTT_ACPI_TABLES
are being used by x86. BLOBLISTT_ACPI_GNVS is being used by x86 and chromebook.
Regards, Raymond

Hi Ilias,
On Wed, Dec 27, 2023 at 9:48 AM Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
Hi Raymond,
On Mon, 18 Dec 2023 at 20:19, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Align bloblist tags with the FW handoff spec v0.9. The most common ones are from 0. TF related ones are from 0x100. All non-standard ones from 0xfff000.
Added new defined tags: BLOBLISTT_OPTEE_PAGABLE_PART for TF. BLOBLISTT_TPM_EVLOG and BLOBLISTT_TPM_CRB_BASE for TPM.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v2
- Align bloblist tags to FW handoff spec v0.9.
Changes in v3
- Add TPM related tags
common/bloblist.c | 18 ++++++++++--- include/bloblist.h | 67 +++++++++++++++++++++++++--------------------- test/bloblist.c | 4 +-- 3 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index a22f6c12b0..5606487f5b 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -36,16 +36,26 @@ static struct tag_name { enum bloblist_tag_t tag; const char *name; } tag_name[] = {
{ BLOBLISTT_NONE, "(none)" },
{ BLOBLISTT_VOID, "(void)" }, /* BLOBLISTT_AREA_FIRMWARE_TOP */
{ BLOBLISTT_CONTROL_FDT, "Control FDT" },
{ BLOBLISTT_HOB_BLOCK, "HOB block" },
{ BLOBLISTT_HOB_LIST, "HOB list" },
{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
{ BLOBLISTT_TPM_EVLOG, "TPM event log defined by TCG EFI" },
{ BLOBLISTT_TPM_CRB_BASE, "TPM Command Response Buffer address" }, /* BLOBLISTT_AREA_FIRMWARE */
{ BLOBLISTT_ACPI_GNVS, "ACPI GNVS" },
{ BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_TPM2_TCG_LOG, "TPM v2 log space" }, { BLOBLISTT_TCPA_LOG, "TPM log space" },
{ BLOBLISTT_ACPI_TABLES, "ACPI tables for x86" },
{ BLOBLISTT_ACPI_GNVS, "ACPI GNVS" },
/* BLOBLISTT_AREA_TF */
{ BLOBLISTT_OPTEE_PAGABLE_PART, "OP-TEE pagable part" },
/* BLOBLISTT_AREA_OTHER */
{ BLOBLISTT_INTEL_VBT, "Intel Video-BIOS table" }, { BLOBLISTT_SMBIOS_TABLES, "SMBIOS tables for x86" }, { BLOBLISTT_VBOOT_CTX, "Chrome OS vboot context" },
diff --git a/include/bloblist.h b/include/bloblist.h index 080cc46a12..92dbfda21b 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -81,7 +81,7 @@ enum {
/* Supported tags - add new ones to tag_name in bloblist.c */ enum bloblist_tag_t {
BLOBLISTT_NONE = 0,
BLOBLISTT_VOID = 0, /* * Standard area to allocate blobs used across firmware components, for
@@ -89,42 +89,36 @@ enum bloblist_tag_t { * projects. */ BLOBLISTT_AREA_FIRMWARE_TOP = 0x1,
/*
* Devicetree for use by firmware. On some platforms this is passed to
* the OS also
*/
BLOBLISTT_CONTROL_FDT = 1,
BLOBLISTT_HOB_BLOCK = 2,
BLOBLISTT_HOB_LIST = 3,
BLOBLISTT_ACPI_TABLES = 4,
BLOBLISTT_TPM_EVLOG = 5,
BLOBLISTT_TPM_CRB_BASE = 6, /* Standard area to allocate blobs used across firmware components */
BLOBLISTT_AREA_FIRMWARE = 0x100,
BLOBLISTT_AREA_FIRMWARE = 0x10,
BLOBLISTT_TPM2_TCG_LOG = 0x10, /* TPM v2 log space */
BLOBLISTT_TCPA_LOG = 0x11, /* TPM log space */ /* * Advanced Configuration and Power Interface Global Non-Volatile * Sleeping table. This forms part of the ACPI tables passed to Linux. */
BLOBLISTT_ACPI_GNVS = 0x100,
BLOBLISTT_INTEL_VBT = 0x101, /* Intel Video-BIOS table */
BLOBLISTT_TPM2_TCG_LOG = 0x102, /* TPM v2 log space */
BLOBLISTT_TCPA_LOG = 0x103, /* TPM log space */
BLOBLISTT_ACPI_TABLES = 0x104, /* ACPI tables for x86 */
BLOBLISTT_SMBIOS_TABLES = 0x105, /* SMBIOS tables for x86 */
BLOBLISTT_VBOOT_CTX = 0x106, /* Chromium OS verified boot context */
BLOBLISTT_ACPI_GNVS = 0x12,
Any idea if we have users that would be affected by this value change?
I suppose it is possible, but bloblist has so far been intended for internal U-Boot use, so perhaps not? In any case, there isn't much we can do about it.
Regards, Simon

From: Simon Glass sjg@chromium.org
The updated bloblist structure stores the alignment as a power-of-two value in its structures. Adjust the API to use this, to avoid needing to calling ilog2().
Drop a stale comment while we are here.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org --- Changes in v2 - Update the bloblist alignment to align to FW handoff spec v0.9.
arch/x86/lib/tables.c | 3 ++- common/bloblist.c | 24 +++++++++++------------- include/bloblist.h | 12 +++++++----- test/bloblist.c | 4 ++-- 4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c index 5b5070f7ca..d43e77d373 100644 --- a/arch/x86/lib/tables.c +++ b/arch/x86/lib/tables.c @@ -16,6 +16,7 @@ #include <asm/mpspec.h> #include <asm/tables.h> #include <asm/coreboot_tables.h> +#include <linux/log2.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -104,7 +105,7 @@ int write_tables(void) if (!gd->arch.table_end) gd->arch.table_end = rom_addr; rom_addr = (ulong)bloblist_add(table->tag, size, - table->align); + ilog2(table->align)); if (!rom_addr) return log_msg_ret("bloblist", -ENOBUFS);
diff --git a/common/bloblist.c b/common/bloblist.c index 5606487f5b..1e78a3d4b3 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -26,8 +26,6 @@ * start address of the data in each blob is aligned as required. Note that * each blob's *data* is aligned to BLOBLIST_ALIGN regardless of the alignment * of the bloblist itself or the blob header. - * - * So far, only BLOBLIST_ALIGN alignment is supported. */
DECLARE_GLOBAL_DATA_PTR; @@ -128,24 +126,24 @@ static struct bloblist_rec *bloblist_findrec(uint tag) return NULL; }
-static int bloblist_addrec(uint tag, int size, int align, +static int bloblist_addrec(uint tag, int size, int align_log2, struct bloblist_rec **recp) { struct bloblist_hdr *hdr = gd->bloblist; struct bloblist_rec *rec; int data_start, new_alloced;
- if (!align) - align = BLOBLIST_ALIGN; + if (!align_log2) + align_log2 = BLOBLIST_ALIGN_LOG2;
/* Figure out where the new data will start */ data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*rec);
/* Align the address and then calculate the offset from ->alloced */ - data_start = ALIGN(data_start, align) - map_to_sysmem(hdr); + data_start = ALIGN(data_start, 1U << align_log2) - map_to_sysmem(hdr);
/* Calculate the new allocated total */ - new_alloced = data_start + ALIGN(size, align); + new_alloced = data_start + ALIGN(size, 1U << align_log2);
if (new_alloced > hdr->size) { log_err("Failed to allocate %x bytes size=%x, need size=%x\n", @@ -169,7 +167,7 @@ static int bloblist_addrec(uint tag, int size, int align, }
static int bloblist_ensurerec(uint tag, struct bloblist_rec **recp, int size, - int align) + int align_log2) { struct bloblist_rec *rec;
@@ -182,7 +180,7 @@ static int bloblist_ensurerec(uint tag, struct bloblist_rec **recp, int size, } else { int ret;
- ret = bloblist_addrec(tag, size, align, &rec); + ret = bloblist_addrec(tag, size, align_log2, &rec); if (ret) return ret; } @@ -204,22 +202,22 @@ void *bloblist_find(uint tag, int size) return (void *)rec + rec->hdr_size; }
-void *bloblist_add(uint tag, int size, int align) +void *bloblist_add(uint tag, int size, int align_log2) { struct bloblist_rec *rec;
- if (bloblist_addrec(tag, size, align, &rec)) + if (bloblist_addrec(tag, size, align_log2, &rec)) return NULL;
return (void *)rec + rec->hdr_size; }
-int bloblist_ensure_size(uint tag, int size, int align, void **blobp) +int bloblist_ensure_size(uint tag, int size, int align_log2, void **blobp) { struct bloblist_rec *rec; int ret;
- ret = bloblist_ensurerec(tag, &rec, size, align); + ret = bloblist_ensurerec(tag, &rec, size, align_log2); if (ret) return ret; *blobp = (void *)rec + rec->hdr_size; diff --git a/include/bloblist.h b/include/bloblist.h index 92dbfda21b..5ad1337d1f 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -76,7 +76,9 @@ enum { BLOBLIST_VERSION = 0, BLOBLIST_MAGIC = 0xb00757a3, - BLOBLIST_ALIGN = 16, + + BLOBLIST_ALIGN_LOG2 = 3, + BLOBLIST_ALIGN = 1 << BLOBLIST_ALIGN_LOG2, };
/* Supported tags - add new ones to tag_name in bloblist.c */ @@ -254,11 +256,11 @@ void *bloblist_find(uint tag, int size); * * @tag: Tag to add (enum bloblist_tag_t) * @size: Size of the blob - * @align: Alignment of the blob (in bytes), 0 for default + * @align_log2: Alignment of the blob (in bytes log2), 0 for default * Return: pointer to the newly added block, or NULL if there is not enough * space for the blob */ -void *bloblist_add(uint tag, int size, int align); +void *bloblist_add(uint tag, int size, int align_log2);
/** * bloblist_ensure_size() - Find or add a blob @@ -268,11 +270,11 @@ void *bloblist_add(uint tag, int size, int align); * @tag: Tag to add (enum bloblist_tag_t) * @size: Size of the blob * @blobp: Returns a pointer to blob on success - * @align: Alignment of the blob (in bytes), 0 for default + * @align_log2: Alignment of the blob (in bytes log2), 0 for default * Return: 0 if OK, -ENOSPC if it is missing and could not be added due to lack * of space, or -ESPIPE it exists but has the wrong size */ -int bloblist_ensure_size(uint tag, int size, int align, void **blobp); +int bloblist_ensure_size(uint tag, int size, int align_log2, void **blobp);
/** * bloblist_ensure() - Find or add a blob diff --git a/test/bloblist.c b/test/bloblist.c index efa1e32afd..8b435e27ca 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -336,7 +336,7 @@ static int bloblist_test_align(struct unit_test_state *uts)
/* Check larger alignment */ for (i = 0; i < 3; i++) { - int align = 32 << i; + int align = 5 - i;
data = bloblist_add(3 + i, i * 4, align); ut_assertnonnull(data); @@ -351,7 +351,7 @@ static int bloblist_test_align(struct unit_test_state *uts) ut_assertok(bloblist_new(TEST_ADDR + BLOBLIST_ALIGN, TEST_BLOBLIST_SIZE, 0));
- data = bloblist_add(1, 5, BLOBLIST_ALIGN * 2); + data = bloblist_add(1, 5, BLOBLIST_ALIGN_LOG2 + 1); ut_assertnonnull(data); addr = map_to_sysmem(data); ut_asserteq(0, addr & (BLOBLIST_ALIGN * 2 - 1));

Hi,
On Mon, 18 Dec 2023 at 20:19, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
The updated bloblist structure stores the alignment as a power-of-two value in its structures. Adjust the API to use this, to avoid needing to calling ilog2().
Drop a stale comment while we are here.
The patch does more than what the description suggests. So either the new 8b alignment is wrong or the commit message needs and update and explain why we are changing this.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org
[...]
Thanks /Ilias

Hi Ilias,
On Wed, 27 Dec 2023 at 04:53, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
Hi,
On Mon, 18 Dec 2023 at 20:19, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
The updated bloblist structure stores the alignment as a power-of-two value in its structures. Adjust the API to use this, to avoid needing to calling ilog2().
Drop a stale comment while we are here.
The patch does more than what the description suggests. So either the new 8b alignment is wrong or the commit message needs and update and explain why we are changing this.
The 8-byte-alignment is correct and matching with the spec.
I will update the commit message.
[...]
Regards, Raymond

From: Simon Glass sjg@chromium.org
This uses a new value with spec v0.9 so change it.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v2 - Update the bloblist magic to align to FW handoff spec v0.9. Changes in v3 - Update the bloblist magic to align to FW handoff spec up to commit 3592349.
include/bloblist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/bloblist.h b/include/bloblist.h index 5ad1337d1f..72c785411d 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -75,7 +75,7 @@
enum { BLOBLIST_VERSION = 0, - BLOBLIST_MAGIC = 0xb00757a3, + BLOBLIST_MAGIC = 0x4a0fb10b,
BLOBLIST_ALIGN_LOG2 = 3, BLOBLIST_ALIGN = 1 << BLOBLIST_ALIGN_LOG2,

On Mon, 18 Dec 2023 at 20:19, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
This uses a new value with spec v0.9 so change it.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v2
- Update the bloblist magic to align to FW handoff spec v0.9.
Changes in v3
- Update the bloblist magic to align to FW handoff spec up to commit 3592349.
include/bloblist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/bloblist.h b/include/bloblist.h index 5ad1337d1f..72c785411d 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -75,7 +75,7 @@
enum { BLOBLIST_VERSION = 0,
BLOBLIST_MAGIC = 0xb00757a3,
BLOBLIST_MAGIC = 0x4a0fb10b, BLOBLIST_ALIGN_LOG2 = 3, BLOBLIST_ALIGN = 1 << BLOBLIST_ALIGN_LOG2,
-- 2.25.1
Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org

On Mon, Dec 18, 2023 at 6:19 PM Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
This uses a new value with spec v0.9 so change it.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v2
- Update the bloblist magic to align to FW handoff spec v0.9.
Changes in v3
- Update the bloblist magic to align to FW handoff spec up to commit 3592349.
include/bloblist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

From: Simon Glass sjg@chromium.org
The new bloblist for v0.9 has version 1 so update this value.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org Reviewed-by: Simon Glass sjg@chromium.org --- include/bloblist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/bloblist.h b/include/bloblist.h index 72c785411d..7eff709ec8 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -74,7 +74,7 @@ #include <mapmem.h>
enum { - BLOBLIST_VERSION = 0, + BLOBLIST_VERSION = 1, BLOBLIST_MAGIC = 0x4a0fb10b,
BLOBLIST_ALIGN_LOG2 = 3,

From: Simon Glass sjg@chromium.org
Convert accesses to tag and hdr_size via function for grouping tag and hdr_size together later.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v3 - Update commit message.
common/bloblist.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 1e78a3d4b3..168993e0a7 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -84,13 +84,23 @@ static struct bloblist_rec *bloblist_first_blob(struct bloblist_hdr *hdr) return (struct bloblist_rec *)((void *)hdr + hdr->hdr_size); }
+static inline uint rec_hdr_size(struct bloblist_rec *rec) +{ + return rec->hdr_size; +} + +static inline uint rec_tag(struct bloblist_rec *rec) +{ + return rec->tag; +} + static ulong bloblist_blob_end_ofs(struct bloblist_hdr *hdr, struct bloblist_rec *rec) { ulong offset;
offset = (void *)rec - (void *)hdr; - offset += rec->hdr_size + ALIGN(rec->size, BLOBLIST_ALIGN); + offset += rec_hdr_size(rec) + ALIGN(rec->size, BLOBLIST_ALIGN);
return offset; } @@ -119,7 +129,7 @@ static struct bloblist_rec *bloblist_findrec(uint tag) return NULL;
foreach_rec(rec, hdr) { - if (rec->tag == tag) + if (rec_tag(rec) == tag) return rec; }
@@ -158,7 +168,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, rec->spare = 0;
/* Zero the record data */ - memset((void *)rec + rec->hdr_size, '\0', rec->size); + memset((void *)rec + rec_hdr_size(rec), '\0', rec->size);
hdr->alloced = new_alloced; *recp = rec; @@ -199,7 +209,7 @@ void *bloblist_find(uint tag, int size) if (size && size != rec->size) return NULL;
- return (void *)rec + rec->hdr_size; + return (void *)rec + rec_hdr_size(rec); }
void *bloblist_add(uint tag, int size, int align_log2) @@ -209,7 +219,7 @@ void *bloblist_add(uint tag, int size, int align_log2) if (bloblist_addrec(tag, size, align_log2, &rec)) return NULL;
- return (void *)rec + rec->hdr_size; + return (void *)rec + rec_hdr_size(rec); }
int bloblist_ensure_size(uint tag, int size, int align_log2, void **blobp) @@ -220,7 +230,7 @@ int bloblist_ensure_size(uint tag, int size, int align_log2, void **blobp) ret = bloblist_ensurerec(tag, &rec, size, align_log2); if (ret) return ret; - *blobp = (void *)rec + rec->hdr_size; + *blobp = (void *)rec + rec_hdr_size(rec);
return 0; } @@ -232,7 +242,7 @@ void *bloblist_ensure(uint tag, int size) if (bloblist_ensurerec(tag, &rec, size, 0)) return NULL;
- return (void *)rec + rec->hdr_size; + return (void *)rec + rec_hdr_size(rec); }
int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp) @@ -245,7 +255,7 @@ int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp) *sizep = rec->size; else if (ret) return ret; - *blobp = (void *)rec + rec->hdr_size; + *blobp = (void *)rec + rec_hdr_size(rec);
return 0; } @@ -281,7 +291,7 @@ static int bloblist_resize_rec(struct bloblist_hdr *hdr,
/* Zero the new part of the blob */ if (expand_by > 0) { - memset((void *)rec + rec->hdr_size + rec->size, '\0', + memset((void *)rec + rec_hdr_size(rec) + rec->size, '\0', new_size - rec->size); }
@@ -315,8 +325,9 @@ static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) chksum = crc32(0, (unsigned char *)hdr, offsetof(struct bloblist_hdr, chksum)); foreach_rec(rec, hdr) { - chksum = crc32(chksum, (void *)rec, rec->hdr_size); - chksum = crc32(chksum, (void *)rec + rec->hdr_size, rec->size); + chksum = crc32(chksum, (void *)rec, rec_hdr_size(rec)); + chksum = crc32(chksum, (void *)rec + rec_hdr_size(rec), + rec->size); }
return chksum; @@ -424,8 +435,9 @@ void bloblist_show_list(void) for (rec = bloblist_first_blob(hdr); rec; rec = bloblist_next_blob(hdr, rec)) { printf("%08lx %8x %4x %s\n", - (ulong)map_to_sysmem((void *)rec + rec->hdr_size), - rec->size, rec->tag, bloblist_tag_name(rec->tag)); + (ulong)map_to_sysmem((void *)rec + rec_hdr_size(rec)), + rec->size, rec_tag(rec), + bloblist_tag_name(rec_tag(rec))); } }

From: Simon Glass sjg@chromium.org
Drop spare value from bloblist record header.
For now it is still present in the header, with an underscore, so that tests continue to pass.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v3 - Keep the spare value in the bloblist header to align to FW handoff spec up to commit 3592349.
common/bloblist.c | 1 - include/bloblist.h | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 168993e0a7..88e2a0f5c0 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -165,7 +165,6 @@ static int bloblist_addrec(uint tag, int size, int align_log2, rec->tag = tag; rec->hdr_size = data_start - hdr->alloced; rec->size = size; - rec->spare = 0;
/* Zero the record data */ memset((void *)rec + rec_hdr_size(rec), '\0', rec->size); diff --git a/include/bloblist.h b/include/bloblist.h index 7eff709ec8..68f97395b7 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -205,13 +205,12 @@ struct bloblist_hdr { * record's data starts at this offset from the start of the record * @size: Size of record in bytes, excluding the header size. This does not * need to be aligned (e.g. 3 is OK). - * @spare: Spare space for other things */ struct bloblist_rec { u32 tag; u32 hdr_size; u32 size; - u32 spare; + u32 _spare; };
/**

Hi Raymond,
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Drop spare value from bloblist record header.
For now it is still present in the header, with an underscore, so that tests continue to pass.
I am not sure I understand the commit message. Doesn't the spec define this as 'reserved' now? On top of that, it's a better idea to follow the spec naming. It's easier to map the spec -> code for new readers. So I would rename
tag -> tag_id size -> data_size and flags -> reserved.
Can we at least do the flags -> reserved in this patch?
[...]
Thanks /Ilias

Hi Ilias,
On Wed, 27 Dec 2023 at 04:43, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
Hi Raymond,
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Drop spare value from bloblist record header.
For now it is still present in the header, with an underscore, so that tests continue to pass.
I am not sure I understand the commit message. Doesn't the spec define this as 'reserved' now? On top of that, it's a better idea to follow the spec naming. It's easier to map the spec -> code for new readers. So I would rename
tag -> tag_id size -> data_size and flags -> reserved.
Can we at least do the flags -> reserved in this patch?
I will update the naming of members in v4.
Regards, Raymond

Hi Ilias,
On Wed, 27 Dec 2023 at 04:43, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
Hi Raymond,
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Drop spare value from bloblist record header.
For now it is still present in the header, with an underscore, so that tests continue to pass.
I am not sure I understand the commit message. Doesn't the spec define this as 'reserved' now? On top of that, it's a better idea to follow the spec naming. It's easier to map the spec -> code for new readers. So I would rename
tag -> tag_id size -> data_size and flags -> reserved.
Can we at least do the flags -> reserved in this patch?
The spec only defines a spare field for TL header (bloblist header) but
not for a TE header (bloblist record header), so we just remove the spare field, no need to update this patch I think.
[...]
Regards, Raymond

From: Simon Glass sjg@chromium.org
Use a sinple 8-bit checksum for bloblist, as specified by the spec version 0.9
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org --- common/bloblist.c | 14 ++++++++------ include/bloblist.h | 5 ++--- 2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 88e2a0f5c0..32692d8319 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -13,6 +13,7 @@ #include <malloc.h> #include <mapmem.h> #include <spl.h> +#include <tables_csum.h> #include <asm/global_data.h> #include <u-boot/crc.h>
@@ -319,14 +320,15 @@ int bloblist_resize(uint tag, int new_size) static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) { struct bloblist_rec *rec; - u32 chksum; + u8 chksum;
- chksum = crc32(0, (unsigned char *)hdr, - offsetof(struct bloblist_hdr, chksum)); + chksum = table_compute_checksum(hdr, hdr->hdr_size); + chksum += hdr->chksum; foreach_rec(rec, hdr) { - chksum = crc32(chksum, (void *)rec, rec_hdr_size(rec)); - chksum = crc32(chksum, (void *)rec + rec_hdr_size(rec), - rec->size); + chksum -= table_compute_checksum((void *)rec, + rec_hdr_size(rec)); + chksum -= table_compute_checksum((void *)rec + + rec_hdr_size(rec), rec->size); }
return chksum; diff --git a/include/bloblist.h b/include/bloblist.h index 68f97395b7..d2dcad69a1 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -174,11 +174,10 @@ enum bloblist_tag_t { * sizeof(bloblist_hdr) since we need at least that much space to store a * valid bloblist * @spare: Spare space (for future use) - * @chksum: CRC32 for the entire bloblist allocated area. Since any of the + * @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. - * Note that chksum is last to make it easier to exclude it from the - * checksum calculation. + * This is the value needed to make all checksummed bytes sum to 0 */ struct bloblist_hdr { u32 magic;

From: Simon Glass sjg@chromium.org
Spec v0.9 specifies that the entire bloblist area is checksummed, including unused portions. Update the code to follow this.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org --- common/bloblist.c | 9 +-------- test/bloblist.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 32692d8319..705d9c6ae9 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -319,17 +319,10 @@ int bloblist_resize(uint tag, int new_size)
static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) { - struct bloblist_rec *rec; u8 chksum;
- chksum = table_compute_checksum(hdr, hdr->hdr_size); + chksum = table_compute_checksum(hdr, hdr->alloced); chksum += hdr->chksum; - foreach_rec(rec, hdr) { - chksum -= table_compute_checksum((void *)rec, - rec_hdr_size(rec)); - chksum -= table_compute_checksum((void *)rec + - rec_hdr_size(rec), rec->size); - }
return chksum; } diff --git a/test/bloblist.c b/test/bloblist.c index 8b435e27ca..49ac4b92ae 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -237,12 +237,18 @@ static int bloblist_test_checksum(struct unit_test_state *uts) *data2 -= 1;
/* - * Changing data outside the range of valid data should not affect - * the checksum. + * Changing data outside the range of valid data should affect the + * checksum. */ ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); data[TEST_SIZE]++; + ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); + data[TEST_SIZE]--; + ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); + data2[TEST_SIZE2]++; + ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); + data[TEST_SIZE]--; ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
return 0;

Hi Raymond,
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Spec v0.9 specifies that the entire bloblist area is checksummed, including unused portions. Update the code to follow this.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org
common/bloblist.c | 9 +-------- test/bloblist.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 32692d8319..705d9c6ae9 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -319,17 +319,10 @@ int bloblist_resize(uint tag, int new_size)
static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) {
struct bloblist_rec *rec; u8 chksum;
chksum = table_compute_checksum(hdr, hdr->hdr_size);
chksum = table_compute_checksum(hdr, hdr->alloced); chksum += hdr->chksum;
foreach_rec(rec, hdr) {
chksum -= table_compute_checksum((void *)rec,
rec_hdr_size(rec));
chksum -= table_compute_checksum((void *)rec +
rec_hdr_size(rec), rec->size);
}
Why do we need patch #7 if it gets removed immediately after? Can't we just squash those two with a proper commit message, since the spec requires checksumming the entire list?
[...]
Thanks /Ilias

Hi Ilias,
On Wed, 27 Dec 2023 at 04:57, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
Hi Raymond,
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Spec v0.9 specifies that the entire bloblist area is checksummed, including unused portions. Update the code to follow this.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org
common/bloblist.c | 9 +-------- test/bloblist.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 32692d8319..705d9c6ae9 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -319,17 +319,10 @@ int bloblist_resize(uint tag, int new_size)
static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) {
struct bloblist_rec *rec; u8 chksum;
chksum = table_compute_checksum(hdr, hdr->hdr_size);
chksum = table_compute_checksum(hdr, hdr->alloced); chksum += hdr->chksum;
foreach_rec(rec, hdr) {
chksum -= table_compute_checksum((void *)rec,
rec_hdr_size(rec));
chksum -= table_compute_checksum((void *)rec +
rec_hdr_size(rec),
rec->size);
}
Why do we need patch #7 if it gets removed immediately after? Can't we just squash those two with a proper commit message, since the spec requires checksumming the entire list?
Yes. I think #7 and #8 can be squashed into one patch.
Will do this in V4.
Regards, Raymond

From: Simon Glass sjg@chromium.org
Rather than setting the alignment using the header size, add an entirely new entry to cover the gap left by the alignment.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org --- common/bloblist.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 705d9c6ae9..73dbbc01c0 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -142,7 +142,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, { struct bloblist_hdr *hdr = gd->bloblist; struct bloblist_rec *rec; - int data_start, new_alloced; + int data_start, aligned_start, new_alloced;
if (!align_log2) align_log2 = BLOBLIST_ALIGN_LOG2; @@ -151,10 +151,25 @@ static int bloblist_addrec(uint tag, int size, int align_log2, data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*rec);
/* Align the address and then calculate the offset from ->alloced */ - data_start = ALIGN(data_start, 1U << align_log2) - map_to_sysmem(hdr); + aligned_start = ALIGN(data_start, 1U << align_log2) - data_start; + + /* If we need to create a dummy record, create it */ + if (aligned_start) { + int void_size = aligned_start - sizeof(*rec); + struct bloblist_rec *vrec; + int ret; + + ret = bloblist_addrec(BLOBLISTT_VOID, void_size, 0, &vrec); + if (ret) + return log_msg_ret("void", ret); + + /* start the record after that */ + data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*vrec); + }
/* Calculate the new allocated total */ - new_alloced = data_start + ALIGN(size, 1U << align_log2); + new_alloced = data_start - map_to_sysmem(hdr) + + ALIGN(size, 1U << align_log2);
if (new_alloced > hdr->size) { log_err("Failed to allocate %x bytes size=%x, need size=%x\n", @@ -164,7 +179,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, rec = (void *)hdr + hdr->alloced;
rec->tag = tag; - rec->hdr_size = data_start - hdr->alloced; + rec->hdr_size = sizeof(struct bloblist_rec); rec->size = size;
/* Zero the record data */

On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Rather than setting the alignment using the header size, add an entirely new entry to cover the gap left by the alignment.
Hmm, why? Does it make out life easier somehow if new entries get added?
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org
common/bloblist.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 705d9c6ae9..73dbbc01c0 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -142,7 +142,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, { struct bloblist_hdr *hdr = gd->bloblist; struct bloblist_rec *rec;
int data_start, new_alloced;
int data_start, aligned_start, new_alloced; if (!align_log2) align_log2 = BLOBLIST_ALIGN_LOG2;
@@ -151,10 +151,25 @@ static int bloblist_addrec(uint tag, int size, int align_log2, data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*rec);
/* Align the address and then calculate the offset from ->alloced */
data_start = ALIGN(data_start, 1U << align_log2) - map_to_sysmem(hdr);
aligned_start = ALIGN(data_start, 1U << align_log2) - data_start;
/* If we need to create a dummy record, create it */
if (aligned_start) {
int void_size = aligned_start - sizeof(*rec);
struct bloblist_rec *vrec;
int ret;
ret = bloblist_addrec(BLOBLISTT_VOID, void_size, 0, &vrec);
if (ret)
return log_msg_ret("void", ret);
/* start the record after that */
data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*vrec);
} /* Calculate the new allocated total */
new_alloced = data_start + ALIGN(size, 1U << align_log2);
new_alloced = data_start - map_to_sysmem(hdr) +
ALIGN(size, 1U << align_log2); if (new_alloced > hdr->size) { log_err("Failed to allocate %x bytes size=%x, need size=%x\n",
@@ -164,7 +179,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, rec = (void *)hdr + hdr->alloced;
rec->tag = tag;
rec->hdr_size = data_start - hdr->alloced;
rec->hdr_size = sizeof(struct bloblist_rec); rec->size = size; /* Zero the record data */
-- 2.25.1

Hi Ilias,
On Wed, 27 Dec 2023 at 04:58, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Rather than setting the alignment using the header size, add an entirely new entry to cover the gap left by the alignment.
Hmm, why? Does it make out life easier somehow if new entries get added?
Yes, currently we just mark the unused or removed areas with a void tag.
But I think this is beneficial because later on we can support the fragments management by using this tag to collect, merge and re-use the fragmented spaces.
Regards, Raymond
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Simon Glass sjg@chromium.org
common/bloblist.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 705d9c6ae9..73dbbc01c0 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -142,7 +142,7 @@ static int bloblist_addrec(uint tag, int size, int
align_log2,
{ struct bloblist_hdr *hdr = gd->bloblist; struct bloblist_rec *rec;
int data_start, new_alloced;
int data_start, aligned_start, new_alloced; if (!align_log2) align_log2 = BLOBLIST_ALIGN_LOG2;
@@ -151,10 +151,25 @@ static int bloblist_addrec(uint tag, int size, int
align_log2,
data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*rec); /* Align the address and then calculate the offset from
->alloced */
data_start = ALIGN(data_start, 1U << align_log2) -
map_to_sysmem(hdr);
aligned_start = ALIGN(data_start, 1U << align_log2) - data_start;
/* If we need to create a dummy record, create it */
if (aligned_start) {
int void_size = aligned_start - sizeof(*rec);
struct bloblist_rec *vrec;
int ret;
ret = bloblist_addrec(BLOBLISTT_VOID, void_size, 0,
&vrec);
if (ret)
return log_msg_ret("void", ret);
/* start the record after that */
data_start = map_to_sysmem(hdr) + hdr->alloced +
sizeof(*vrec);
} /* Calculate the new allocated total */
new_alloced = data_start + ALIGN(size, 1U << align_log2);
new_alloced = data_start - map_to_sysmem(hdr) +
ALIGN(size, 1U << align_log2); if (new_alloced > hdr->size) { log_err("Failed to allocate %x bytes size=%x, need
size=%x\n",
@@ -164,7 +179,7 @@ static int bloblist_addrec(uint tag, int size, int
align_log2,
rec = (void *)hdr + hdr->alloced; rec->tag = tag;
rec->hdr_size = data_start - hdr->alloced;
rec->hdr_size = sizeof(struct bloblist_rec); rec->size = size; /* Zero the record data */
-- 2.25.1

Hi Ilias,
On Wed, Dec 27, 2023 at 9:58 AM Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Rather than setting the alignment using the header size, add an entirely new entry to cover the gap left by the alignment.
Hmm, why? Does it make out life easier somehow if new entries get added?
This was one of the spec changes. Not one that I agreed with, but there it is.
Regards, Simon

On Wed, 27 Dec 2023 at 19:49, Simon Glass sjg@chromium.org wrote:
Hi Ilias,
On Wed, Dec 27, 2023 at 9:58 AM Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Rather than setting the alignment using the header size, add an entirely new entry to cover the gap left by the alignment.
Hmm, why? Does it make out life easier somehow if new entries get added?
Ah thanks. I did indeed miss that change on the spec
Thanks /Ilias
This was one of the spec changes. Not one that I agreed with, but there it is.
Regards, Simon

From: Simon Glass sjg@chromium.org
The v0.9 spec provides for an 8-byte header for each blob, with fewer fields. The blob data start address should be aligned to the alignment specified by the bloblist header. Update the implementation to match this.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v2 - Update the blob start address to align to the alignment required by the bloblist header. - Define the macros of bloblist header size and bloblist record header size as the size of their structures. Changes in v3 - Update the calculation of the bloblist record offset to make sure that each bloblist record data section start address fulfills the alignment requirement. - Update commit message.
common/bloblist.c | 23 +++++++++++++++-------- include/bloblist.h | 33 ++++++++++++++++++++++----------- test/bloblist.c | 16 ++++++++-------- 3 files changed, 45 insertions(+), 27 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 73dbbc01c0..1c97d61e4a 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -87,12 +87,14 @@ static struct bloblist_rec *bloblist_first_blob(struct bloblist_hdr *hdr)
static inline uint rec_hdr_size(struct bloblist_rec *rec) { - return rec->hdr_size; + return (rec->tag_and_hdr_size & BLOBLISTR_HDR_SIZE_MASK) >> + BLOBLISTR_HDR_SIZE_SHIFT; }
static inline uint rec_tag(struct bloblist_rec *rec) { - return rec->tag; + return (rec->tag_and_hdr_size & BLOBLISTR_TAG_MASK) >> + BLOBLISTR_TAG_SHIFT; }
static ulong bloblist_blob_end_ofs(struct bloblist_hdr *hdr, @@ -101,7 +103,13 @@ static ulong bloblist_blob_end_ofs(struct bloblist_hdr *hdr, ulong offset;
offset = (void *)rec - (void *)hdr; - offset += rec_hdr_size(rec) + ALIGN(rec->size, BLOBLIST_ALIGN); + /* + * The data section of next TE should start from an address aligned + * to 1 << hdr->align_log2. + */ + offset += rec_hdr_size(rec) + rec->size; + offset = round_up(offset + rec_hdr_size(rec), 1 << hdr->align_log2); + offset -= rec_hdr_size(rec);
return offset; } @@ -145,7 +153,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, int data_start, aligned_start, new_alloced;
if (!align_log2) - align_log2 = BLOBLIST_ALIGN_LOG2; + align_log2 = BLOBLIST_BLOB_ALIGN_LOG2;
/* Figure out where the new data will start */ data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*rec); @@ -178,8 +186,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, } rec = (void *)hdr + hdr->alloced;
- rec->tag = tag; - rec->hdr_size = sizeof(struct bloblist_rec); + rec->tag_and_hdr_size = tag | sizeof(*rec) << BLOBLISTR_HDR_SIZE_SHIFT; rec->size = size;
/* Zero the record data */ @@ -283,8 +290,8 @@ static int bloblist_resize_rec(struct bloblist_hdr *hdr, int new_alloced; /* New value for @hdr->alloced */ ulong next_ofs; /* Offset of the record after @rec */
- expand_by = ALIGN(new_size - rec->size, BLOBLIST_ALIGN); - new_alloced = ALIGN(hdr->alloced + expand_by, BLOBLIST_ALIGN); + expand_by = ALIGN(new_size - rec->size, BLOBLIST_BLOB_ALIGN); + new_alloced = ALIGN(hdr->alloced + expand_by, BLOBLIST_BLOB_ALIGN); if (new_size < 0) { log_debug("Attempt to shrink blob size below 0 (%x)\n", new_size); diff --git a/include/bloblist.h b/include/bloblist.h index d2dcad69a1..7024d7bf9e 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -24,11 +24,11 @@ * which would add to code size. For Thumb-2 the code size needed in SPL is * approximately 940 bytes (e.g. for chromebook_bob). * - * 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 + * TPL the alignment can be relaxed, since it can be relocated to an aligned + * address in U-Boot proper. * * 6. Bloblist is designed to be passed to Linux as reserved memory. While linux * doesn't understand the bloblist header, it can be passed the indivdual blobs. @@ -77,6 +77,9 @@ enum { BLOBLIST_VERSION = 1, BLOBLIST_MAGIC = 0x4a0fb10b,
+ BLOBLIST_BLOB_ALIGN_LOG2 = 3, + BLOBLIST_BLOB_ALIGN = 1 << BLOBLIST_BLOB_ALIGN_LOG2, + BLOBLIST_ALIGN_LOG2 = 3, BLOBLIST_ALIGN = 1 << BLOBLIST_ALIGN_LOG2, }; @@ -199,17 +202,25 @@ struct bloblist_hdr { * * NOTE: Only exported for testing purposes. Do not use this struct. * - * @tag: Tag indicating what the record contains - * @hdr_size: Size of this header, normally sizeof(struct bloblist_rec). The - * record's data starts at this offset from the start of the record + * @tag_and_hdr_size: Tag indicating what the record contains (bottom 24 bits), and + * size of this header (top 8 bits), normally sizeof(struct bloblist_rec). + * The record's data starts at this offset from the start of the record * @size: Size of record in bytes, excluding the header size. This does not * need to be aligned (e.g. 3 is OK). */ struct bloblist_rec { - u32 tag; - u32 hdr_size; + u32 tag_and_hdr_size; u32 size; - u32 _spare; +}; + +enum { + BLOBLISTR_TAG_SHIFT = 0, + BLOBLISTR_TAG_MASK = 0xffffffU << BLOBLISTR_TAG_SHIFT, + BLOBLISTR_HDR_SIZE_SHIFT = 24, + BLOBLISTR_HDR_SIZE_MASK = 0xffU << BLOBLISTR_HDR_SIZE_SHIFT, + + BLOBLIST_HDR_SIZE = sizeof(struct bloblist_hdr), + BLOBLIST_REC_HDR_SIZE = sizeof(struct bloblist_rec), };
/** diff --git a/test/bloblist.c b/test/bloblist.c index 49ac4b92ae..e6070041d3 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -272,8 +272,8 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) run_command("bloblist info", 0); ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr)); ut_assert_nextline("size: 400 1 KiB"); - ut_assert_nextline("alloced: 70 112 Bytes"); - ut_assert_nextline("free: 390 912 Bytes"); + ut_assert_nextline("alloced: 58 88 Bytes"); + ut_assert_nextline("free: 3a8 936 Bytes"); ut_assert_console_end(); ut_unsilence_console(uts);
@@ -331,12 +331,12 @@ static int bloblist_test_align(struct unit_test_state *uts) data = bloblist_add(i, size, 0); ut_assertnonnull(data); addr = map_to_sysmem(data); - ut_asserteq(0, addr & (BLOBLIST_ALIGN - 1)); + ut_asserteq(0, addr & (BLOBLIST_BLOB_ALIGN - 1));
/* Only the bytes in the blob data should be zeroed */ for (j = 0; j < size; j++) ut_asserteq(0, data[j]); - for (; j < BLOBLIST_ALIGN; j++) + for (; j < BLOBLIST_BLOB_ALIGN; j++) ut_asserteq(ERASE_BYTE, data[j]); }
@@ -351,7 +351,7 @@ static int bloblist_test_align(struct unit_test_state *uts) }
/* Check alignment with an bloblist starting on a smaller alignment */ - hdr = map_sysmem(TEST_ADDR + BLOBLIST_ALIGN, TEST_BLOBLIST_SIZE); + hdr = map_sysmem(TEST_ADDR + BLOBLIST_BLOB_ALIGN, TEST_BLOBLIST_SIZE); memset(hdr, ERASE_BYTE, TEST_BLOBLIST_SIZE); memset(hdr, '\0', sizeof(*hdr)); ut_assertok(bloblist_new(TEST_ADDR + BLOBLIST_ALIGN, TEST_BLOBLIST_SIZE, @@ -360,7 +360,7 @@ static int bloblist_test_align(struct unit_test_state *uts) data = bloblist_add(1, 5, BLOBLIST_ALIGN_LOG2 + 1); ut_assertnonnull(data); addr = map_to_sysmem(data); - ut_asserteq(0, addr & (BLOBLIST_ALIGN * 2 - 1)); + ut_asserteq(0, addr & (BLOBLIST_BLOB_ALIGN * 2 - 1));
return 0; } @@ -448,7 +448,7 @@ static int bloblist_test_grow(struct unit_test_state *uts) hdr = ptr; ut_asserteq(sizeof(struct bloblist_hdr) + sizeof(struct bloblist_rec) * 2 + small_size * 2 + - BLOBLIST_ALIGN, + BLOBLIST_BLOB_ALIGN, hdr->alloced);
return 0; @@ -583,7 +583,7 @@ static int bloblist_test_resize_last(struct unit_test_state *uts) ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + alloced_val + 4));
/* Check that the new top of the allocated blobs has not been touched */ - alloced_val += BLOBLIST_ALIGN; + alloced_val += BLOBLIST_BLOB_ALIGN; ut_asserteq(alloced_val, hdr->alloced); ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + hdr->alloced));

From: Simon Glass sjg@chromium.org
The v0.9 spec provides for a 24-byte header. Update the implementation to match this.
This also adds an alignment field.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v3 - Update the bloblist header to align to FW handoff spec up to commit 3592349. - Update the related testcases.
include/bloblist.h | 29 +++++++++++++++-------------- test/bloblist.c | 6 +++--- 2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/include/bloblist.h b/include/bloblist.h index 7024d7bf9e..5dba630adb 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -166,32 +166,33 @@ 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 finalized before jumping to the next stage of boot. + * This is the value needed to make all checksummed 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 - * @flags: Space for BLOBLISTF... flags (none yet) - * @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 + * @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. + * @flags: Space for BLOBLISTF... flags (none yet) * @spare: Spare space (for future use) - * @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 */ struct bloblist_hdr { u32 magic; - u32 version; - u32 hdr_size; - u32 flags; - - u32 size; + u8 chksum; + u8 version; + u8 hdr_size; + u8 align_log2; u32 alloced; + u32 size; + u32 flags; u32 spare; - u32 chksum; };
/** diff --git a/test/bloblist.c b/test/bloblist.c index e6070041d3..a083259d0c 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -78,7 +78,7 @@ static int bloblist_test_init(struct unit_test_state *uts) ut_asserteq(-EPROTONOSUPPORT, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
- ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0x10, 0)); + ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0xc, 0)); ut_asserteq(-EFAULT, bloblist_new(1, TEST_BLOBLIST_SIZE, 0)); ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
@@ -272,8 +272,8 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) run_command("bloblist info", 0); ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr)); ut_assert_nextline("size: 400 1 KiB"); - ut_assert_nextline("alloced: 58 88 Bytes"); - ut_assert_nextline("free: 3a8 936 Bytes"); + ut_assert_nextline("alloced: 50 80 Bytes"); + ut_assert_nextline("free: 3b0 944 Bytes"); ut_assert_console_end(); ut_unsilence_console(uts);

[...]
- @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
struct bloblist_hdr { u32 magic;
- u32 version;
- u32 hdr_size;
- u32 flags;
- u32 size;
- u8 chksum;
- u8 version;
- u8 hdr_size;
- u8 align_log2; u32 alloced;
- u32 size;
- u32 flags; u32 spare;
- u32 chksum;
};
Aren't fields still missing from the current version? e.g max_size and reserved?
/** diff --git a/test/bloblist.c b/test/bloblist.c index e6070041d3..a083259d0c 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -78,7 +78,7 @@ static int bloblist_test_init(struct unit_test_state *uts) ut_asserteq(-EPROTONOSUPPORT, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
- ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0x10, 0));
- ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0xc, 0)); ut_asserteq(-EFAULT, bloblist_new(1, TEST_BLOBLIST_SIZE, 0)); ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0));
@@ -272,8 +272,8 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) run_command("bloblist info", 0); ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr)); ut_assert_nextline("size: 400 1 KiB");
- ut_assert_nextline("alloced: 58 88 Bytes");
- ut_assert_nextline("free: 3a8 936 Bytes");
- ut_assert_nextline("alloced: 50 80 Bytes");
- ut_assert_nextline("free: 3b0 944 Bytes"); ut_assert_console_end(); ut_unsilence_console(uts);
-- 2.25.1

Hi Ilias,
On Wed, 27 Dec 2023 at 05:17, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
[...]
- @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
struct bloblist_hdr { u32 magic;
u32 version;
u32 hdr_size;
u32 flags;
u32 size;
u8 chksum;
u8 version;
u8 hdr_size;
u8 align_log2; u32 alloced;
u32 size;
u32 flags; u32 spare;
u32 chksum;
};
Aren't fields still missing from the current version? e.g max_size and reserved?
They are all in. Please see:
[PATCH v3 14/14] bloblist: Align bloblist used_size and total_size to spec
[...]
Regards, Raymond

On Wed, 27 Dec 2023 at 16:50, Raymond Mao raymond.mao@linaro.org wrote:
Hi Ilias,
On Wed, 27 Dec 2023 at 05:17, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
[...]
- @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
struct bloblist_hdr { u32 magic;
u32 version;
u32 hdr_size;
u32 flags;
u32 size;
u8 chksum;
u8 version;
u8 hdr_size;
u8 align_log2; u32 alloced;
u32 size;
u32 flags; u32 spare;
u32 chksum;
};
Aren't fields still missing from the current version? e.g max_size and reserved?
They are all in. Please see: [PATCH v3 14/14] bloblist: Align bloblist used_size and total_size to spec
Ok. But why aren't we squashing this to #14 then?
Thanks /Ilias
[...]
Regards, Raymond

Hi Ilias,
On Wed, 27 Dec 2023 at 09:58, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
On Wed, 27 Dec 2023 at 16:50, Raymond Mao raymond.mao@linaro.org wrote:
Hi Ilias,
On Wed, 27 Dec 2023 at 05:17, Ilias Apalodimas <
ilias.apalodimas@linaro.org> wrote:
[...]
- @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
struct bloblist_hdr { u32 magic;
u32 version;
u32 hdr_size;
u32 flags;
u32 size;
u8 chksum;
u8 version;
u8 hdr_size;
u8 align_log2; u32 alloced;
u32 size;
u32 flags; u32 spare;
u32 chksum;
};
Aren't fields still missing from the current version? e.g max_size and reserved?
They are all in. Please see: [PATCH v3 14/14] bloblist: Align bloblist used_size and total_size to
spec
Ok. But why aren't we squashing this to #14 then?
I can squash other changes with #14 except the ones for `align_log2`.
And `align_log2` with patch #12 due to the dependency.
Regards, Raymond
Thanks /Ilias
[...]
Regards, Raymond

On Wed, 27 Dec 2023 at 17:09, Raymond Mao raymond.mao@linaro.org wrote:
Hi Ilias,
On Wed, 27 Dec 2023 at 09:58, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
On Wed, 27 Dec 2023 at 16:50, Raymond Mao raymond.mao@linaro.org wrote:
Hi Ilias,
On Wed, 27 Dec 2023 at 05:17, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
[...]
- @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
struct bloblist_hdr { u32 magic;
u32 version;
u32 hdr_size;
u32 flags;
u32 size;
u8 chksum;
u8 version;
u8 hdr_size;
u8 align_log2; u32 alloced;
u32 size;
u32 flags; u32 spare;
u32 chksum;
};
Aren't fields still missing from the current version? e.g max_size and reserved?
They are all in. Please see: [PATCH v3 14/14] bloblist: Align bloblist used_size and total_size to spec
Ok. But why aren't we squashing this to #14 then?
I can squash other changes with #14 except the ones for `align_log2`. And `align_log2` with patch #12 due to the dependency.
I think that's better.
Thanks /Ilias
Regards, Raymond
Thanks /Ilias
[...]
Regards, Raymond

From: Simon Glass sjg@chromium.org
Allow the alignment to be specified when creating a bloblist.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v3 - Keep the flag argument to align to FW handoff spec up to commit 3592349.
common/bloblist.c | 5 +++-- include/bloblist.h | 3 ++- test/bloblist.c | 40 ++++++++++++++++++++++------------------ 3 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 1c97d61e4a..6d079c58f7 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -349,7 +349,7 @@ static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) return chksum; }
-int bloblist_new(ulong addr, uint size, uint flags) +int bloblist_new(ulong addr, uint size, uint flags, uint align_log2) { struct bloblist_hdr *hdr;
@@ -365,6 +365,7 @@ int bloblist_new(ulong addr, uint size, uint flags) hdr->magic = BLOBLIST_MAGIC; hdr->size = size; hdr->alloced = hdr->hdr_size; + hdr->align_log2 = align_log2 ?: BLOBLIST_BLOB_ALIGN_LOG2; hdr->chksum = 0; gd->bloblist = hdr;
@@ -508,7 +509,7 @@ int bloblist_init(void) } log_debug("Creating new bloblist size %lx at %lx\n", size, addr); - ret = bloblist_new(addr, size, 0); + ret = bloblist_new(addr, size, 0, 0); } else { log_debug("Found existing bloblist size %lx at %lx\n", size, addr); diff --git a/include/bloblist.h b/include/bloblist.h index 5dba630adb..8f0286fda7 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -330,10 +330,11 @@ int bloblist_resize(uint tag, int new_size); * @addr: Address of bloblist * @size: Initial size for bloblist * @flags: Flags to use for bloblist + * @align_log2: Log base 2 of maximum alignment provided by this bloblist * Return: 0 if OK, -EFAULT if addr is not aligned correctly, -ENOSPC is the * area is not large enough */ -int bloblist_new(ulong addr, uint size, uint flags); +int bloblist_new(ulong addr, uint size, uint flags, uint align_log2);
/** * bloblist_check() - Check if a bloblist exists diff --git a/test/bloblist.c b/test/bloblist.c index a083259d0c..29abd46862 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -72,15 +72,15 @@ static int bloblist_test_init(struct unit_test_state *uts) hdr = clear_bloblist(); ut_asserteq(-ENOENT, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); ut_asserteq_ptr(NULL, bloblist_check_magic(TEST_ADDR)); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); ut_asserteq_ptr(hdr, bloblist_check_magic(TEST_ADDR)); hdr->version++; ut_asserteq(-EPROTONOSUPPORT, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
- ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0xc, 0)); - ut_asserteq(-EFAULT, bloblist_new(1, TEST_BLOBLIST_SIZE, 0)); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_asserteq(-ENOSPC, bloblist_new(TEST_ADDR, 0xc, 0, 0)); + ut_asserteq(-EFAULT, bloblist_new(1, TEST_BLOBLIST_SIZE, 0, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0));
ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); ut_assertok(bloblist_finish()); @@ -106,7 +106,7 @@ static int bloblist_test_blob(struct unit_test_state *uts) /* At the start there should be no records */ hdr = clear_bloblist(); ut_assertnull(bloblist_find(TEST_TAG, TEST_BLOBLIST_SIZE)); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); ut_asserteq(TEST_BLOBLIST_SIZE, bloblist_get_size()); ut_asserteq(TEST_ADDR, bloblist_get_base()); ut_asserteq(map_to_sysmem(hdr), TEST_ADDR); @@ -144,7 +144,7 @@ static int bloblist_test_blob_ensure(struct unit_test_state *uts)
/* At the start there should be no records */ clear_bloblist(); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0));
/* Test with an empty bloblist */ size = TEST_SIZE; @@ -176,7 +176,7 @@ static int bloblist_test_bad_blob(struct unit_test_state *uts) void *data;
hdr = clear_bloblist(); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); data = hdr + 1; data += sizeof(struct bloblist_rec); ut_asserteq_addr(data, bloblist_ensure(TEST_TAG, TEST_SIZE)); @@ -192,7 +192,7 @@ static int bloblist_test_checksum(struct unit_test_state *uts) char *data, *data2;
hdr = clear_bloblist(); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); ut_assertok(bloblist_finish()); ut_assertok(bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
@@ -217,6 +217,10 @@ static int bloblist_test_checksum(struct unit_test_state *uts) ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); hdr->chksum--;
+ hdr->align_log2++; + ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); + hdr->align_log2--; + /* Make sure the checksum changes when we add blobs */ data = bloblist_add(TEST_TAG, TEST_SIZE, 0); ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); @@ -262,7 +266,7 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) char *data, *data2;
hdr = clear_bloblist(); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); data = bloblist_ensure(TEST_TAG, TEST_SIZE); data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2);
@@ -288,7 +292,7 @@ static int bloblist_test_cmd_list(struct unit_test_state *uts) char *data, *data2;
hdr = clear_bloblist(); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); data = bloblist_ensure(TEST_TAG, TEST_SIZE); data2 = bloblist_ensure(TEST_TAG2, TEST_SIZE2);
@@ -318,7 +322,7 @@ static int bloblist_test_align(struct unit_test_state *uts)
/* At the start there should be no records */ hdr = clear_bloblist(); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); ut_assertnull(bloblist_find(TEST_TAG, TEST_BLOBLIST_SIZE));
/* Check the default alignment */ @@ -355,7 +359,7 @@ static int bloblist_test_align(struct unit_test_state *uts) memset(hdr, ERASE_BYTE, TEST_BLOBLIST_SIZE); memset(hdr, '\0', sizeof(*hdr)); ut_assertok(bloblist_new(TEST_ADDR + BLOBLIST_ALIGN, TEST_BLOBLIST_SIZE, - 0)); + 0, 0));
data = bloblist_add(1, 5, BLOBLIST_ALIGN_LOG2 + 1); ut_assertnonnull(data); @@ -376,7 +380,7 @@ static int bloblist_test_reloc(struct unit_test_state *uts) ulong new_addr; ulong new_size;
- ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); old_ptr = map_sysmem(TEST_ADDR, TEST_BLOBLIST_SIZE);
/* Add one blob and then one that won't fit */ @@ -415,7 +419,7 @@ static int bloblist_test_grow(struct unit_test_state *uts) memset(hdr, ERASE_BYTE, TEST_BLOBLIST_SIZE);
/* Create two blobs */ - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); blob1 = bloblist_add(TEST_TAG, small_size, 0); ut_assertnonnull(blob1); ut_assertok(check_zero(blob1, small_size)); @@ -467,7 +471,7 @@ static int bloblist_test_shrink(struct unit_test_state *uts) ptr = map_sysmem(TEST_ADDR, TEST_BLOBLIST_SIZE);
/* Create two blobs */ - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); blob1 = bloblist_add(TEST_TAG, small_size, 0); ut_assertnonnull(blob1); strcpy(blob1, test1_str); @@ -517,7 +521,7 @@ static int bloblist_test_resize_fail(struct unit_test_state *uts) ptr = map_sysmem(TEST_ADDR, TEST_BLOBLIST_SIZE);
/* Create two blobs */ - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); blob1 = bloblist_add(TEST_TAG, small_size, 0); ut_assertnonnull(blob1);
@@ -554,7 +558,7 @@ static int bloblist_test_resize_last(struct unit_test_state *uts) hdr = ptr;
/* Create two blobs */ - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); blob1 = bloblist_add(TEST_TAG, small_size, 0); ut_assertnonnull(blob1);
@@ -599,7 +603,7 @@ static int bloblist_test_blob_maxsize(struct unit_test_state *uts)
/* At the start there should be no records */ clear_bloblist(); - ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0));
/* Add a blob that takes up all space */ size = TEST_BLOBLIST_SIZE - sizeof(struct bloblist_hdr) -

On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Allow the alignment to be specified when creating a bloblist.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v3
- Keep the flag argument to align to FW handoff spec up to commit 3592349.
common/bloblist.c | 5 +++-- include/bloblist.h | 3 ++- test/bloblist.c | 40 ++++++++++++++++++++++------------------ 3 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 1c97d61e4a..6d079c58f7 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -349,7 +349,7 @@ static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) return chksum; }
-int bloblist_new(ulong addr, uint size, uint flags) +int bloblist_new(ulong addr, uint size, uint flags, uint align_log2) { struct bloblist_hdr *hdr;
@@ -365,6 +365,7 @@ int bloblist_new(ulong addr, uint size, uint flags) hdr->magic = BLOBLIST_MAGIC; hdr->size = size; hdr->alloced = hdr->hdr_size;
hdr->align_log2 = align_log2 ?: BLOBLIST_BLOB_ALIGN_LOG2;
nit, but can we write this as a full ternary operator in the next release.
[...]
Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org

Hi Ilias,
On Wed, 27 Dec 2023 at 05:10, Ilias Apalodimas ilias.apalodimas@linaro.org wrote:
On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Allow the alignment to be specified when creating a bloblist.
Signed-off-by: Simon Glass sjg@chromium.org Co-developed-by: Raymond Mao raymond.mao@linaro.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
Changes in v3
- Keep the flag argument to align to FW handoff spec up to commit
common/bloblist.c | 5 +++-- include/bloblist.h | 3 ++- test/bloblist.c | 40 ++++++++++++++++++++++------------------ 3 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 1c97d61e4a..6d079c58f7 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -349,7 +349,7 @@ static u32 bloblist_calc_chksum(struct bloblist_hdr
*hdr)
return chksum;
}
-int bloblist_new(ulong addr, uint size, uint flags) +int bloblist_new(ulong addr, uint size, uint flags, uint align_log2) { struct bloblist_hdr *hdr;
@@ -365,6 +365,7 @@ int bloblist_new(ulong addr, uint size, uint flags) hdr->magic = BLOBLIST_MAGIC; hdr->size = size; hdr->alloced = hdr->hdr_size;
hdr->align_log2 = align_log2 ?: BLOBLIST_BLOB_ALIGN_LOG2;
nit, but can we write this as a full ternary operator in the next release.
Yes, I agree. Will change this in V4.
Regards, Raymond

From: Simon Glass sjg@chromium.org
Align the documentation with the v0.9 spec.
Signed-off-by: Simon Glass sjg@chromium.org Signed-off-by: Raymond Mao raymond.mao@linaro.org --- doc/develop/bloblist.rst | 4 +++- include/bloblist.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/doc/develop/bloblist.rst b/doc/develop/bloblist.rst index 81643c7674..28431039ad 100644 --- a/doc/develop/bloblist.rst +++ b/doc/develop/bloblist.rst @@ -14,6 +14,8 @@ structure defined by the code that owns it. For the design goals of bloblist, please see the comments at the top of the `bloblist.h` header file.
+Bloblist is an implementation with the `Firmware Handoff`_ protocol. + Passing state through the boot process --------------------------------------
@@ -99,7 +101,7 @@ API documentation -----------------
.. kernel-doc:: include/bloblist.h - +.. _`Firmware Handoff`: https://github.com/FirmwareHandoff/firmware_handoff
Simon Glass sjg@chromium.org diff --git a/include/bloblist.h b/include/bloblist.h index 8f0286fda7..e3c86808b4 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -66,6 +66,7 @@ * * Copyright 2018 Google, Inc * Written by Simon Glass sjg@chromium.org + * Adjusted July 2023 to match Firmware handoff specification, Release 0.9 */
#ifndef __BLOBLIST_H

On Mon, 18 Dec 2023 at 20:20, Raymond Mao raymond.mao@linaro.org wrote:
From: Simon Glass sjg@chromium.org
Align the documentation with the v0.9 spec.
Signed-off-by: Simon Glass sjg@chromium.org Signed-off-by: Raymond Mao raymond.mao@linaro.org
doc/develop/bloblist.rst | 4 +++- include/bloblist.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/doc/develop/bloblist.rst b/doc/develop/bloblist.rst index 81643c7674..28431039ad 100644 --- a/doc/develop/bloblist.rst +++ b/doc/develop/bloblist.rst @@ -14,6 +14,8 @@ structure defined by the code that owns it. For the design goals of bloblist, please see the comments at the top of the `bloblist.h` header file.
+Bloblist is an implementation with the `Firmware Handoff`_ protocol.
Passing state through the boot process
@@ -99,7 +101,7 @@ API documentation
.. kernel-doc:: include/bloblist.h
+.. _`Firmware Handoff`: https://github.com/FirmwareHandoff/firmware_handoff
Simon Glass sjg@chromium.org diff --git a/include/bloblist.h b/include/bloblist.h index 8f0286fda7..e3c86808b4 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -66,6 +66,7 @@
- Copyright 2018 Google, Inc
- Written by Simon Glass sjg@chromium.org
*/
- Adjusted July 2023 to match Firmware handoff specification, Release 0.9
#ifndef __BLOBLIST_H
2.25.1
Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org

Align used_size and total_size of the bloblist header to the definition of the FW Handoff spec v0.9. Update the related bloblist APIs and UT testcases.
Signed-off-by: Raymond Mao raymond.mao@linaro.org --- Changes in v2 - New patch file created for v2. Changes in v3 - Keep the flag and spare values to align to FW handoff spec up to commit 3592349.
common/bloblist.c | 86 +++++++++++++++++++++++++++------------------- include/bloblist.h | 25 +++++++++----- test/bloblist.c | 35 ++++++++++--------- 3 files changed, 84 insertions(+), 62 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index 6d079c58f7..625e480f6b 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -80,7 +80,7 @@ const char *bloblist_tag_name(enum bloblist_tag_t tag)
static struct bloblist_rec *bloblist_first_blob(struct bloblist_hdr *hdr) { - if (hdr->alloced <= hdr->hdr_size) + if (hdr->used_size <= hdr->hdr_size) return NULL; return (struct bloblist_rec *)((void *)hdr + hdr->hdr_size); } @@ -119,7 +119,7 @@ static struct bloblist_rec *bloblist_next_blob(struct bloblist_hdr *hdr, { ulong offset = bloblist_blob_end_ofs(hdr, rec);
- if (offset >= hdr->alloced) + if (offset >= hdr->used_size) return NULL; return (struct bloblist_rec *)((void *)hdr + offset); } @@ -156,9 +156,9 @@ static int bloblist_addrec(uint tag, int size, int align_log2, align_log2 = BLOBLIST_BLOB_ALIGN_LOG2;
/* Figure out where the new data will start */ - data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*rec); + data_start = map_to_sysmem(hdr) + hdr->used_size + sizeof(*rec);
- /* Align the address and then calculate the offset from ->alloced */ + /* Align the address and then calculate the offset from used size */ aligned_start = ALIGN(data_start, 1U << align_log2) - data_start;
/* If we need to create a dummy record, create it */ @@ -172,19 +172,20 @@ static int bloblist_addrec(uint tag, int size, int align_log2, return log_msg_ret("void", ret);
/* start the record after that */ - data_start = map_to_sysmem(hdr) + hdr->alloced + sizeof(*vrec); + data_start = map_to_sysmem(hdr) + hdr->used_size + sizeof(*vrec); }
/* Calculate the new allocated total */ new_alloced = data_start - map_to_sysmem(hdr) + ALIGN(size, 1U << align_log2);
- if (new_alloced > hdr->size) { - log_err("Failed to allocate %x bytes size=%x, need size=%x\n", - size, hdr->size, new_alloced); + if (new_alloced > hdr->total_size) { + log_err("Failed to allocate %x bytes\n", size); + log_err("Used size=%x, total size=%x\n", + hdr->used_size, hdr->total_size); return log_msg_ret("bloblist add", -ENOSPC); } - rec = (void *)hdr + hdr->alloced; + rec = (void *)hdr + hdr->used_size;
rec->tag_and_hdr_size = tag | sizeof(*rec) << BLOBLISTR_HDR_SIZE_SHIFT; rec->size = size; @@ -192,7 +193,7 @@ static int bloblist_addrec(uint tag, int size, int align_log2, /* Zero the record data */ memset((void *)rec + rec_hdr_size(rec), '\0', rec->size);
- hdr->alloced = new_alloced; + hdr->used_size = new_alloced; *recp = rec;
return 0; @@ -287,29 +288,30 @@ static int bloblist_resize_rec(struct bloblist_hdr *hdr, int new_size) { int expand_by; /* Number of bytes to expand by (-ve to contract) */ - int new_alloced; /* New value for @hdr->alloced */ + int new_alloced; ulong next_ofs; /* Offset of the record after @rec */
expand_by = ALIGN(new_size - rec->size, BLOBLIST_BLOB_ALIGN); - new_alloced = ALIGN(hdr->alloced + expand_by, BLOBLIST_BLOB_ALIGN); + new_alloced = ALIGN(hdr->used_size + expand_by, BLOBLIST_BLOB_ALIGN); if (new_size < 0) { log_debug("Attempt to shrink blob size below 0 (%x)\n", new_size); return log_msg_ret("size", -EINVAL); } - if (new_alloced > hdr->size) { - log_err("Failed to allocate %x bytes size=%x, need size=%x\n", - new_size, hdr->size, new_alloced); + if (new_alloced > hdr->total_size) { + log_err("Failed to allocate %x bytes\n", new_size); + log_err("Used size=%x, total size=%x\n", + hdr->used_size, hdr->total_size); return log_msg_ret("alloc", -ENOSPC); }
/* Move the following blobs up or down, if this is not the last */ next_ofs = bloblist_blob_end_ofs(hdr, rec); - if (next_ofs != hdr->alloced) { + if (next_ofs != hdr->used_size) { memmove((void *)hdr + next_ofs + expand_by, (void *)hdr + next_ofs, new_alloced - next_ofs); } - hdr->alloced = new_alloced; + hdr->used_size = new_alloced;
/* Zero the new part of the blob */ if (expand_by > 0) { @@ -343,7 +345,7 @@ static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) { u8 chksum;
- chksum = table_compute_checksum(hdr, hdr->alloced); + chksum = table_compute_checksum(hdr, hdr->used_size); chksum += hdr->chksum;
return chksum; @@ -363,9 +365,9 @@ int bloblist_new(ulong addr, uint size, uint flags, uint align_log2) hdr->hdr_size = sizeof(*hdr); hdr->flags = flags; hdr->magic = BLOBLIST_MAGIC; - hdr->size = size; - hdr->alloced = hdr->hdr_size; + hdr->used_size = hdr->hdr_size; hdr->align_log2 = align_log2 ?: BLOBLIST_BLOB_ALIGN_LOG2; + hdr->total_size = size; hdr->chksum = 0; gd->bloblist = hdr;
@@ -382,8 +384,13 @@ int bloblist_check(ulong addr, uint size) return log_msg_ret("Bad magic", -ENOENT); if (hdr->version != BLOBLIST_VERSION) return log_msg_ret("Bad version", -EPROTONOSUPPORT); - if (size && hdr->size != size) - return log_msg_ret("Bad size", -EFBIG); + if (!hdr->total_size || (size && hdr->total_size != size)) + return log_msg_ret("Bad total size", -EFBIG); + if (hdr->used_size > hdr->total_size) + return log_msg_ret("Bad used size", -ENOENT); + if (hdr->hdr_size != sizeof(struct bloblist_hdr)) + return log_msg_ret("Bad header size", -ENOENT); + chksum = bloblist_calc_chksum(hdr); if (hdr->chksum != chksum) { log_err("Checksum %x != %x\n", hdr->chksum, chksum); @@ -399,7 +406,7 @@ int bloblist_finish(void) struct bloblist_hdr *hdr = gd->bloblist;
hdr->chksum = bloblist_calc_chksum(hdr); - log_debug("Finished bloblist size %lx at %lx\n", (ulong)hdr->size, + log_debug("Finished bloblist size %lx at %lx\n", (ulong)hdr->used_size, (ulong)map_to_sysmem(hdr));
return 0; @@ -414,33 +421,40 @@ ulong bloblist_get_size(void) { struct bloblist_hdr *hdr = gd->bloblist;
- return hdr->size; + return hdr->used_size; +} + +ulong bloblist_get_total_size(void) +{ + struct bloblist_hdr *hdr = gd->bloblist; + + return hdr->total_size; }
-void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp) +void bloblist_get_stats(ulong *basep, ulong *tsizep, ulong *usizep) { struct bloblist_hdr *hdr = gd->bloblist;
*basep = map_to_sysmem(gd->bloblist); - *sizep = hdr->size; - *allocedp = hdr->alloced; + *tsizep = hdr->total_size; + *usizep = hdr->used_size; }
static void show_value(const char *prompt, ulong value) { - printf("%s:%*s %-5lx ", prompt, 8 - (int)strlen(prompt), "", value); + printf("%s:%*s %-5lx ", prompt, 10 - (int)strlen(prompt), "", value); print_size(value, "\n"); }
void bloblist_show_stats(void) { - ulong base, size, alloced; + ulong base, tsize, usize;
- bloblist_get_stats(&base, &size, &alloced); - printf("base: %lx\n", base); - show_value("size", size); - show_value("alloced", alloced); - show_value("free", size - alloced); + bloblist_get_stats(&base, &tsize, &usize); + printf("base: %lx\n", base); + show_value("total size", tsize); + show_value("used size", usize); + show_value("free", tsize - usize); }
void bloblist_show_list(void) @@ -464,7 +478,7 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size)
memcpy(to, from, from_size); hdr = to; - hdr->size = to_size; + hdr->total_size = to_size; }
int bloblist_init(void) @@ -494,7 +508,7 @@ int bloblist_init(void) addr, ret); } else { /* Get the real size, if it is not what we expected */ - size = gd->bloblist->size; + size = gd->bloblist->total_size; } } if (ret) { diff --git a/include/bloblist.h b/include/bloblist.h index e3c86808b4..84fc943819 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -175,12 +175,12 @@ enum bloblist_tag_t { * @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 * @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 + * @used_size: 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 - * @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. + * @total_size: The number of total bytes that the bloblist can occupy. + * Any blob producer must check if there is sufficient space before adding + * a record to the bloblist. * @flags: Space for BLOBLISTF... flags (none yet) * @spare: Spare space (for future use) */ @@ -190,8 +190,8 @@ struct bloblist_hdr { u8 version; u8 hdr_size; u8 align_log2; - u32 alloced; - u32 size; + u32 used_size; + u32 total_size; u32 flags; u32 spare; }; @@ -366,10 +366,10 @@ int bloblist_finish(void); * This returns useful information about the bloblist * * @basep: Returns base address of bloblist - * @sizep: Returns the number of bytes used in the bloblist - * @allocedp: Returns the total space allocated to the bloblist + * @tsizep: Returns the total number of bytes of the bloblist + * @usizep: Returns the number of used bytes of the bloblist */ -void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp); +void bloblist_get_stats(ulong *basep, ulong *tsizep, ulong *usizep);
/** * bloblist_get_base() - Get the base address of the bloblist @@ -385,6 +385,13 @@ ulong bloblist_get_base(void); */ ulong bloblist_get_size(void);
+/** + * bloblist_get_total_size() - Get the total size of the bloblist + * + * Return: the size in bytes + */ +ulong bloblist_get_total_size(void); + /** * bloblist_show_stats() - Show information about the bloblist * diff --git a/test/bloblist.c b/test/bloblist.c index 29abd46862..17d9dd03d0 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -107,7 +107,8 @@ static int bloblist_test_blob(struct unit_test_state *uts) hdr = clear_bloblist(); ut_assertnull(bloblist_find(TEST_TAG, TEST_BLOBLIST_SIZE)); ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0, 0)); - ut_asserteq(TEST_BLOBLIST_SIZE, bloblist_get_size()); + ut_asserteq(sizeof(struct bloblist_hdr), bloblist_get_size()); + ut_asserteq(TEST_BLOBLIST_SIZE, bloblist_get_total_size()); ut_asserteq(TEST_ADDR, bloblist_get_base()); ut_asserteq(map_to_sysmem(hdr), TEST_ADDR);
@@ -205,9 +206,9 @@ static int bloblist_test_checksum(struct unit_test_state *uts) ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); hdr->flags++;
- hdr->size--; + hdr->total_size--; ut_asserteq(-EFBIG, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); - hdr->size++; + hdr->total_size++;
hdr->spare++; ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); @@ -274,10 +275,10 @@ static int bloblist_test_cmd_info(struct unit_test_state *uts) ut_silence_console(uts); console_record_reset(); run_command("bloblist info", 0); - ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr)); - ut_assert_nextline("size: 400 1 KiB"); - ut_assert_nextline("alloced: 50 80 Bytes"); - ut_assert_nextline("free: 3b0 944 Bytes"); + ut_assert_nextline("base: %lx", (ulong)map_to_sysmem(hdr)); + ut_assert_nextline("total size: 400 1 KiB"); + ut_assert_nextline("used size: 50 80 Bytes"); + ut_assert_nextline("free: 3b0 944 Bytes"); ut_assert_console_end(); ut_unsilence_console(uts);
@@ -431,7 +432,7 @@ static int bloblist_test_grow(struct unit_test_state *uts)
ut_asserteq(sizeof(struct bloblist_hdr) + sizeof(struct bloblist_rec) * 2 + small_size * 2, - hdr->alloced); + hdr->used_size);
/* Resize the first one */ ut_assertok(bloblist_resize(TEST_TAG, small_size + 4)); @@ -453,7 +454,7 @@ static int bloblist_test_grow(struct unit_test_state *uts) ut_asserteq(sizeof(struct bloblist_hdr) + sizeof(struct bloblist_rec) * 2 + small_size * 2 + BLOBLIST_BLOB_ALIGN, - hdr->alloced); + hdr->used_size);
return 0; } @@ -483,7 +484,7 @@ static int bloblist_test_shrink(struct unit_test_state *uts) hdr = ptr; ut_asserteq(sizeof(struct bloblist_hdr) + sizeof(struct bloblist_rec) * 2 + small_size * 2, - hdr->alloced); + hdr->used_size);
/* Resize the first one */ new_size = small_size - BLOBLIST_ALIGN - 4; @@ -503,7 +504,7 @@ static int bloblist_test_shrink(struct unit_test_state *uts) ut_asserteq(sizeof(struct bloblist_hdr) + sizeof(struct bloblist_rec) * 2 + small_size * 2 - BLOBLIST_ALIGN, - hdr->alloced); + hdr->used_size);
return 0; } @@ -531,12 +532,12 @@ static int bloblist_test_resize_fail(struct unit_test_state *uts) hdr = ptr; ut_asserteq(sizeof(struct bloblist_hdr) + sizeof(struct bloblist_rec) * 2 + small_size * 2, - hdr->alloced); + hdr->used_size);
/* Resize the first one, to check the boundary conditions */ ut_asserteq(-EINVAL, bloblist_resize(TEST_TAG, -1));
- new_size = small_size + (hdr->size - hdr->alloced); + new_size = small_size + (hdr->total_size - hdr->used_size); ut_asserteq(-ENOSPC, bloblist_resize(TEST_TAG, new_size + 1)); ut_assertok(bloblist_resize(TEST_TAG, new_size));
@@ -568,9 +569,9 @@ static int bloblist_test_resize_last(struct unit_test_state *uts) /* Check the byte after the last blob */ alloced_val = sizeof(struct bloblist_hdr) + sizeof(struct bloblist_rec) * 2 + small_size * 2; - ut_asserteq(alloced_val, hdr->alloced); + ut_asserteq(alloced_val, hdr->used_size); ut_asserteq_ptr((void *)hdr + alloced_val, blob2 + small_size); - ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + hdr->alloced)); + ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + hdr->used_size));
/* Resize the second one, checking nothing changes */ ut_asserteq(0, bloblist_resize(TEST_TAG2, small_size + 4)); @@ -588,8 +589,8 @@ static int bloblist_test_resize_last(struct unit_test_state *uts)
/* Check that the new top of the allocated blobs has not been touched */ alloced_val += BLOBLIST_BLOB_ALIGN; - ut_asserteq(alloced_val, hdr->alloced); - ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + hdr->alloced)); + ut_asserteq(alloced_val, hdr->used_size); + ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + hdr->used_size));
return 0; }

Hi,
On Mon, Dec 18, 2023 at 6:19 PM Raymond Mao raymond.mao@linaro.org wrote:
Major changes:
Update bloblist to align to Firmware Handoff spec v0.9 (up to commit #3592349 of the spec) (https://github.com/FirmwareHandoff/firmware_handoff).
Includes:
- Align bloblist tags with the FW handoff spec
- Add an explicit alignment field in the header
- Update bloblist magic and version
- Use a packed format for blob record header
- Change the checksum alorigthm
- Use a void entry to handle the alignment
- Adjust the headers of bloblist and blob record
- Align the bloblist record data section start address
In v3, the implementation from boot arguments to bloblist and how to load the FDT from the bloblist are moved to a forthcoming patch serie.
Raymond Mao (1): bloblist: Align bloblist used_size and total_size to spec
Simon Glass (13): bloblist: Update the tag numbering bloblist: Adjust API to align in powers of 2 bloblist: Change the magic value bloblist: Set version to 1 bloblist: Access record hdr_size and tag via a function bloblist: Drop spare value from bloblist record bloblist: Change the checksum algorithm bloblist: Checksum the entire bloblist bloblist: Handle alignment with a void entry bloblist: Reduce blob-header size bloblist: Adjust the bloblist header bloblist: Add alignment to bloblist_new() bloblist: Update documentation and header comment
arch/x86/lib/tables.c | 3 +- common/bloblist.c | 205 ++++++++++++++++++++++++--------------- doc/develop/bloblist.rst | 4 +- include/bloblist.h | 166 ++++++++++++++++++------------- test/bloblist.c | 105 +++++++++++--------- 5 files changed, 287 insertions(+), 196 deletions(-)
-- 2.25.1
Just to say that this series LGTM
Reviewed-by: Simon Glass sjg@chromium.org
Regards, Simonn
participants (3)
-
Ilias Apalodimas
-
Raymond Mao
-
Simon Glass