Skip to content

fdt: decode /reserved-memory reg directly when ranges is empty - #75

Merged
DjDeveloperr merged 1 commit into
aurora-wipfrom
feat/fdt-reserved-memory-direct-reg
Nov 26, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-wipfrom
feat/fdt-reserved-memory-direct-reg

Conversation

@jgoyvaerts

Copy link
Copy Markdown

What

boot_fdt_add_mem_rsv_regions() in boot/image-fdt.c and fdt_add_reserved_regions() in common/memtop.c call fdt_get_resource() on every child of /reserved-memory. Each fdt_get_resource() call walks the flattened device tree from the root twice via fdt_parent_offset(), adding ~80 ms in initr_lmb on a J616s DTB with 33 reserved regions (and unnecessary FDT walks even with caches enabled).

When /reserved-memory has an empty or absent ranges property and 1- or 2-cell #address-cells/#size-cells, decode the child reg property directly from the parent's cell counts, falling back to fdt_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_defconfig builds clean (boot/image-fdt.o, common/memtop.o, u-boot-nodtb.bin), scripts/checkpatch.pl 0 errors; verified across 2 consecutive clean reboots with all 33 /reserved-memory regions preserved, 0 failed units, and 0 new kernel errors.

Risk: two-way · all Macs

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 DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot added blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot) labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown

Merge readiness at e5b88268: ready to merge

Check Detail
CI at head ok 2 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at e5b88268
Conflicts ok none
PR text ok Risk: two-way · all Macs

Areas: none matched in CODEOWNERS
Merge: gh pr merge 75 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@RyanTheTide

Copy link
Copy Markdown
Contributor

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.

@DjDeveloperr
DjDeveloperr merged commit 0f65cb4 into aurora-wip Nov 26, 2026
3 checks passed
@RyanTheTide
RyanTheTide deleted the feat/fdt-reserved-memory-direct-reg branch November 27, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants