Skip to content

kboot: one AOP firmware-segment path, chosen by the ADT and the DART's range - #377

Merged
RyanTheTide merged 9 commits into
mainfrom
satchlj/t8112-aop-27-2-segments
Nov 21, 2026
Merged

RyanTheTide merged 9 commits into
mainfrom
satchlj/t8112-aop-27-2-segments

Conversation

@satchlj

@satchlj satchlj commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf.

kboot: one AOP firmware-segment path, chosen by hardware properties instead of the SoC.

  • dt_set_aop_firmware() finds the AOP node by its apple,<soc>-aop compatible. When the node is enabled, it copies the motion calibration and reserves the DRAM segments listed in the ADT /arm-io/aop segment-ranges. It names them in the node's memory-region, as T6040/T6041 already did. Segments in the AOP's own SRAM are skipped (dram_only), so an AOP without DRAM segments gets none. T8132 keeps its separate DAPF-window path.
  • A segment past the input range of the device's DART is reserved as RAM only, not listed as an IOVA. That is the T8112 OS-log segment on 27.2 firmware, which runs at its DRAM address. The range comes from the DART hardware: PARAMS3's VA width, as Linux reads it, on the T8110 DART the FDT node's iommus names. First it checks that this is the DART (or the DART of the mapper) that the ADT device's iommu-parent names, at the same register base. The check applies only to this DRAM-segment reservation; DCP, AVE and the others are unchanged.
  • A DART with TTBR/TCR protection set retains its firmware roots in Linux. On that path, Aura skips the new AOP firmware segment reservations and keeps the inherited mappings. The lock check uses the same ADT/FDT-matched DART and the same PROTECT bit as apple-dart.
  • Removed: the chip_id == T8112 && os_firmware.version >= V27_2 selector, its copy of the T6041 code, the T6000/T8112 motion-calibration-only path, and the chip_id == T8112 IOVA skip.

