Skip to content

media: apple: ave: run the 6070 firmware on the M1 Pro and M2 (boot + lifecycle) - #1387

Merged
RyanTheTide merged 12 commits into
integration/aurorafrom
ave-m1m2/t8112-boot
Nov 10, 2026
Merged

RyanTheTide merged 12 commits into
integration/aurorafrom
ave-m1m2/t8112-boot

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Brings the AVE encoder firmware (6070.11.1) up on the M1 Pro (T6000 ave0) and M2 (T8112): boot, channel hand-over and the Config/Open/Close/Halt lifecycle. Encoding stays disabled for 6070 (encode_ready false); the AVE nodes stay disabled in the DTs.

  • Start the T8112/T6000 6070 firmware as macOS does: TEXT link-cell identity, firmware mapped from the start of its DART window (address 0 on T6000, the DART vm-base 0x800000000 on T8112), 6070.11.1 device numbering (T6000 14/11, T8112 18/15).
  • Leave the coprocessor code base register alone: the bootloader sets it, and any write to it before RUN (even of the value it already holds) stops the core after it builds its boot page tables, so the hello never came.
  • Take the heap the firmware asks for in its hello (0xc0000).
  • Serve the seven 6070 channels by name: replies on IO_T2H (descriptor 6, 32 slots), shared memory lent over SHAREDMALLOC from a 3 MiB part of the IPC window, firmware log lines from TERMINAL to the debug log.
  • Give the host every slot of every host-to-firmware ring (IO, DEBUG, BUF_H2T): a zero slot reads to the firmware as a posted message, and the firmware never took the ready word.
  • Name the start-up step that timed out.
  • t8112: describe the AVE pmgr and pio windows.

Tests

  • KUnit apple-ave: 23/23 (channel parse on the descriptor table the firmware publishes, SHAREDMALLOC firmware-side simulation, vm-base link cell).
  • M1 Pro (fleet46 + this driver, AVE node enabled by an aura-try trial): hello 9 ms after RUN, 2 x 64 KiB SHAREDMALLOC, Config/Open/Close/Halt accepted for H.264 and HEVC, repeated restarts in one boot, 0 DART faults, 0 AVCs. 6 boots.
  • M2 (same, aura with the vm-base handoff): hello 3 ms after RUN, the same lifecycle for H.264 and HEVC, 0 DART faults, 0 AVCs.

🤖 Generated with Claude Code

RyanTheTide and others added 12 commits November 9, 2026 16:34
Three things kept the M2 encoder firmware from starting:

- The loader writes the DATA address into one TEXT cell (+0x423c on
  T8112) that is zero in the firmware image, so the live TEXT CRC never
  matched the image CRC and probe refused the build. Hash TEXT with
  that cell as the image has it, and refuse any other value in it.
- VCBAR reads back decoded (the code base with bit 0 set), so the
  read == written check always failed with -EIO before RUN. macOS writes
  it once and treats the first hello as the confirmation; do the same.
- Clear the SVE idle word in the mailbox before RUN, and restore DATA
  from the boot snapshot before the first start as well.

With these the T8112 probes ("6070.11.1 (lifecycle only): TEXT
25bfd039") and reaches RUN; the firmware does not say hello yet, so
the encoder stays disabled in the device tree.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The M2 ADT gives the encoder the same two auxiliary banks as the
M1 Pro: a PMGR page that the host maps for the 6070 firmware and hands
over at Config, and the PIO window. The driver refuses to start the
firmware without the first one. Describe both like t6000-peripherals
does and let the binding accept them on T8112. The node stays disabled.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The M1 Pro loader fills TEXT +0x423c with the DATA address too: the live
TEXT CRC is e689935f, and with that cell as zero it is 460c7a7c, the
H13S image CRC. Normalise it on T6000 as on T8112.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The pre-M4 encoder firmware is mapped from DART address 0, TEXT first and
DATA right after it, and VCBAR carries only its flags. The TEXT link
cell holds the firmware's own alias of DATA, whose low 32 bits are
DATA's DART address. Check the cell that way, and refuse a handoff that
puts the firmware anywhere else: the M1 Pro's 32-bit AVE DART rejects
the alias addresses outright.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The 6070.11.1 firmware numbers the M1 Pro encoder as device 14, type 11.
11 and 9 are the numbers of the later firmware generation. The firmware
reads the device number from scratch 2 at boot and looks it up after the
first handshake, so a wrong number cannot block the hello but selects the
wrong device row afterwards.

Assisted-by: LLM
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the M1 Pro the 6070 firmware is preloaded by the bootloader, which
also sets the coprocessor code base (+0x50000). The driver wrote that
register before every start. The write does not change what the
register reads back, but it breaks the boot: the core retires its reset
stub and builds its boot page tables, then stops before its first device
access, and the hello never comes.

Measured on the M1 Pro with one change per start: no write gets the
hello within 10 ms; a write of 0x0102000000000000, or of the value the
register already holds, gets no hello. So do not write it at all. The
bootloader value is the code base the firmware needs.

The encoded-form fields of the two 6070 variants are now unused, so drop
them and their test.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The T6000 6070 firmware says hello with {7, 0x9bc0, 0x100, 0xc0000}:
the last word is the size of a heap it wants from the host, as the 9003
firmware does. The driver required 0 there and gave up on the first
real hello from the M1 Pro.

Accept a heap request of up to 4 MiB on 6070 too, allocate it and hand
it over in the handshake block, with the layout 9003 already uses.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The T6000 6070 firmware publishes seven channels. The driver took the
sixth descriptor, SHAREDMALLOC (8 slots), for its reply ring and then
found no IO_T2H where it expected it, so the start-up stopped with
-EPROTO right after the hello. Replies come on IO_T2H, the seventh
descriptor (32 slots, the same doorbell as SHAREDMALLOC).

Read the channels by name: IO and IO_T2H as before, and on 6070 also

 - SHAREDMALLOC, on which the firmware borrows shared memory from the
   host. A request without an address asks for a block of the given
   size; the host answers with the block's address and size. A request
   with an address returns that block; the host answers with the
   address and a size of zero. The blocks come from a part of the IPC
   window kept for this (3 MiB past the command buffers), handed out in
   4 KiB units. The firmware asks for two 64 KiB blocks right after the
   channel hand-over, so the wait for the ready word serves the ring as
   well.

 - TERMINAL, the firmware's log. A line is read once the firmware has
   cleared bit 0 of its slot, the slot is handed back by setting it
   again, and lines in the IPC window go to the debug log.

Rings may not overlap. The KUnit channel test now uses the descriptor
table the firmware publishes and checks that the old reading is
refused; a new test plays the firmware side of SHAREDMALLOC.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
On the M2 iBoot points the encoder's code base at the AVE DART's
vm-base (0x800000000), and the firmware addresses its DATA there too, so
the firmware has to be mapped from vm-base, not from DART address zero
as on the M1 Pro. Accept a handoff whose TEXT starts a 4 GiB-aligned
DART window with DATA right after it, and compare only the low 32 bits
of the TEXT link cell with DATA's DART address.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The 6070.11.1 firmware numbers the M2 encoder as device 18, type 15;
15 and 13 are the numbers of the later firmware generation. As on
T6000, a wrong number does not block the hello: the firmware reads the
device number from scratch 2 at boot and looks it up after the first
handshake. On the M2 the start-up stopped there, after the hello.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The firmware start-up has three waits after the hello: the IPC window,
the handshake block and the channel hand-over. All three ended in the
same -ETIMEDOUT. Name the step that timed out.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
…are rings

The 6070 firmware publishes three host-to-firmware rings: IO, DEBUG and
BUF_H2T. The driver handed only the IO slots to the host. The others
stayed zero, and a zero slot reads to the firmware as a message posted
to it. On the M1 Pro and M2 the firmware sent its last handshake message
and then never took the ready word.

Set the host ownership bit in every slot of every host-to-firmware ring,
the ones the host does not use too.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
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