Skip to content

Validate device tree node in SCMI/Power/IOMMU

Peng Fan (OSS) u-boot 1 version New

Get series with b4
b4 am [email protected] change-id 20260210-scmi-fix-8f8ae5f6abce

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3firmware: scmi: Validate device tree node before setup channeldrivers/firmware/scmi/mailbox_agent.c drivers/firmware/scmi/optee_agent.c+3 -20 replies
2/3power: domain: Validate device tree node in dev_power_domain_ctrldrivers/power/domain/power-domain-uclass.c+3 -00 replies
3/3iommu: Validate device tree node in dev_iommu_enabledrivers/iommu/iommu-uclass.c+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Validate device tree node in SCMI/Power/IOMMU

commit 0535e46d55d ("scripts/dtc: Update to upstream version v1.7.2-35-g52f07dcca47c"), causes i.MX9 SCMI based platforms boot failure.
SPL panic in fdt_check_node_offset_()->fdt_next_tag(), because offset is -1 and SPL_OF_LIBFDT_ASSUME_MASK is 0xFF.

fdt_check_node_offset_()

       |->fdt_next_tag()
             |->tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE);  #tagp is NULL
	            |->tag = fdt32_to_cpu(*tagp);                 #panic here

In [1], Ye report the issue, but per Tom:
"In SPL we must assume a perfect device tree has been passed to us, both for design reasons (it's not a user interactively, we built it, or it came from some other firmware stack) as well as practical (performing the sanity tests would grow all platforms by several kilobytes and overflow size constraints). I think the SCMI code needs to be reworked, in short"

So we need to add a check in scmi transport driver, also need to add a check in dev_power_domain_ctrl and iommu. Similar to the check in pinctrl_select_state and the check before call into clk_set_defaults, if ofnode is not valid, directly bypass. With this change, we could still keep SPL_OF_LIBFDT_ASSUME_MASK as 0xFF.

https://lore.kernel.org/u-boot/20260207141750.GB2603314@bill-the-cat/

---
Peng Fan (3):
firmware: scmi: Validate device tree node before setup channel
power: domain: Validate device tree node in dev_power_domain_ctrl
iommu: Validate device tree node in dev_iommu_enable

 drivers/firmware/scmi/mailbox_agent.c      | 2 +-
 drivers/firmware/scmi/optee_agent.c        | 3 ++-
 drivers/iommu/iommu-uclass.c               | 3 +++
 drivers/power/domain/power-domain-uclass.c | 3 +++
 4 files changed, 9 insertions(+), 2 deletions(-)

---
base-commit: b99da05e1538b8fa153322da82917af2aa27e1d6
change-id: 20260210-scmi-fix-8f8ae5f6abce

Best regards,

Signature · 1 line
Peng Fan <[email protected]>