* [PATCH v3 1/6] bloblist: add blob type for DT overlay
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
@ 2025-07-18 14:16 ` Raymond Mao
2025-07-18 14:16 ` [PATCH v3 2/6] bloblist: add helper functions Raymond Mao
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2025-07-18 14:16 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, venkatesh.abbarapu, Raymond Mao, Tom Rini,
Tuomas Tynkkynen, Liviu Dudau, Simon Glass, Ilias Apalodimas,
Harrison Mutai, Andrew Goodbody, Patrick Rudolph,
Jerome Forissier, Heinrich Schuchardt, Evgeny Bachinin,
Matthias Brugger, Casey Connolly, Lad Prabhakar
Add blob type for DT overlay according to the update of Firmware
Handoff spec[1].
Add an inline header to represent the 'subtype' in a DT overlay
blob payload.
[1] Add Transfer Entry for Devicetree Overlay
https://github.com/FirmwareHandoff/firmware_handoff/pull/74
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v2:
- Add inline header for 'subtype'.
Changes in v3:
- None.
common/bloblist.c | 1 +
include/bloblist.h | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/common/bloblist.c b/common/bloblist.c
index 6e4f020d7c4..1c690f58b56 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -43,6 +43,7 @@ static struct tag_name {
{ 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_FDT_OVERLAY, "DT overlay" },
/* BLOBLISTT_AREA_FIRMWARE */
{ BLOBLISTT_TPM2_TCG_LOG, "TPM v2 log space" },
diff --git a/include/bloblist.h b/include/bloblist.h
index f32faf78560..c2d3065a43c 100644
--- a/include/bloblist.h
+++ b/include/bloblist.h
@@ -110,7 +110,8 @@ enum bloblist_tag_t {
BLOBLISTT_ACPI_TABLES = 4,
BLOBLISTT_TPM_EVLOG = 5,
BLOBLISTT_TPM_CRB_BASE = 6,
- BLOBLISTT_ACPI_PP = 7,
+ BLOBLISTT_FDT_OVERLAY = 7,
+ BLOBLISTT_ACPI_PP = 8,
/* Standard area to allocate blobs used across firmware components */
BLOBLISTT_AREA_FIRMWARE = 0x10,
@@ -231,6 +232,16 @@ enum {
BLOBLIST_REC_HDR_SIZE = sizeof(struct bloblist_rec),
};
+/*
+ * struct dto_blob_hdr - Blob inline header for BLOBLISTT_FDT_OVERLAY
+ *
+ * @subtype: IMP-DEF per the agreement between the DT overlay producer and
+ * consumer. Default value is 0.
+ */
+struct dto_blob_hdr {
+ u64 subtype;
+};
+
/**
* bloblist_check_magic() - return a bloblist if the magic matches
*
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v3 2/6] bloblist: add helper functions
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
2025-07-18 14:16 ` [PATCH v3 1/6] bloblist: add blob type for DT overlay Raymond Mao
@ 2025-07-18 14:16 ` Raymond Mao
2025-07-18 14:16 ` [PATCH v3 3/6] bloblist: fix a potential negative size for memmove Raymond Mao
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2025-07-18 14:16 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, venkatesh.abbarapu, Raymond Mao, Tom Rini,
Tuomas Tynkkynen, Liviu Dudau, Simon Glass, Ilias Apalodimas,
Andrew Goodbody, Harrison Mutai, Patrick Rudolph,
Jerome Forissier, Heinrich Schuchardt, Evgeny Bachinin,
Matthias Brugger, Patrice Chotard, Lad Prabhakar
Add two helper functions for:
1. marking a blob void
2. getting blob record from a given blob data pointer.
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v2:
- None.
Changes in v3:
- None.
common/bloblist.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/common/bloblist.c b/common/bloblist.c
index 1c690f58b56..488908f605e 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -97,6 +97,19 @@ static inline uint rec_tag(struct bloblist_rec *rec)
BLOBLISTR_TAG_SHIFT;
}
+static inline void void_blob(struct bloblist_rec *rec)
+{
+ if (rec_tag(rec) == BLOBLISTT_VOID)
+ return;
+ rec->tag_and_hdr_size = BLOBLISTT_VOID |
+ sizeof(*rec) << BLOBLISTR_HDR_SIZE_SHIFT;
+}
+
+static inline struct bloblist_rec *rec_from_blob(void *blob)
+{
+ return (blob - sizeof(struct bloblist_rec));
+}
+
static ulong bloblist_blob_end_ofs(struct bloblist_hdr *hdr,
struct bloblist_rec *rec)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v3 3/6] bloblist: fix a potential negative size for memmove
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
2025-07-18 14:16 ` [PATCH v3 1/6] bloblist: add blob type for DT overlay Raymond Mao
2025-07-18 14:16 ` [PATCH v3 2/6] bloblist: add helper functions Raymond Mao
@ 2025-07-18 14:16 ` Raymond Mao
2025-07-18 14:16 ` [PATCH v3 4/6] bloblist: add API for applying blobs with specified tag Raymond Mao
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2025-07-18 14:16 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, venkatesh.abbarapu, Raymond Mao, Tom Rini,
Tuomas Tynkkynen, Liviu Dudau, Simon Glass, Ilias Apalodimas,
Andrew Goodbody, Dan Carpenter, Harrison Mutai, Patrick Rudolph,
Jerome Forissier, Heinrich Schuchardt, Evgeny Bachinin,
Matthias Brugger, Patrice Chotard, Lad Prabhakar
It causes a panic when blob is shrunk and 'new_alloced' is less than
'next_ofs'. The data area that needs to be moved should end up at
'hdr->used_size'.
Fixes: 1fe59375498f ("bloblist: Support resizing a blob")
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v2:
- None.
Changes in v3:
- None.
common/bloblist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/bloblist.c b/common/bloblist.c
index 488908f605e..550c0c78ffc 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -335,7 +335,7 @@ static int bloblist_resize_rec(struct bloblist_hdr *hdr,
next_ofs = bloblist_blob_end_ofs(hdr, rec);
if (next_ofs != hdr->used_size) {
memmove((void *)hdr + next_ofs + expand_by,
- (void *)hdr + next_ofs, new_alloced - next_ofs);
+ (void *)hdr + next_ofs, hdr->used_size - next_ofs);
}
hdr->used_size = new_alloced;
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v3 4/6] bloblist: add API for applying blobs with specified tag
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
` (2 preceding siblings ...)
2025-07-18 14:16 ` [PATCH v3 3/6] bloblist: fix a potential negative size for memmove Raymond Mao
@ 2025-07-18 14:16 ` Raymond Mao
2025-07-18 14:16 ` [PATCH v3 5/6] fdtdec: apply DT overlays from bloblist Raymond Mao
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2025-07-18 14:16 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, venkatesh.abbarapu, Raymond Mao, Tom Rini,
Tuomas Tynkkynen, Liviu Dudau, Simon Glass, Ilias Apalodimas,
Dan Carpenter, Andrew Goodbody, Patrick Rudolph, Harrison Mutai,
Jerome Forissier, Heinrich Schuchardt, Evgeny Bachinin,
Matthias Brugger, Lad Prabhakar
Add an API to search for the blobs with specified tag and use the
hook function to apply the blob data.
Add a helper function to return the inline header size as according
to recent spec[1] updates, the actual data can be following an inline
header instead of following the TE header immediately.
[1] Firmware Handoff spec:
https://github.com/FirmwareHandoff/firmware_handoff
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v2:
- Add inline header into the blob payload.
- Add arg 'size' to 'bloblist_apply_blobs()' for more general purpose.
Changes in v3:
- Add including errno.h.
common/bloblist.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++
include/bloblist.h | 21 +++++++++++++++++++
2 files changed, 72 insertions(+)
diff --git a/common/bloblist.c b/common/bloblist.c
index 550c0c78ffc..2b5026e00da 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -235,6 +235,19 @@ static int bloblist_ensurerec(uint tag, struct bloblist_rec **recp, int size,
return 0;
}
+static int bloblist_get_blob_data_offset(uint tag)
+{
+ switch (tag) {
+ case BLOBLISTT_FDT_OVERLAY:
+ return sizeof(struct dto_blob_hdr);
+ /*
+ * return the data offset if it is not following the blob
+ * header immediately.
+ */
+ }
+ return 0;
+}
+
void *bloblist_find(uint tag, int size)
{
void *blob = NULL;
@@ -261,6 +274,44 @@ void *bloblist_get_blob(uint tag, int *sizep)
return (void *)rec + rec_hdr_size(rec);
}
+int bloblist_apply_blobs(uint tag, int (*func)(void **data, int size))
+{
+ struct bloblist_hdr *hdr = gd->bloblist;
+ struct bloblist_rec *rec;
+
+ if (!func || !hdr)
+ return -ENOENT;
+
+ foreach_rec(rec, hdr) {
+ /* Apply all blobs with the specified tag */
+ if (rec_tag(rec) == tag) {
+ int ret;
+ int tag = rec_tag(rec);
+ void *blob = (void *)rec + rec_hdr_size(rec);
+ int dat_off = bloblist_get_blob_data_offset(tag);
+
+ blob += dat_off;
+ ret = func(&blob, rec->size - dat_off);
+ if (ret) {
+ log_err("Failed to apply blob with tag %d\n",
+ tag);
+ return ret;
+ }
+
+ rec = rec_from_blob(blob - dat_off);
+ if (rec <= 0) {
+ log_err("Blob corrupted\n");
+ return -ENOENT;
+ }
+
+ /* Mark applied blob record as void */
+ void_blob(rec);
+ }
+ }
+
+ return 0;
+}
+
void *bloblist_add(uint tag, int size, int align_log2)
{
struct bloblist_rec *rec;
diff --git a/include/bloblist.h b/include/bloblist.h
index c2d3065a43c..e67b2a76358 100644
--- a/include/bloblist.h
+++ b/include/bloblist.h
@@ -73,6 +73,7 @@
#define __BLOBLIST_H
#include <mapmem.h>
+#include <linux/errno.h>
enum {
BLOBLIST_VERSION = 1,
@@ -279,6 +280,26 @@ static inline void *bloblist_get_blob(uint tag, int *sizep)
}
#endif
+#if CONFIG_IS_ENABLED(BLOBLIST)
+/**
+ * bloblist_apply_blobs() - Apply the data of blobs by tag
+ *
+ * Scan the bloblist, find the blobs with the matching tag and apply the data
+ * of blobs
+ *
+ * @tag: Tag to search for (enum bloblist_tag_t)
+ * @func: Function to apply the data of blobs
+ * Return: 0 if OK, otherwise error.
+ */
+int bloblist_apply_blobs(uint tag, int (*func)(void **data, int size));
+#else
+static inline int bloblist_apply_blobs(uint tag,
+ int (*func)(void **data, int size))
+{
+ return -EPERM;
+}
+#endif
+
/**
* bloblist_find() - Find a blob
*
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v3 5/6] fdtdec: apply DT overlays from bloblist
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
` (3 preceding siblings ...)
2025-07-18 14:16 ` [PATCH v3 4/6] bloblist: add API for applying blobs with specified tag Raymond Mao
@ 2025-07-18 14:16 ` Raymond Mao
2025-07-18 14:16 ` [PATCH v3 6/6] configs: Select OF_LIBFDT_OVERLAY to hand over DTO via bloblist Raymond Mao
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2025-07-18 14:16 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, venkatesh.abbarapu, Raymond Mao, Tom Rini,
Tuomas Tynkkynen, Liviu Dudau, Simon Glass, Ilias Apalodimas,
Dan Carpenter, Andrew Goodbody, Patrick Rudolph, Harrison Mutai,
Heinrich Schuchardt, Jerome Forissier, Evgeny Bachinin,
Matthias Brugger, Patrice Chotard, Lad Prabhakar
During FDT setup, apply all existing DT overlays from the bloblist
to the base FDT if bloblist is being used for handoff from previous
boot stage.
According to the Firmware Handoff spec update to support DT overlay [1],
an overlay must have the same top-level compatible string as its target
base DT has.
Before applying the overlays, check whether sufficient space is
reserved in the base DT blob, if not, resize the blob to the allowed
padded size, which is limited by CONFIG_SYS_FDT_PAD and the bloblist
spare space size.
After all overlays are applied, resize the merged DT to its actual size.
[1] Add Transfer Entry for Devicetree Overlay
https://github.com/FirmwareHandoff/firmware_handoff/pull/74
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v2:
- Add more details into the commit message.
- Check and compare the top-level compatible string of DT/DTO.
- Check the reserved space in the base DT region, and skip resizing if
the space is sufficient.
- Move the DT space shrinking to the end after all DT overlays are
applied.
Changes in v3:
- Move resizing to the beginning and only do one time.
- The max size to resize depends on SYS_FDT_PAD and the spare space left
in the bloblist.
- Renaming and misc refactoring.
lib/fdtdec.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index c38738b48c7..630b7d2bd69 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1687,6 +1687,83 @@ void fdtdec_setup_embed(void)
gd->fdt_src = FDTSRC_EMBED;
}
+static int fdtdec_match_dto_compatible(const void *base, const void *dto)
+{
+ const char *compat_base;
+ const char *compat_dto;
+ int len;
+
+ compat_base = (const char *)fdt_getprop(base, 0, "compatible", &len);
+ if (!compat_base || len <= 0)
+ return -ENOENT;
+
+ compat_dto = (const char *)fdt_getprop(dto, 0, "compatible", &len);
+ if (!compat_dto || len <= 0)
+ return -ENOENT;
+
+ if (strcmp(compat_base, compat_dto))
+ return -EPERM;
+
+ return 0;
+}
+
+static int fdtdec_apply_dto_blob(void **blob, __maybe_unused int size)
+{
+ int ret;
+
+ ret = fdt_check_header(*blob);
+ if (ret)
+ return ret;
+
+ ret = fdtdec_match_dto_compatible(gd->fdt_blob, *blob);
+ if (ret)
+ return ret;
+
+ return fdt_overlay_apply_verbose((void *)gd->fdt_blob, *blob);
+}
+
+static int fdtdec_apply_bloblist_dtos(void)
+{
+ int ret;
+ struct fdt_header *live_fdt;
+ int blob_size;
+ size_t padded_size, max_size;
+
+ if (!CONFIG_IS_ENABLED(OF_LIBFDT_OVERLAY) ||
+ !CONFIG_IS_ENABLED(BLOBLIST))
+ return 0;
+
+ /* Get the total space reserved for FDT in blob */
+ live_fdt = bloblist_get_blob(BLOBLISTT_CONTROL_FDT, &blob_size);
+ if (live_fdt != gd->fdt_blob)
+ return -ENOENT;
+
+ /* Calculate the allowed padded size */
+ padded_size = fdt_totalsize(live_fdt) + CONFIG_SYS_FDT_PAD;
+ max_size = bloblist_get_total_size() - bloblist_get_size() + blob_size;
+ if (padded_size > max_size)
+ padded_size = max_size;
+
+ /* Resize if the current space is not sufficient */
+ if (blob_size < padded_size) {
+ ret = bloblist_resize(BLOBLISTT_CONTROL_FDT, padded_size);
+ if (ret)
+ return ret;
+
+ ret = fdt_open_into(live_fdt, live_fdt, padded_size);
+ if (ret)
+ return ret;
+ }
+
+ ret = bloblist_apply_blobs(BLOBLISTT_FDT_OVERLAY, fdtdec_apply_dto_blob);
+ if (ret)
+ return ret;
+
+ /* Shink the blob to the actual FDT size */
+ fdt_pack(live_fdt);
+ return bloblist_resize(BLOBLISTT_CONTROL_FDT, fdt_totalsize(live_fdt));
+}
+
int fdtdec_setup(void)
{
int ret = -ENOENT;
@@ -1708,6 +1785,9 @@ int fdtdec_setup(void)
gd->fdt_src = FDTSRC_BLOBLIST;
log_debug("Devicetree is in bloblist at %p\n",
gd->fdt_blob);
+ ret = fdtdec_apply_bloblist_dtos();
+ if (ret)
+ return ret;
goto setup_fdt;
} else {
log_debug("No FDT found in bloblist\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v3 6/6] configs: Select OF_LIBFDT_OVERLAY to hand over DTO via bloblist
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
` (4 preceding siblings ...)
2025-07-18 14:16 ` [PATCH v3 5/6] fdtdec: apply DT overlays from bloblist Raymond Mao
@ 2025-07-18 14:16 ` Raymond Mao
2025-08-20 5:15 ` [PATCH v3 0/6] Add support for DT overlays handoff Abbarapu, Venkatesh
2026-04-17 20:39 ` Raymond Mao
7 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2025-07-18 14:16 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, venkatesh.abbarapu, Raymond Mao, Tom Rini,
Tuomas Tynkkynen, Liviu Dudau, Simon Glass, Ilias Apalodimas,
Andrew Goodbody, Harrison Mutai, Patrick Rudolph,
Jerome Forissier, Heinrich Schuchardt, Evgeny Bachinin,
Matthias Brugger, Lad Prabhakar
Select OF_LIBFDT_OVERLAY for qemu_arm64 and vexpress_fvp_bloblist
to hand over DTO via bloblist.
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
---
Changes in v3:
- Initial patch.
configs/qemu_arm64_defconfig | 1 +
configs/vexpress_fvp_bloblist_defconfig | 1 +
2 files changed, 2 insertions(+)
diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig
index 39afb837e41..a63cef0c1ea 100644
--- a/configs/qemu_arm64_defconfig
+++ b/configs/qemu_arm64_defconfig
@@ -7,6 +7,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x40200000
CONFIG_ENV_SIZE=0x40000
CONFIG_ENV_SECT_SIZE=0x40000
CONFIG_DEFAULT_DEVICE_TREE="qemu-arm64"
+CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_SYS_LOAD_ADDR=0x40200000
CONFIG_DEBUG_UART_BASE=0x9000000
CONFIG_DEBUG_UART_CLOCK=0
diff --git a/configs/vexpress_fvp_bloblist_defconfig b/configs/vexpress_fvp_bloblist_defconfig
index 4d52b96202b..6cd0365ec68 100644
--- a/configs/vexpress_fvp_bloblist_defconfig
+++ b/configs/vexpress_fvp_bloblist_defconfig
@@ -1,5 +1,6 @@
#include <configs/vexpress_fvp_defconfig>
+CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_BLOBLIST=y
CONFIG_BLOBLIST_PASSAGE_MANDATORY=y
CONFIG_BLOBLIST_SIZE_RELOC=0x10000
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* RE: [PATCH v3 0/6] Add support for DT overlays handoff
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
` (5 preceding siblings ...)
2025-07-18 14:16 ` [PATCH v3 6/6] configs: Select OF_LIBFDT_OVERLAY to hand over DTO via bloblist Raymond Mao
@ 2025-08-20 5:15 ` Abbarapu, Venkatesh
2025-08-21 14:23 ` Raymond Mao
2026-04-17 20:39 ` Raymond Mao
7 siblings, 1 reply; 10+ messages in thread
From: Abbarapu, Venkatesh @ 2025-08-20 5:15 UTC (permalink / raw)
To: Raymond Mao, u-boot@lists.denx.de
Cc: Simek, Michal, Tom Rini, Tuomas Tynkkynen, Liviu Dudau,
Simon Glass, Ilias Apalodimas, Dan Carpenter, Patrick Rudolph,
Andrew Goodbody, Harrison Mutai, Jerome Forissier,
Heinrich Schuchardt, Evgeny Bachinin, Matthias Brugger,
Lad Prabhakar
[-- Attachment #1: Type: text/plain, Size: 3271 bytes --]
[AMD Official Use Only - AMD Internal Distribution Only]
Hi @Raymond Mao,
I was trying to test these patches with the transfer list binary which contains tl.bin(dtb+dtbo) inside it. Facing issue with the dtbo address and fdt_check_header(*blob) from fdtdec_apply_dto_blob() gets the invalid magic num.
fdt_magic=0x38 fdt_chk_version=0x1
Attaching the log with details. Let me know if you need any other information.
Thanks
Venkatesh
> -----Original Message-----
> From: Raymond Mao <raymond.mao@linaro.org>
> Sent: Friday, July 18, 2025 7:46 PM
> To: u-boot@lists.denx.de
> Cc: Simek, Michal <michal.simek@amd.com>; Abbarapu, Venkatesh
> <venkatesh.abbarapu@amd.com>; Raymond Mao <raymond.mao@linaro.org>;
> Tom Rini <trini@konsulko.com>; Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>;
> Liviu Dudau <liviu.dudau@foss.arm.com>; Simon Glass <sjg@chromium.org>; Ilias
> Apalodimas <ilias.apalodimas@linaro.org>; Dan Carpenter
> <dan.carpenter@linaro.org>; Patrick Rudolph <patrick.rudolph@9elements.com>;
> Andrew Goodbody <andrew.goodbody@linaro.org>; Harrison Mutai
> <harrison.mutai@arm.com>; Jerome Forissier <jerome.forissier@linaro.org>;
> Heinrich Schuchardt <xypron.glpk@gmx.de>; Evgeny Bachinin
> <EABachinin@salutedevices.com>; Matthias Brugger <mbrugger@suse.com>; Lad
> Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: [PATCH v3 0/6] Add support for DT overlays handoff
>
> The series include refactoring on bloblist and fdtdec to support handoff of multiple
> DT overlays and applying them into the DT base during setup.
> All changes are aligned to the spec update for supporting DT overlay handoff[1].
>
> Notes for testing:
>
> Currently DT overlay is not yet enabled in TF-A, but with the test patches I provided
> for TF-A and OP-TEE build, importing a DT overlay blob file from QEMU to TF-A
> reserved memory is supported.
> Follow below instructions to build and run for test:
> $ repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml Replace your
> local qemu_v8.xml with [2], which contains all necessary changes in both TF-A and
> OP-TEE build.
> $ repo sync
> $ cd build
> $ make toolchains
> $ make ARM_FIRMWARE_HANDOFF=y all
> Copy and rename your DT overlay blob as 'qemu_v8.dtb' into out/bin $ make
> ARM_FIRMWARE_HANDOFF=y run-only
>
> [1] Add Transfer Entry for Devicetree Overlay
> https://github.com/FirmwareHandoff/firmware_handoff/pull/74
>
> [2]
> https://github.com/raymo200915/optee_manifest/blob/dt_overlay_handoff/qemu_v8.x
> ml
>
> Raymond Mao (6):
> bloblist: add blob type for DT overlay
> bloblist: add helper functions
> bloblist: fix a potential negative size for memmove
> bloblist: add API for applying blobs with specified tag
> fdtdec: apply DT overlays from bloblist
> configs: Select OF_LIBFDT_OVERLAY to hand over DTO via bloblist
>
> common/bloblist.c | 67 ++++++++++++++++++++-
> configs/qemu_arm64_defconfig | 1 +
> configs/vexpress_fvp_bloblist_defconfig | 1 +
> include/bloblist.h | 34 ++++++++++-
> lib/fdtdec.c | 80 +++++++++++++++++++++++++
> 5 files changed, 181 insertions(+), 2 deletions(-)
>
> --
> 2.25.1
[-- Attachment #2: tl_info_with_dtb_dtbo_log.txt --]
[-- Type: text/plain, Size: 4378 bytes --]
TF-A log with the transfer list dump:
======================================
INFO: Dump transfer list:
INFO: signature 0x4a0fb10b
INFO: checksum 0xbd
INFO: version 0x1
INFO: hdr_size 0x18
INFO: alignment 0x3
INFO: size 0xd700
INFO: max_size 0x600000
INFO: flags 0x1
INFO: Entry 0:
INFO: tag_id 0x102
INFO: hdr_size 0x8
INFO: data_size 0x58
INFO: data_addr 0x1000020
INFO: Entry 1:
INFO: tag_id 0x102
INFO: hdr_size 0x8
INFO: data_size 0x58
INFO: data_addr 0x1000080
INFO: Entry 2:
INFO: tag_id 0x1
INFO: hdr_size 0x8
INFO: data_size 0xd3d2
INFO: data_addr 0x10000e0
INFO: Entry 3:
INFO: tag_id 0x7
INFO: hdr_size 0x8
INFO: data_size 0x240
INFO: data_addr 0x100d4c0
INFO: Transfer list version is valid for all operations
===========================================================
UBOOT LOG:
============================================================
==========start of bloblist_show_list=======
bloblist_show_list: hdr=0x1000000
Address Size Tag Name
01000020 58 102 invalid
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0x18 rec->size=0x58
bloblist_blob_end_ofs: 2:offset=0x78 rec->size=0x58
bloblist_blob_end_ofs: 3:offset=0x80 rec->size=0x58
bloblist_next_blob: offset=0x78
01000080 58 102 invalid
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0x78 rec->size=0x58
bloblist_blob_end_ofs: 2:offset=0xd8 rec->size=0x58
bloblist_blob_end_ofs: 3:offset=0xe0 rec->size=0x58
bloblist_next_blob: offset=0xd8
010000e0 d3d2 1 Control FDT
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0xd8 rec->size=0xd3d2
bloblist_blob_end_ofs: 2:offset=0xd4b2 rec->size=0xd3d2
bloblist_blob_end_ofs: 3:offset=0xd4c0 rec->size=0xd3d2
bloblist_next_blob: offset=0xd4b8
0100d4c0 240 7 DT overlay
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0xd4b8 rec->size=0x240
bloblist_blob_end_ofs: 2:offset=0xd700 rec->size=0x240
bloblist_blob_end_ofs: 3:offset=0xd708 rec->size=0x240
bloblist_next_blob: offset=0xd700
==========end of bloblist_show_list=====================
The above dump is from the function bloblist_init() and enabled the DEBUG option and the dtbo overlay is at 0x100d4c0 which is perfect.
From the fdtdec_setup() function the fdtdec_apply_bloblist_dtos() because of padded_size the dtbo address is extended
to 0x10104c8 and which inturn failing at fdt_check_header().
fdtdec_apply_bloblist_dtos: live_fdt=0x10000e0
fdtdec_apply_bloblist_dtos: blob_size=0xd3d2 max_size=0x5ffcd2 padded_size=0x103d2
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0x18 rec->size=0x58
bloblist_blob_end_ofs: 2:offset=0x78 rec->size=0x58
bloblist_blob_end_ofs: 3:offset=0x80 rec->size=0x58
bloblist_next_blob: offset=0x78
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0x78 rec->size=0x58
bloblist_blob_end_ofs: 2:offset=0xd8 rec->size=0x58
bloblist_blob_end_ofs: 3:offset=0xe0 rec->size=0x58
bloblist_next_blob: offset=0xd8
bloblist_blob_end_ofs: offset=0xd8 rec->size=0xd3d2
bloblist_blob_end_ofs: 2:offset=0xd4b2 rec->size=0xd3d2
bloblist_blob_end_ofs: 3:offset=0xd4c0 rec->size=0xd3d2
============bloblist_apply_blobs: hdr=0x1000000 tag=07
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0x18 rec->size=0x58
bloblist_blob_end_ofs: 2:offset=0x78 rec->size=0x58
bloblist_blob_end_ofs: 3:offset=0x80 rec->size=0x58
bloblist_next_blob: offset=0x78
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0x78 rec->size=0x58
bloblist_blob_end_ofs: 2:offset=0xd8 rec->size=0x58
bloblist_blob_end_ofs: 3:offset=0xe0 rec->size=0x58
bloblist_next_blob: offset=0xd8
bloblist_next_blob: hdr=0x1000000
bloblist_blob_end_ofs: offset=0xd8 rec->size=0x103d2
bloblist_blob_end_ofs: 2:offset=0x104b2 rec->size=0x103d2
bloblist_blob_end_ofs: 3:offset=0x104c0 rec->size=0x103d2
bloblist_next_blob: offset=0x104b8
bloblist_apply_blobs: tag=7 blob=0x10104c0
bloblist_apply_blobs: dat_off of dtbo=0x8
bloblist_apply_blobs: blob_datoffset=0x10104c8 rec_size=0x240
===============fdtdec_apply_dto_blob: size=0x238
=========fdt_check_header====fdt=0x10104c8
fdt_magic=0x38 fdt_chk_version=0x1
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH v3 0/6] Add support for DT overlays handoff
2025-08-20 5:15 ` [PATCH v3 0/6] Add support for DT overlays handoff Abbarapu, Venkatesh
@ 2025-08-21 14:23 ` Raymond Mao
0 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2025-08-21 14:23 UTC (permalink / raw)
To: Abbarapu, Venkatesh
Cc: u-boot@lists.denx.de, Simek, Michal, Tom Rini, Tuomas Tynkkynen,
Liviu Dudau, Simon Glass, Ilias Apalodimas, Dan Carpenter,
Patrick Rudolph, Andrew Goodbody, Harrison Mutai,
Jerome Forissier, Heinrich Schuchardt, Evgeny Bachinin,
Matthias Brugger, Lad Prabhakar
Hi Venkatesh,
On Wed, 20 Aug 2025 at 01:15, Abbarapu, Venkatesh
<venkatesh.abbarapu@amd.com> wrote:
>
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> Hi @Raymond Mao,
> I was trying to test these patches with the transfer list binary which contains tl.bin(dtb+dtbo) inside it. Facing issue with the dtbo address and fdt_check_header(*blob) from fdtdec_apply_dto_blob() gets the invalid magic num.
Currently, DTO support is not enabled in TF-A qemu - It won't append a
DTO via qemu so I am not sure if you had your own patch or platform
code to make this work.
To verify this U-Boot patch, please simply follow the 'Notes for
testing' in my cover letter, my working branch referred by my manifest
provides necessary changes for TF-A and OP-TEE to allow loading a DTO
file via qemu, place it into a TF-A reserved memory and append it as a
TE.
Regards,
Raymond
> fdt_magic=0x38 fdt_chk_version=0x1
>
> Attaching the log with details. Let me know if you need any other information.
>
> Thanks
> Venkatesh
>
> > -----Original Message-----
> > From: Raymond Mao <raymond.mao@linaro.org>
> > Sent: Friday, July 18, 2025 7:46 PM
> > To: u-boot@lists.denx.de
> > Cc: Simek, Michal <michal.simek@amd.com>; Abbarapu, Venkatesh
> > <venkatesh.abbarapu@amd.com>; Raymond Mao <raymond.mao@linaro.org>;
> > Tom Rini <trini@konsulko.com>; Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>;
> > Liviu Dudau <liviu.dudau@foss.arm.com>; Simon Glass <sjg@chromium.org>; Ilias
> > Apalodimas <ilias.apalodimas@linaro.org>; Dan Carpenter
> > <dan.carpenter@linaro.org>; Patrick Rudolph <patrick.rudolph@9elements.com>;
> > Andrew Goodbody <andrew.goodbody@linaro.org>; Harrison Mutai
> > <harrison.mutai@arm.com>; Jerome Forissier <jerome.forissier@linaro.org>;
> > Heinrich Schuchardt <xypron.glpk@gmx.de>; Evgeny Bachinin
> > <EABachinin@salutedevices.com>; Matthias Brugger <mbrugger@suse.com>; Lad
> > Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Subject: [PATCH v3 0/6] Add support for DT overlays handoff
> >
> > The series include refactoring on bloblist and fdtdec to support handoff of multiple
> > DT overlays and applying them into the DT base during setup.
> > All changes are aligned to the spec update for supporting DT overlay handoff[1].
> >
> > Notes for testing:
> >
> > Currently DT overlay is not yet enabled in TF-A, but with the test patches I provided
> > for TF-A and OP-TEE build, importing a DT overlay blob file from QEMU to TF-A
> > reserved memory is supported.
> > Follow below instructions to build and run for test:
> > $ repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml Replace your
> > local qemu_v8.xml with [2], which contains all necessary changes in both TF-A and
> > OP-TEE build.
> > $ repo sync
> > $ cd build
> > $ make toolchains
> > $ make ARM_FIRMWARE_HANDOFF=y all
> > Copy and rename your DT overlay blob as 'qemu_v8.dtb' into out/bin $ make
> > ARM_FIRMWARE_HANDOFF=y run-only
> >
> > [1] Add Transfer Entry for Devicetree Overlay
> > https://github.com/FirmwareHandoff/firmware_handoff/pull/74
> >
> > [2]
> > https://github.com/raymo200915/optee_manifest/blob/dt_overlay_handoff/qemu_v8.x
> > ml
> >
> > Raymond Mao (6):
> > bloblist: add blob type for DT overlay
> > bloblist: add helper functions
> > bloblist: fix a potential negative size for memmove
> > bloblist: add API for applying blobs with specified tag
> > fdtdec: apply DT overlays from bloblist
> > configs: Select OF_LIBFDT_OVERLAY to hand over DTO via bloblist
> >
> > common/bloblist.c | 67 ++++++++++++++++++++-
> > configs/qemu_arm64_defconfig | 1 +
> > configs/vexpress_fvp_bloblist_defconfig | 1 +
> > include/bloblist.h | 34 ++++++++++-
> > lib/fdtdec.c | 80 +++++++++++++++++++++++++
> > 5 files changed, 181 insertions(+), 2 deletions(-)
> >
> > --
> > 2.25.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 0/6] Add support for DT overlays handoff
2025-07-18 14:16 [PATCH v3 0/6] Add support for DT overlays handoff Raymond Mao
` (6 preceding siblings ...)
2025-08-20 5:15 ` [PATCH v3 0/6] Add support for DT overlays handoff Abbarapu, Venkatesh
@ 2026-04-17 20:39 ` Raymond Mao
7 siblings, 0 replies; 10+ messages in thread
From: Raymond Mao @ 2026-04-17 20:39 UTC (permalink / raw)
To: u-boot
Cc: michal.simek, venkatesh.abbarapu, Tom Rini, Tuomas Tynkkynen,
Liviu Dudau, Simon Glass, Ilias Apalodimas, Dan Carpenter,
Patrick Rudolph, Andrew Goodbody, Harrison Mutai,
Jerome Forissier, Heinrich Schuchardt, Evgeny Bachinin,
Matthias Brugger, Lad Prabhakar, raymondmaoca
Hi,
The Firmware Handoff spec changes required for this series is already accepted and merged at [1].
Please review and merge this series.
[1] Add Transfer Entry for Devicetree Overlay
https://github.com/FirmwareHandoff/firmware_handoff/pull/74
Thanks and regards,
Raymond
On 2025-07-18 10:16 a.m., Raymond Mao wrote:
> The series include refactoring on bloblist and fdtdec to support handoff
> of multiple DT overlays and applying them into the DT base during setup.
> All changes are aligned to the spec update for supporting DT overlay
> handoff[1].
>
> Notes for testing:
>
> Currently DT overlay is not yet enabled in TF-A, but with the test patches
> I provided for TF-A and OP-TEE build, importing a DT overlay blob file from
> QEMU to TF-A reserved memory is supported.
> Follow below instructions to build and run for test:
> $ repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml
> Replace your local qemu_v8.xml with [2], which contains all necessary
> changes in both TF-A and OP-TEE build.
> $ repo sync
> $ cd build
> $ make toolchains
> $ make ARM_FIRMWARE_HANDOFF=y all
> Copy and rename your DT overlay blob as 'qemu_v8.dtb' into out/bin
> $ make ARM_FIRMWARE_HANDOFF=y run-only
>
> [1] Add Transfer Entry for Devicetree Overlay
> https://github.com/FirmwareHandoff/firmware_handoff/pull/74
>
> [2] https://github.com/raymo200915/optee_manifest/blob/dt_overlay_handoff/qemu_v8.xml
>
> Raymond Mao (6):
> bloblist: add blob type for DT overlay
> bloblist: add helper functions
> bloblist: fix a potential negative size for memmove
> bloblist: add API for applying blobs with specified tag
> fdtdec: apply DT overlays from bloblist
> configs: Select OF_LIBFDT_OVERLAY to hand over DTO via bloblist
>
> common/bloblist.c | 67 ++++++++++++++++++++-
> configs/qemu_arm64_defconfig | 1 +
> configs/vexpress_fvp_bloblist_defconfig | 1 +
> include/bloblist.h | 34 ++++++++++-
> lib/fdtdec.c | 80 +++++++++++++++++++++++++
> 5 files changed, 181 insertions(+), 2 deletions(-)
>
^ permalink raw reply [flat|nested] 10+ messages in thread