Why the reservation is needed: the 27.2 T8112 AOP firmware runs its external code and data from DRAM. Without the reservations the kernel cannot start it (aurora-silicon/linux#2519 checks the segments wherever the loader lists them).

Testing

Earlier heads brought up the AOP on J413, J615 and J616s. J700 reached Linux on the dbe58c4f trial, where the extra firmware mappings led to -EBUSY at AOP DART probe. The hardware rows and their build details are recorded in the comments.

The release ESP Stage 2 build, format check and pytest selection passed locally, with 802 tests passed and 53 skipped. The lock-check follow-up is untested on J700, J413, J615 and J616s hardware.

Assisted-by: LLM (Codex:GPT-6.2)

The macOS 27.2 AOP firmware on T8112 runs its external code and data
from DRAM. Reserve the segments the ADT lists and name them in the AOP
node's memory-region, as on T6041 and T8132, so the kernel can check
them before it starts the firmware. The OS log segment runs at its
DRAM address, above the AOP DART's 32-bit range: reserve its RAM
without listing it as an IOVA.

Selected by SoC and firmware version; the 13.5 firmware keeps the
motion calibration only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Boot-tested together with aurora-silicon/linux#2519 on MacBook Air M2 (J413), 27.2 (26B123) stub: pass.

One-shot boot 2c7bbe5c (2026-11-20), under the trial watchdog. The Stage 2 was phellos's current loader source (Aura 1.0.0b13.1 plus its local J413 commits, 8940ac05). Its local AOP code was removed, and this PR's two hunks went in its place. The device tree's AOP node was reduced to the upstream compatible = "apple,t8112-aop", with no local compatible and no board match. The kernel ran aop.ko from linux#2519 601c6719ff24.

Results:

  • The loader selected the node by SoC and firmware version, and the AOP node came up with memory-region naming two reserved segments. The OS-log segment above the DART's 32-bit range was not listed as an IOVA.
  • The kernel validated the external data region at IOVA 0x40000. The AOP firmware reported AOP IS READY.
  • Both audio cards were present: speakers and speaker sense, and the hpai/lpai microphones. All six AOP sensors (ALS, ALS temperature, lid angle, accelerometer, gyro, devmotion) read plausible values. Nothing was played through the speakers.

Caveat: the change was tested on that 1.0.0b13.1-based loader tree, not on main itself. The hunks applied cleanly there, and the functions they use are unchanged in main.

🤖 Generated with Claude Code

@satchlj
satchlj marked this pull request as ready for review November 20, 2026 05:00
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for this, and for the J413 boot with the AOP, audio and all six sensors checked.

We select behaviour by a hardware property, and keep one implementation per mechanism. Two parts tie this to the chip instead:

  • src/kboot.c:9203 if (chip_id == T8112 && os_firmware.version >= V27_2) return dt_set_t8112_aop_27_2(); and dt_set_t8112_aop_27_2() (src/kboot.c:9166-9196) repeat the T6040/T6041 path in dt_set_aop_firmware() line for line, with a different compatible.
  • src/kboot.c:4323 if (chip_id == T8112 && dram_only && seg->unk == 0xa && ... the reason given is the DART's 32-bit range, not the SoC.

Could dt_set_aop_firmware() reserve the segments on any chip whose ADT /arm-io/aop has segment-ranges and whose AOP node is enabled (finding the node by its AOP compatible), so T8112 just falls into the existing path? The IOVA skip could then test the segment against the AOP DART's addressable range rather than chip_id.

If you make it the common path, we can run rows on our M1 Pro, M2, M4 Pro and A18 Pro.

satchlj and others added 4 commits November 20, 2026 02:31
Instead of a T8112-on-27.2 copy of the T6040/T6041 code, dt_set_aop_firmware()
now finds the AOP node by its "apple,<soc>-aop" compatible and, when it is
enabled, copies the motion calibration and reserves the DRAM segments the
ADT's /arm-io/aop segment-ranges lists. An AOP whose segments all sit in its
own SRAM gets none (dram_only), as before. T8132 keeps its DAPF path.

The OS-log segment that T8112 27.2 firmware runs at its DRAM address is
reserved without an IOVA because it lies outside the DVA window of the
DART that the ADT device names in iommu-parent (vm-base, vm-size), not
because of the chip. Only the dram_only reservation applies that test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On J413 27.2 the ADT window did not exclude the OS-log segment, while the
DART itself reports a 32-bit input range (PARAMS3 VA width, as Linux reads
it: "AS 32 -> 36"). Read the width from the T8110 DART that the FDT node's
iommus names, after checking it is the one the ADT device's iommu-parent
names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The T8112 ADT /arm-io/aop iommu-parent is /arm-io/dart-aop/mapper-aop, so the
lookup matches a T8110 DART by its own phandle or one of its children's.
Log the range the DRAM reservation uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@satchlj satchlj changed the title kboot: reserve the T8112 AOP firmware segments on 27.2 kboot: one AOP firmware-segment path, chosen by the ADT and the DART's range Nov 20, 2026
@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Thanks, done as you suggested, in new commits on top of a merge of main (no force-push):

  • 84641996: dt_set_aop_firmware() is the one path. It finds the AOP node by its apple,<soc>-aop compatible; if the node is enabled, it copies the motion calibration and reserves the ADT /arm-io/aop DRAM segments. T8112 now falls into it. The T8112 copy, the chip_id/V27_2 selector and the T6000/T8112 calibration-only branch are gone. T8132 keeps its DAPF path, which is a different mechanism.
  • 4e2d2b8d, 69c5216d: the IOVA skip now tests the segment against the DART's input range, not chip_id. Two things I found on hardware:
    • The ADT vm-base/vm-size of dart-aop is not usable for this. On J413 it is [0x3c000, 4 GiB), yet the firmware's data segment sits at IOVA 0x20000, so that window would wrongly drop a segment the AOP needs. It also did not exclude the log segment on my first probe. The range now comes from the DART hardware: PARAMS3's VA width, as Linux reads it ("AS 32 -> 36" here), on the T8110 DART the FDT iommus names. It is used only after checking that this DART is the one the ADT iommu-parent names, at the same register base.
    • On T8112 the AOP's iommu-parent is dart-aop/mapper-aop, so the lookup also accepts a mapper child.
    • The test is limited to the DRAM-segment reservation, so DCP and AVE are untouched. One DCP segment has IOVA 0xffff…, and a generic range test would have started dropping it.

Hardware, J413 / 27.2 stub, one-shot Stage 2 boots of phellos's upstream-first default kernel (integration 61295c26 + open PRs). The Stage 2 was its Aura + this branch, under WD1:

  • Final image (50c75cab…), boot d4c4c62e. The Stage 2 log has "DART input range 32 bits" and "segment 0x805d78000 at 0x805d78000 is past the DART's 32-bit range, RAM only". The AOP node lists the same two segments with the same IOVAs (0x20000, 0x40000) as the previous T8112-specific code, and the log segment is still a reserved-memory node. Linux: "Validated external data region at IOVA 0x40000", "AOP IS READY", all six AOP IIO devices and both audio cards. No speaker playback in this run.
  • The earlier ADT-window build (8527a76f…, boot e81705f9) listed the log segment at IOVA 0x805874000, which is why I switched to PARAMS3.

Not tested: any other SoC. This now reaches AOPs that got nothing before, wherever their ADT lists DRAM segments: M1, M1 Pro/Max, M2 Pro/Max, A18 Pro, the M5 family, and M2 on older firmware. Your M1 Pro, M4 Pro and A18 Pro rows would be very welcome. The thing to watch is an AOP that now gets memory-region entries it did not have before.

…segment harnesses

The ISP and DCP harnesses compile dt_reserve_asc_segments_at() on its own;
give them a dt_device_dart_va_bits() that reports no range, which keeps
their reservations as before. No change on hardware: 1ULL << va_bits is
what BIT() expanded to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the rework. One dt_set_aop_firmware() path chosen by the AOP node and its ADT segments, and the IOVA skip taken from the DART's own input range (checked against the ADT iommu-parent), is what we hoped for. The note on why the ADT vm window can't be used is helpful.

Since this now reaches AOPs that got no memory-region entries before, we will run boot rows on our M1 Pro, M2, M4 Pro and A18 Pro on 7c66768: the AOP's reserved segments and IOVAs, AOP ready, sensors and audio cards, and no new reserved-memory overlaps. We will post them here.

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: hardware run.

PR head Checked Result
7c66768f AOP firmware-segment reservations on T8112 27.2 with linux#2519: external data region validated at IOVA 0x40000, AOP ready, six IIO devices, both audio cards Pass

Build: phellos (MacBook Air M2, J413, macOS 27.2 / 26B123 stub), default rebuilt 2026-11-20 = linux integration/aurora 458f759d + aurora-silicon/linux#2519 aurora-silicon/linux#1832 aurora-silicon/linux#1831 aurora-silicon/linux#2264 aurora-silicon/linux#2525 aurora-silicon/linux#2526 aurora-silicon/linux#2543 aurora-silicon/linux#2544 aurora-silicon/linux#2545; Aura main 0beafec + #377 #227 (isp.c only) #381 #382; U-Boot aurora-wip 37baf8f7 + aurora-silicon/u-boot#67; Stage 2 DTB t8112-j413-fw27.dtb. One-shot boot under the SoC watchdog, then made the default (two default boots healthy).

Conflict in dt_set_aop_firmware(): main added dt_find_aop() (any
"apple,<soc>-aop" node, status and path checked) and kept the
T6040/T6041/T8132 gate. Keep main's helper and its calibration comment;
keep this branch's segment reservation for every AOP (dram_only leaves an
AOP without DRAM segments alone) and the T8132 DAPF path selected by its
compatible.

Signed-off-by: Satya Benson <satya@benson.earth>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 row (MacBook Air 15" M3, T8122, macOS 27.2 firmware): this PR's AOP path brings up the M3 AOP.

Setup: the J615 bring-up Stage 2 (aura v1.0.0b13.1 + the 27.2 picks) with this PR's five commits cherry-picked cleanly (the four AOP functions are byte-identical to head 7c66768) and our duplicate T8122 case (#395) reverted. Kernel 7.3 lab build with the T8122 AOP match from aurora-silicon/linux#2569. One-shot cold boot.

  • The T8122 AOP DART reports a 42-bit input range (PARAMS3 0x2a2a0200, AS 42 -> 42). The 27.2 external code/data segments use IOVA 0x100_0000_0000 (+0x20000), so they stay IOVAs: reserved-memory lists them with iommu-addresses at those addresses on the AOP DART.
  • Kernel: Validated external data region at IOVA 0x10000020000, size 0x4000, RTKit up, AOP firmware log through ===( AOP IS READY )===, no -62/ETIME.
  • Services: ALS 0.25-0.31 lux (dark room), lid angle 92 deg, the AOP mic card (HQ + LP mics) captures at a -68..-70 dBFS room floor (nothing played).

Same result as our T8122-only change in #395, which I'm closing in favour of this PR.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

J616s (M4 Pro, T6040) row on dbe58c4 merged with main a4df613 (Stage 2 1.0.0b13-g37a2253b). It ran as an aura-try one-shot behind the installed Stage 1, with the configured Stage 2's DTB, U-Boot and config kept byte for byte, on the fleet kernel.

  • Stage 2 log: FDT: /aop@510600000: DART input range 42 bits, then AOP firmware segments reserved. The boot carries on past the DART read; no SError.
  • The AOP node's memory-region, both on the AOP DART: 0x100009c4000 + 0x14000 at IOVA 0x0, and 0x1000fe84000 + 0x2c000 at IOVA 0x1000fe84000. The two segments outside DRAM (0x510c10000, 0x510ce9000) are logged and not reserved, as on main.
  • Linux: AOP IS READY. IIO: als, las, als-temp, devmotion6, accel, gyro. Audio cards: AppleJ616HPAI, AppleJ616, AppleJack and two DisplayPort. 0 reserved-memory overlap warnings, 0 AOP errors.
  • Enforcing, 0 failed units, 0 AVCs, 0 kernel errors, 0 DART faults, NVMe and Wi-Fi up.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

A18 Pro (J700) row on dbe58c4 merged with main a4df613 (Stage 2 1.0.0b13-g37a2253b): no return. It ran as an aura-try one-shot behind the installed Stage 1, with the production Stage 2's DTB, U-Boot and config kept byte for byte, on the fleet kernel.

  • The Mac rebooted into the trial at 16:38 (AEDT) and has not come back on the network since (no ARP on either interface 15+ min later). So neither a Linux boot nor the stage watchdog's fallback to the configured Stage 2 happened.
  • There's no console on this boot, so I can't say yet where it stopped. It fits the first point of the review above: on T8140 the loader now reads the AOP DART at kboot, where main reserved nothing.
  • Next: after a power cycle, a control one-shot of plain main a4df613 with the same tooling. If that returns, the hang is this branch.

Until then, I'd hold this head on the M1/M2 Pro/Max, A18 Pro and M5 rows unless the Mac has a way to be reset remotely.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo, A18 Pro, T8140, macOS 26.6.2 firmware) row on dbe58c4 merged with main 29e0d3a (1.0.0b13-gf0e38100): regression, AOP doesn't come up. The Stage 2 was the ESP Stage 2 from this head's build run 44765646251, aura.bin sha256 c3a13097ab914eddab110f1b57ff00f19db83a3749a9101686c0a3993d8d9b42. It ran as an aura-try one-shot behind the installed Stage 1 (1.0.0b8), with the configured Stage 2's DTB, U-Boot and options tail kept byte for byte, on the fleet kernel 7.3.0-41.fc44.aurora.aarch64.

Stage 2 side, as intended:

  • FDT: /soc/aop@310c00000: DART input range 42 bits, and the boot gets past the PARAMS3 read.
  • ADT: segment asc-firmware@1000fce8000 uses non 16k aligned size: 0x033000.
  • FDT: /soc/aop@310c00000: AOP firmware segments reserved.
  • The AOP node gets memory-region with two new apple,asc-mem regions:
    • asc-firmware@10001988000: 0x18000 at IOVA 0x10040054000;
    • asc-firmware@1000fce8000: 0x34000 at IOVA 0x1000fce8000.
  • Compared property by property with the default boot's device tree, these (and the phandle renumbering they cause) are the only changes from this PR.

Linux side, broken:

  • apple-dart 310fc0000.iommu: probe with driver apple-dart failed with error -16. This is the AOP DART. On this Mac it comes up holding iBoot's live AOP state (dapf: preserving inherited /arm-io/dart-aop state on T8140).
  • Everything behind that DART then stays deferred: the AOP mailbox 35067c000, the AOP node itself, the DMA controllers 313800000, 313300000 and 353200000, and the sound card (snd-soc-macaudio: parsing CPU DAI of link 'Headphone Jack').
  • So there's no apple_aop ... RTKit: Initializing, no IIO device (the default boot has aop-sensors-als), and only one audio card (DisplayPort). AppleJ700AOP and AppleJ700 are both missing.
  • That is 1 new kernel error. Otherwise: Enforcing, 0 failed units, 0 AVCs, 0 reserved-memory overlap warnings, NVMe up, PMU panic count 0, 6/6 CPUs, GPU up.

Not the base: the configured Stage 2 and four other builds booted the same day on this Mac all bring AOP up with the IIO sensor and all three cards, with no AOP DART probe error:

So the change that breaks the J700 is the new AOP reservation with iommu-addresses on a DART that Linux inherits live. A18 Pro needs either no AOP memory-region (as before) or a kernel side that accepts these direct mappings on the inherited DART. This was one boot; the failure is at DART probe time and follows from the device tree change.

Compared with the J700 row above: that build (merged with a4df613) did not return. This build (merged with 29e0d3a) got past the PARAMS3 read on this Mac and reached Linux, so the DART read itself didn't hang here. The two builds differ in the main they merge.

Restore: back on 1.0.0b13-g5dcf62d0, and the ESP is byte-identical. AOP, the ALS and all three cards are back on the default boot.

The one-shot boot added rd.emergency=reboot panic=30 watchdog.open_timeout=150 to its own kernel command line as a dead-man.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide RyanTheTide 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.

Thanks for the J700 row on the 29e0d3a merge. It replaces our guess on the earlier no-return boot. The loader's DART read went fine here. What fails is the kernel: the AOP DART probe returns -EBUSY when the new memory-region with iommu-addresses lands on a DART that Linux inherits live. AOP, the ALS and the speaker/headphone cards are missing, and the other builds from that day on the same Mac are clean. So the A18 Pro regression is a blocker for this head.

For the fix, please key it on the same hardware state that makes the kernel preserve the DART, not on T8140. Two ways:

  • the loader leaves out the AOP memory-region/iommu-addresses when the AOP DART is handed over live (the property the kernel reads to preserve it);
  • or the DART driver accepts the reserved direct mappings on a preserved DART, landed first, with this PR's reservation following.

If that preservation decision is still chip-keyed in the kernel today, it needs a property of its own before the loader can use it.

The J413, J615 and J616s rows stay valid. M1 Pro/Max, M2 Pro/Max and M5 are still open.

Assisted-by: LLM (Claude:Opus 5.5)

Linux leaves the DART firmware roots in place when PROTECT locks TCR
and TTBR. Adding AOP firmware iommu-addresses on a DART in this state
can fail default-domain mapping with EBUSY during IOMMU registration.

Use the same lock bit on the DART matched between the FDT and ADT and
skip the new AOP segment reservations when the roots are locked. Share
the match with PARAMS3 address-width discovery.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Codex GPT-6.2 Sol on @satchlj's behalf.

The J700 trial got past the loader's PARAMS3 read. The new memory-region entries asked Linux to establish firmware mappings while registering the AOP DART. Linux inherits the DART's translation roots when PROTECT[0] locks TTBR and TCR. Its retained-root mapping checks can return -EBUSY when the requested mapping would change a firmware-owned slot, and a failed default-domain setup propagates back to DART probe. The DTS documents the inherited lock and the occupied firmware slot on stream 0. The trial log identifies the failing probe and errno. DART lock check · Mapping check · AOP DTS

Commit e41005dbaa1c checks that same lock bit through Aura's read-only DART helper, after matching the FDT provider to the ADT DART by iommu-parent and register base. When the roots are locked, Aura keeps the inherited mappings and omits the new AOP memory-region and iommu-addresses entries. An unlocked DART still follows the PARAMS3 range check and DRAM reservation path. The decision follows the register without a chip or board gate. The kernel's apple,bypass-handoff-streams property applies to MTP bypass. MTP bypass check

Local checks passed for make format-check (clang-format 20.1.8), the release ESP Stage 2 build, the PMP boot-data test and the macOS CI pytest selection (802 passed, 53 skipped).

This follow-up is untested on J700, J413, J615 and J616s hardware.

@RyanTheTide RyanTheTide 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.

Re-review of e41005d against dbe58c4. No new blockers in the code. The J700 blocker is resolved in code, but it has not been run on hardware yet, and the earlier rows need one rerun (point 2).

  1. Resolved in code: src/kboot.c:9352-9358 now skips the AOP memory-region/iommu-addresses when PROTECT[0] (TTBR/TCR lock) is set on the DART the FDT iommus and the ADT iommu-parent both name. The kernel reads that same bit in apple_dart_is_locked() and uses it to keep the firmware roots, so the decision follows the hardware state and not T8140. The new dart_t8110_is_locked() (src/dart.c:731) checks the ADT reg size before reading, and the shared dt_device_dart_mmio() keeps the PARAMS3 path as it was. On J700 this should put AOP back to how main boots it. That still needs the J700 row below.

  2. Still open (evidence): the loader's test is now wider than the kernel's. In the kernel, the -EBUSY from apple_dart_check_fw_map() only applies to fw_handoff/fw_mirror DARTs. On any other DART the lock bit only means "don't reset", and the kernel still maps reserved regions into the inherited tables. So if PROTECT[0] is already set on the AOP DART of a J413, J615 or J616s at kboot, this head drops the reservation there without saying so. On the J413 that is the 27.2 fix this PR exists for. The J413, J615 and J616s rows on this thread were all taken before this check existed, so they don't show the lock state. One rerun of the J413 on e41005d would settle it: it should still print AOP firmware segments reserved and not the new preserving firmware mappings in locked DART. If any of those Macs does print the new line, please make the skip narrower, still keyed on hardware state: leave out only the segments whose IOVA lands in a root slot the inherited tables already hold valid. That is the same test the kernel uses for -EBUSY. Please don't narrow it by chip.

  3. New: nothing else. The commit is small, CI is green apart from the two macOS pytest jobs still pending, and the commit has no agent trailers.

Hardware rows:

  • J700 (A18 Pro) one-shot on e41005d: Stage 2 prints preserving firmware mappings in locked DART for the AOP node, and the node has no new memory-region. Linux has no apple-dart 310fc0000.iommu ... error -16, apple_aop reaches RTKit init, the ALS IIO device is present, and all three sound cards enumerate (check enumeration only, play no audio). Same results as the default boot otherwise.
  • J413 (M2, 27.2) one-shot on e41005d: Stage 2 still prints AOP firmware segments reserved, and AOP is ready with its IIO devices, as in the earlier row.
  • M1 Pro, M2 Pro/Max and M5 rows are still open.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Follow-up to the A18 Pro (J700) no-return above. After a power cycle the Neo came back on its production Stage 2 by itself: the trial was marked spent, and the configured boot-ctxr was unchanged. The journal has no boot between the 16:38 shutdown and the power-on, so the trial boot never reached Linux userspace.

Control, same Mac, tooling and kernel: plain main a4df613 (the base of the dbe58c4 merge) as the aura-try Stage 2 came back in about a minute. Three more trials on main 6affb8e and other heads also came back. So on this J700 (installed Stage 1 b10, 26.6.2 firmware) the no-return comes from dbe58c4: one hang against one clean control. The trial stopped before Linux, unlike the -16 AOP DART probe failure on the other J700 above. With no console, I can't say where in the chain it stopped.

e41005d hasn't been tried on this Neo yet.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 (M3 Air 15", T8122, macOS 27.2 stub) row: aura main 6affb8e + this PR (e41005d) + #420, fleet tree t8122-j615.dtb, kernel 7.3.0-aurora-fleet78, stock command line, one aura-try boot.

  • Without this PR, on the same kernel and DT: apple_aop: No firmware memory-region from the bootloader, probe -2, no sensors.
  • With it: Validated external data region at IOVA 0x10000020000, size 0x4000, RTKit up (protocol 12), and the iio devices aop-sensors-las and aop-sensors-als appear.
  • Nothing else regressed on that boot: AVE encode, AVD decode, display, keyboard/trackpad and Wi-Fi all worked, and one s2idle cycle came back with the sensors still present. 0 failed units, 0 SELinux denials, 0 oopses.

The AOP firmware-segment path reads the AOP DART's PARAMS3 and PROTECT
registers at kboot, on every chip with an AOP. Where the PMGR reports
that DART gated, an MMIO access can stall the bus instead of faulting,
and the loader never reaches Linux or its fallback. Skip both reads
there: the segments are reserved without the range check, and the lock
check sees no lock, since a gated DART holds no firmware state.

A DART the PMGR has no state for keeps the current behaviour.

Signed-off-by: Satya Benson <satya@benson.earth>
Assisted-by: LLM (Claude:Opus 5.5)
@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: a code-only look at the J700 no-return ("SWEEP5-REF").

Finding. Nothing in this PR waits: no loop or poll on AOP state, and every failure path in dt_set_aop_firmware() returns 0, so it cannot make kboot fail and drop into the proxy. A chip whose ADT has no AOP, no segment-ranges or no matching iommu-parent DART skips the new code. What is new on every chip with an AOP is two MMIO reads of the AOP DART at kboot: PARAMS3 (range check) and, since e41005db, PROTECT (lock check). Nothing checked that the DART was powered first. On a gated block such a read can stall the bus with no SError. That matches a silent no-return before Linux, with no stage-watchdog fallback. It is the only path in this diff that could hang. I can't show it is the J700's cause. The other J700 (DjDeveloperr, merge with 29e0d3a) got past the PARAMS3 read with the DART live. The hung trial differs in its base (a4df613) and its Stage 1 (b10 vs b8).

Change, f5360de3. dt_device_dart_mmio() now asks pmgr_adt_is_powered() about the matched ADT DART. If the PMGR reports it gated, both callers leave its registers alone. The segments are then reserved without the range check, and the lock check sees no lock (a gated DART holds no firmware state). A DART with no PMGR state keeps today's behaviour. This is selected by PMGR state, not by chip. The release build passes locally. pytest: 797 passed, 52 skipped; 1 failure and 5 errors are the local llvm toolchain-path tests (test_toolchain, test_asm, test_loadobjs), which this change doesn't touch.

Logs that would settle the no-return (one J700 trial on f5360de3, same Stage 1 b10 / 26.6.2 / a4df613-or-later base):

  1. The Stage 2 console up to the stop: USB serial / dockchannel, or Aura's persisted log if aura-try keeps one. The last FDT: line is the key. If it is /soc/aop@310c00000: DART input range … or preserving firmware mappings in locked DART, the DART reads are clear. If the log stops just before it, or at the new "powered down" line, the stop is in this path.
  2. If there is no console: the same trial with dt_set_aop_firmware() returning right after dt_set_aop_motion_cal(). That bisects this PR's reads against the rest of the merge.
  3. What "hung in the proxy for 6 h" means in SWEEP5-REF. Was it Aura's proxy after a kboot failure (then the kboot: … failed line is needed), or the host harness waiting on a chainload that never answered?
  4. The J700 ADT's /arm-io/dart-aop clock-gates and its PMGR state at Stage 2. That says whether the new guard applies there at all.

Untested on hardware: f5360de3 on any Mac. e41005db's lock check is also still untried on J700, J413, J615 and J616s.

🤖 Generated with Claude Code

@RyanTheTide RyanTheTide 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.

Re-review of f5360de against e41005d. No blockers in the new commit. One earlier point is still open (point 3) and one commit-message fix is needed (point 2).

  1. f5360de looks correct. pmgr_adt_is_powered() (src/pmgr.c:675-712) returns 0 only when a non-virtual clock gate of the matched DART reads not active. A DART with no clock-gates, an unknown PMGR device or an uninitialised PMGR returns -1, and dt_device_dart_mmio() (src/kboot.c:4364-4371) then keeps the old path. When the DART is gated, both callers fall back to paths that already exist: the range check reports "unknown" and the lock check sees no lock. That is the right result for a block that has no state. Small cosmetic point: on a gated DART the "is powered down" line prints twice per boot, once from each caller.
    This guard probably does not touch the J700 no-return, though. On the J700, iBoot leaves dart-aop configured and live, and Dj's 29e0d3a row got past the PARAMS3 read. So the PMGR should report it powered there, and this head reads the same registers as e41005d. Please don't present f5360de as the J700 fix. Your log item 2 (return from dt_set_aop_firmware() right after dt_set_aop_motion_cal()) is still the trial that splits this PR's reads from the rest of the merge.

  2. The f5360de commit message ends in Assisted-by: LLM (Claude:Opus 5.5). Commits should carry the human Signed-off-by only, and the Assisted-by line belongs on the last line of the PR body. Please drop it from the commit the next time you rewrite the branch.

  3. Still open from the last review: the lock check is wider than the kernel's -EBUSY test. The J615 row on e41005d closes it for the J615: the kernel used the new region (Validated external data region at IOVA 0x10000020000), so the skip didn't fire there. J413 and J616s still have no row on e41005d or later. Our J616s row was on dbe58c4, before the lock check existed.

Answers to your log questions on our J700 no-return (dbe58c4 + main a4df613, Stage 1 b10):

  • Item 3: the hang was seen from the host side. After the trial reboot, nothing came back within 480 s, neither NIC answered ping, and the Mac stayed dark until someone pressed the power button. Neither panic=30 nor the trial watchdog brought it back. That Neo has no console or tether, so we can't tell whether Aura's proxy was running.
  • Item 1: no console log exists for that boot, for the same reason.
  • The control run of plain main a4df613 on the same Mac came back (see the 12:08Z comment). The item 2 bisect and an f5360de trial are queued for our Neo.

Hardware rows:

  • J700 (A18 Pro, Stage 1 b10, 26.6.2) one-shot on f5360de merged with current main: no "is powered down" line for dart-aop. Stage 2 prints preserving firmware mappings in locked DART, and the AOP node has no new memory-region. The boot reaches Linux with no apple-dart 310fc0000.iommu ... error -16, apple_aop reaches RTKit init, the ALS IIO device is present, and all three sound cards enumerate (enumeration only, no playback). If it doesn't return, run the item 2 bisect build on the same Mac.
  • J413 (M2, 27.2) one-shot on f5360de: still prints AOP firmware segments reserved, not the locked-DART line, and AOP comes up with its IIO devices.
  • J616s (M4 Pro) one-shot on f5360de: same as the J413 row, with 6 AOP IIO devices and no reserved-memory overlap warnings.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Follow-up on our A18 Pro no-return row for dbe58c4 above. Release builds keep aura's panel console dark, and the trial branch reboots before the proxy. So the proxy text left on the panel most likely came from the boot after the failed trial, which then stayed in the proxy. On this SoC, that state never resets: the proxy's USB carrier schedule is refused, so no CDC watchdog arms (#438). Taken together, dbe58c4 failed to boot on that Mac once, and the 6 hours afterwards came from that separate gap, not from this PR. We still don't know how dbe58c4 failed on that Mac. #436 makes a failing trial reboot to the configured image after 15 s.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s (MacBook Pro 14", M5 Pro, T6050) boot-regression row on f5360de3 (merged locally onto main 58e712b9, built as 1.0.0b14-gaa28c4d9), kernel 7.3.0-m5-sship7, stock command line, 3 consecutive Stage 1 -> Stage 2 -> Linux boots: PASS (3/3).

  • Locked AOP DART preservation (e41005db / f5360de3): On all 3 boots, Stage 2 logged FDT: /soc@200000000/aop@290c00000: preserving firmware mappings in locked DART and left AOP reserved-memory unchanged (0 new nodes, 0 overlaps).
  • Linux IOMMU & AOP (3/3): apple-dart 290fc0000.iommu (AS 42 -> 42, protect 000001e7/000001e7, diag lock 00000000) probed cleanly with 0 -EBUSY warnings and 0 DART faults, attaching 290c00000.aop, 2d067c000.mailbox, and 291600000.aop. All AOP drivers bound (apple_aop, t6050-aop with 6 endpoints started, iio_aop_als, iio_aop_las, snd_soc_t8152_aop_audio), both IIO sensors (aop-sensors-las, aop-sensors-als) and audio cards (AppleJ714, AppleJ714HPAI, DisplayPort) came up as on the baseline.
  • Regression checks (3/3): 18/18 CPUs online, NVMe root (/dev/nvme0n1p5, 0 NVMe errors), Borealis GPU live (vulkaninfo + compute dispatch 3/3), AVE bound on 3/3 boots (/chosen aurora,ave-text-crc32 matching baseline; boot 1 H.264 1008266 B and H.265 1082100 B encodes byte-identical to baseline with 0 new kernel errors), 0 SELinux AVC denials, 0 new failed units, 0 new kernel warnings/errors, 0 oopses.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 2.

The approval is on dbe58c4. After it came the J700 -EBUSY regression and two commits (e41005d, f5360de) that have not run on any Mac. The open points from the earlier review (the lock test is wider than the kernel's, the Assisted-by trailer in f5360de, the double "powered down" line) still stand and I don't repeat them. New:

  1. src/kboot.c:9363-9367 with :4318-4376 and :4430: both safety checks fail open when the DART can't be examined. dt_device_dart_mmio() returns -1 when the FDT DART isn't apple,t8110-dart, when the ADT match fails, and (since f5360de) when the PMGR reports it gated. In those cases the lock check is skipped and the range check reports "unknown", but dt_reserve_asc_segments() still lists every DRAM segment with iommu-addresses. That is the configuration that broke the J700. The M1-family AOP DARTs are apple,t6000-dart (t600x-die0.dtsi:508) and apple,t8103-dart (t8103.dtsi:1441), so on M1 Pro/Max both checks are skipped every time, and before this PR those Macs got no AOP memory-region at all. Fix: when the DART can't be read, keep main's behaviour for that AOP (calibration only, no reservation) and log it. Do not reserve unchecked.
  2. The J700 regression is resolved only in code. One J700 row on f5360de is needed to merge: the Mac that hit -EBUSY, and preferably the no-return Mac too, now that proxy_fallback: reboot a trial that would stop in the proxy #436 makes a failed trial fall back. The J413 rerun asked for earlier also matters, because the J413 is the 27.2 case this PR exists for, and the new lock check could drop its reservation without saying so.

Checked and fine: the iommu-parent match against the ADT DART including mapper children, the PARAMS3 width bounds (32..48), the DRAM-only filter, and the T8132 DAPF split by compatible.

HW row: on f5360de merged with main, default command line: J700 (AOP up, IIO als present, three audio cards, no apple-dart -16), J413 27.2 (Validated external data region, AOP IS READY, the log shows the lock state), M1 Pro or Max (no AOP memory-region added, AOP unchanged from main). Each with 0 failed units, 0 AVCs and no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Rows on f5360de (local merge into main 58e712b, aura-try one-shots, fleet78 kernel, stock command line, U-Boot aurora-wip 5445237f):

J616s (M4 Pro, T6040, 26.6.2), 1 boot (1.0.0b14-geeb3f438, boot 4c5c127c): Stage 2 prints AOP firmware segments reserved and DART input range 42 bits, not the locked-DART line; the two segments outside DRAM are skipped as before. Linux: AOP ready, 0 AOP errors, 6 AOP IIO devices (las, als, als-temp, devmotion6, accel, gyro), 0 reserved-memory overlap warnings, Enforcing, 0 failed units, 0 kernel errors. Control boots on main 58e712b without this PR (4 boots) give the same AOP result minus the range line.

J615 (M3 Air, T8122, 27.2), 3 boots with this PR + #420 on main 58e712b (1.0.0b14-g0f399934): AOP las + als IIO devices on every boot, encode/decode/Touch ID/s2idle rows unchanged across boots, 0 failed units, 0 oops.

The J413 (M2) row on this head is next.

@RyanTheTide

Copy link
Copy Markdown
Contributor

J413 (M2 Air, T8112, macOS 13.5 firmware) row on f5360de merged into main 58e712b (1.0.0b14-geeb3f438, aura-try one-shot, fleet78 kernel, stock command line, boot d09907ab):

  • Stage 2: AOP firmware segments reserved, DART input range 32 bits, segment 0x8044e0000 at 0x8044e0000 is past the DART's 32-bit range, RAM only, and the two segments outside DRAM skipped. No locked-DART line.
  • Linux: AOP ready, 0 AOP errors, 4 AOP IIO devices (las, als, accel, gyro), 0 reserved-memory overlap warnings, MTP keyboard + multi-touch, Enforcing, 0 failed units, 0 kernel errors.
  • Control (main 58e712b without this PR, 3 boots): same Linux result; Stage 2 prints neither the reservation nor the range line.

With the J616s row above, this covers the two boards point 3 of the last review asked for. Our M2 runs the 13.5 stub, not 27.2.

@RyanTheTide

Copy link
Copy Markdown
Contributor

M1 Pro (J316s, T6000) row on f5360de merged into main 58e712b (1.0.0b14-g21c899b7), against main alone (1.0.0b14-g58e712b9). Both are aura-try one-shots behind the installed Stage 1, with the live image's DTB, U-Boot and config, the fleet kernel and the stock command line. This covers point 1 of the 15:38Z review, the path where the DART can't be examined.

main this PR
Stage 2 AOP lines calibration only AOP firmware segments reserved, DART input range unknown, 0 bits, two MMIO segments skipped as outside DRAM
AOP memory-region none 2 nodes: asc-firmware@10000a44000 (64 KiB, iommu-addresses at 0x17e00000000) and asc-firmware@10005a04000 (16 KiB, identity)
kernel AOP IS READY, IIO las/als/accel/gyro, 4 sound cards same, and 0 apple-dart errors (no -16)
Enforcing / failed / AVC / kernel errors yes / 0 / 0 / 0 yes / 0 / 0 / 0

So on apple,t6000-dart the code takes the fail-open branch the review describes: no range check and no lock check, and the segments are reserved with iommu-addresses anyway. On this M1 Pro that is harmless, because iBoot leaves the AOP DART unlocked and the kernel maps both regions without complaint. It doesn't settle the point for a Mac whose DART is locked and isn't apple,t8110-dart. The commit message should still say what happens there. Both boots show the same two AOP firmware syslog fail lines (ClientInfo.cpp:184), with and without this PR.

Rows on this head so far: M1 Pro (this one), M2 J413 and M4 Pro J616s (above), J615 tip 3/3. The A18 Pro (J700) row, on the Mac that hit -EBUSY, is still owed and is queued for our next Neo slot. Production was restored afterwards, with the configured Stage 2 unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J700 (MacBook Neo, A18 Pro, T8140, macOS 26.6.2 firmware) row on f5360de3859c325b5818c8d2e0f59943a84aa78f merged cleanly into main 07e90bb141ea9c8ccbdea16eedb38669fa856533 (local merge ee5ccc15a, Stage 2 1.0.0b14-gee5ccc15): PASS — the -EBUSY regression from dbe58c4f is resolved on this Mac.

Setup & build

  • Stage 2 binary: built with BUILDSTD=1 RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 USE_CLANG=1 BUILTIN_LOGO=aurora; aura.bin SHA-256 802ea0cbc79686ce767b74ed607445b9097bdedaa9926688aa65aec4134e90ec (3,997,696 B).
  • Trial bundle: spliced onto Neo's committed /boot/efi/m1n1/boot-ctxr.bin (71a44f37ee04ab67…, 1.0.0b13-g5dcf62d0), preserving the installed 449,445 B DTB/U-Boot/config tail byte for byte (e738475a7189f994…).
  • Execution: single aura-try one-shot (m1n1/aura377-trial.bin, trial bundle SHA-256 ed417d235cbc294b…) behind installed Stage 1 (1.0.0b8), booting the default fleet kernel 7.3.0-41.fc44.aurora.aarch64 (#1 SMP PREEMPT_DYNAMIC Mon Nov 16 16:49:34 UTC 2026) with the stock command line:
    BOOT_IMAGE=(hd0,gpt5)/vmlinuz-7.3.0-41.fc44.aurora.aarch64 root=UUID=257d4aa1-8946-4596-b067-ba065f1fb68f ro rootflags=subvol=root rhgb quiet loglevel=3 rd.udev.log_level=3 systemd.show_status=auto user4k=on plymouth.ignore-serial-consoles rootflags=subvol=root
  • Boot IDs: baseline fb41fe51-8f17-4bcf-b663-15f5cfe5f933 (1.0.0b13-g5dcf62d0) → trial e9f3d154-6f5f-4b7c-85b6-586ab4e31fc5 (1.0.0b14-gee5ccc15, chosen/aurora,trial=m1n1/aura377-trial.bin, /boot/efi/aura-try spent) → restored default db6f422b-fa09-4000-9265-712eca07fa0f (1.0.0b13-g5dcf62d0).

Results (A/B vs committed baseline)

Check Baseline (1.0.0b13-g5dcf62d0) Trial (1.0.0b14-gee5ccc15, f5360de3 + main 07e90bb14)
/soc/aop@310c00000 memory-region absent absent (identical to baseline; the two apple,asc-mem nodes dbe58c4f added are gone)
/reserved-memory AOP asc-firmware nodes none none (0 new reserved-memory nodes in full dtc -f -s FDT diff)
AOP DART (310fc0000.iommu) AS 42 -> 42, protect 000001e7/000001e7, diag lock 00000000; 0 errors identical; 0 -EBUSY / error -16, 0 DART faults
Clients behind AOP DART (35067c000, 310c00000, 313800000, 313300000, 353200000) all attached (IOMMU groups 10–14), 0 deferred all attached (IOMMU groups 10–14), 0 deferred
apple_aop / RTKit RTKit: Initializing (protocol version 12), children als.1.auto audio.2.auto identical (RTKit: Initializing (protocol version 12), children als.1.auto audio.2.auto)
AOP IIO devices aop-sensors-als (5.750075 lux) aop-sensors-als (5.937930 lux)
Audio cards (enumeration only, no playback) 3: AppleJ700AOP, AppleJ700, DisplayPort 3: AppleJ700AOP, AppleJ700, DisplayPort
Reserved-memory overlap warnings 0 0
Kernel errors / warnings vs baseline 12 pre-existing (apple_sep / apple-dcp swap) 0 new kernel errors (diff empty), 0 new normalized warnings (diff empty)
SELinux / AVCs / failed units Enforcing / 0 / 0 Enforcing / 0 / 0
System health 6/6 CPUs, NVMe root, Apple A18 Pro (G17P B1) Vulkan, eDP-1 connected, Wi-Fi ping ok, PMU 30 00 identical (6/6 CPUs, NVMe root, Apple A18 Pro (G17P B1) Vulkan, eDP-1 connected, Wi-Fi ping ok, USB hubs enumerated, PMU 30 00)

Stage 2 / FDT note

  • The Stage 2 /dev/mtd1ro ring log was not captured on this boot due to a local input-redirection typo in the capture helper (sudo -n tr < /dev/mtd1ro), so the Stage 2 FDT: /soc/aop@310c00000: preserving firmware mappings in locked DART string was not observed directly.
  • However, the full sorted /sys/firmware/fdt diff against baseline (dtc -f -s, 6580 vs 6583 lines) shows /soc/aop@310c00000 has no memory-region and /reserved-memory has 0 new asc-firmware nodes (only normal boot-to-boot Stage 1 address shifts plus expected main additions since b13: asahi,adt-speaker-safety, apple,low-power-frequency-max-mhz, u-boot,noautostart, and version/aurora,trial strings). On f5360de3, a PMGR-gated fallback returns -1 from dt_device_dart_mmio() and falls through to reserving the segments (which caused -EBUSY on dbe58c4f); observing zero new AOP reservations on 1.0.0b14-gee5ccc15 confirms dt_device_dart_mmio() succeeded and dart_t8110_is_locked() took the locked-DART early return matching Linux's protect 000001e7/000001e7.

Restore

  • Disarmed /boot/efi/aura-try, removed /boot/efi/m1n1/aura377-trial.bin, verified the entire ESP byte-identical to baseline (boot-ctxr.bin unchanged at 71a44f37ee04ab671e5042e7333f04c678a0b466496c2b8c4c1d4c3db21e17a1), and rebooted back to committed 1.0.0b13-g5dcf62d0 (boot db6f422b, AOP/ALS/all 3 audio cards healthy, 0 failed units, 0 AVCs).

Assisted-by: LLM (Google:Gemini 4 Neon)

@RyanTheTide RyanTheTide 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.

Approving at f5360de as our half of the joint merge decision. Rows now cover every SoC this touches: M1 Pro (exercises the fail-open branch on apple,t6000-dart), M2, M4 Pro and the J615 tip all PASS, and the J700 (A18 Pro) one-shot on f5360de + main 07e90bb PASSES with the -EBUSY gone (0 DART faults, 0 deferred devices, AOP sensors and audio up). Our hold was the 11-21 Neo trial that stranded in the proxy; with this J700 row passing on the same change, that strand belongs to the trial/recovery path that aura#436 bounds, not to this PR.

Assisted-by: LLM (Claude:Opus 5.5)

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.

3 participants