Skip to content

kboot: hand the J713 ISP firmware over to the kernel - #84

Merged
RyanTheTide merged 2 commits into
mainfrom
j713/isp-handoff
Nov 6, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
j713/isp-handoff

Conversation

@erikwb

@erikwb erikwb commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

On the M4 MacBook Air (J713, T8132), iBoot loads the camera (ISP) firmware outside the kernel's memory, at addresses that move with the boot firmware. The J713 camera series (aurora-silicon/linux#531) used to reserve them at fixed addresses in the DT. Now its DT describes the ISP and its DARTs disabled, with empty isp-firmware-text/isp-firmware-data placeholders and the isp-heap window, and leaves this boot's values to the boot loader.

Change

dt_set_j713_isp() runs right after dt_set_isp(). It acts only on J713, and only on a disabled apple,t8132-isp that has the placeholders:

  • Placeholders: it reads the ADT isp node's two segment-ranges (__TEXT;__DATA) and fills each placeholder: reg at the segment's physical address, no-map, status = "okay", and iommu-addresses where the firmware runs the segment (its remap), set through dt_device_set_reserved_mem().
  • Platform ID: apple,platform-id comes from the ADT isp node's sensor-type.
  • Enable: the ISP and its three DARTs.
  • Fail closed:
    • The DT has to match: memory-region-names text/data/heap pointing at the three nodes, empty (or zero) placeholders, an ISP-owned heap window at 0x100_0000_0000 of at most 64 MiB, and three DARTs.
    • So does the ADT: 16K-aligned segments that lie inside DRAM and don't overlap, with TEXT at the base of the heap window and DATA right above it, below the window's top, and a nonzero sensor-type.
    • It all runs in a display transaction. A refusal leaves the tree as it was and is logged, the camera stays disabled, and the boot goes on.
  • Left alone: other machines, trees without the placeholders, and an ISP that is already enabled (a kernel DT that still reserves the firmware itself).

Depends on

Tests

  • New tests/python/test_j713_isp_handoff.py. It builds the real kboot code against libfdt, with the J713 DT fragment and a fake ADT that carries this J713's segment-ranges, and checks that:

    • the handoff fills both regions, sets platform ID 0x17 and enables the ISP and its DARTs, and leaves the heap window untouched;
    • twelve refusals leave the blob byte-identical and the ISP disabled. The faults are: wrong segment names, no sensor-type or a zero one, DATA not right above TEXT, TEXT below DRAM, DRAM smaller than a segment, DATA past the heap top, overlapping segments, a heap window elsewhere, a non-empty placeholder, wrong memory-region-names, and an unaligned segment;
    • an enabled ISP, a tree without the placeholders and another chip are left alone.

    Removing the contiguity check or the transaction makes it fail.

  • Host suite (tests/python), x86_64 Linux: 579 passed, 17 skipped.

  • Builds:

    • the release build with USE_CLANG=1 is clean;
    • make ARCH=aarch64-linux-gnu- CHAINLOADING=1 EXTRA_CFLAGS='-Wstack-usage=2048 -Os' shows only the existing warnings.
  • clang-format: the change is clean. make format-check also fails on main here, on src/utils.h with clang-format 23.1.4.

Hardware

On a J713 with this commit on its boot loader, the U-Boot import and #531's DT:

  • the kernel reserved this boot's TEXT at 0x10000d30000 (+0xca4000) and DATA at 0x10001f40000 (+0x748000), with platform ID 0x17 and the ISP and its DARTs enabled;
  • the camera streamed 1920x1080, then started again at 1280x720;
  • the external display and speaker amp handoffs imported as before.

developed and tested by Claude (Anthropic), working with me on the J713

iBoot loads the camera firmware outside the kernel's memory, at
addresses that move with the boot firmware. The J713 device tree
therefore describes the ISP and its DARTs disabled, with empty
isp-firmware-text and isp-firmware-data placeholders and an isp-heap
window for the firmware's main memory.

Fill the placeholders from this boot's ADT isp segment-ranges: reserve
each segment by physical address, and map it where the firmware runs
it, from the base of the heap window. Then set apple,platform-id from
the ADT isp node's sensor-type and enable the ISP and its DARTs.

The segments must be the firmware's __TEXT and __DATA, 16K aligned and
inside DRAM, with TEXT at the base of the heap window and DATA right
above it. Otherwise the tree is left as it was, the camera stays
disabled and the boot goes on. A tree whose ISP is already enabled
reserves its own firmware and is left alone.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The CI runners have no dtc, so the test failed there with
FileNotFoundError. Skip it when dtc is missing, as the T6041 display
handoff test does.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
@RyanTheTide
RyanTheTide merged commit e09bce0 into main Nov 6, 2026
8 of 9 checks passed
@RyanTheTide
RyanTheTide deleted the j713/isp-handoff branch November 6, 2026 03:24
@DjDeveloperr DjDeveloperr mentioned this pull request Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants