Repository navigation
fdt: decode /reserved-memory reg directly when ranges is empty - #75
Conversation
boot_fdt_add_mem_rsv_regions() and fdt_add_reserved_regions() called fdt_get_resource() on every child of /reserved-memory, triggering two fdt_parent_offset() full-tree walks per child (~80 ms in initr_lmb on a J616s DTB with 33 reserved regions). When /reserved-memory has an empty or absent ranges property and 1- or 2-cell #address-cells/#size-cells, decode the reg property directly from the parent's cell counts, falling back to fdt_get_resource() otherwise. Signed-off-by: Jonathan Goyvaerts <[email protected]>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Audited full 2-file diff at e5b8826: decoding /reserved-memory child reg directly from the parent's #address-cells and #size-cells when ranges is absent or empty (1- or 2-cell) and falling back to fdt_get_resource() otherwise cleanly avoids repeated root FDT parent walks in both boot/image-fdt.c and common/memtop.c while preserving identical region reservations. Verified J616s reboot results.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
e5b8826 J615 (M3 Air 15", T8122, one-shot aura-try) PASS: booted aura 1.0.0b15 / U-Boot 2026.07-ge5b882687972 into stock 7.3.0-aurora-fleet85 (10.26s to graphical.target, eDP-1 connected), /reserved-memory (#address-cells=2 #size-cells=2 empty ranges, 36/36 regions identical sizes/flags/compatibles, 32/32 nomap + 4/4 map verified in /proc/iomem with 0 misses), Enforcing, 0 failed, 0 AVC, 0 new kernel errors; stock stage2.bin restored. |
What
boot_fdt_add_mem_rsv_regions()inboot/image-fdt.candfdt_add_reserved_regions()incommon/memtop.ccallfdt_get_resource()on every child of/reserved-memory. Eachfdt_get_resource()call walks the flattened device tree from the root twice viafdt_parent_offset(), adding ~80 ms ininitr_lmbon a J616s DTB with 33 reserved regions (and unnecessary FDT walks even with caches enabled).When
/reserved-memoryhas an empty or absentrangesproperty and 1- or 2-cell#address-cells/#size-cells, decode the childregproperty directly from the parent's cell counts, falling back tofdt_get_resource()otherwise.Orthogonal to #58 (early caches) and #65 (on-demand PCIe).
Tested: J616s (MacBook Pro 16-inch M4 Pro, T6040) at e5b8826 on 7.3.0-m4.187 and 7.3.0-m4.190:
apple_m1_defconfigbuilds clean (boot/image-fdt.o,common/memtop.o,u-boot-nodtb.bin),scripts/checkpatch.pl0 errors; verified across 2 consecutive clean reboots with all 33/reserved-memoryregions preserved, 0 failed units, and 0 new kernel errors.Risk: two-way · all Macs