Skip to content

display: HDMI on the M2 Mac mini with the 27.2 firmware - #451

Merged
RyanTheTide merged 7 commits into
mainfrom
j473-hdmi/afkv2-dptx
Nov 23, 2026
Merged

RyanTheTide merged 7 commits into
mainfrom
j473-hdmi/afkv2-dptx

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The M2 Mac mini (J473) gets no picture before Linux on the 27.2 stub. iBoot never lights HDMI on M2 desktops, so aura has to drive the DCP itself, and on 27.2 it didn't. dcp_init() refused the dptx path unless the stub was 13.5. Past that gate, five more things stopped it on this firmware. Today's kernel doesn't drive the 27.2 DCPs on T8112 (apple-dcp: DCP firmware-compat 27.2.0 ... is not supported), so without aura the HDMI stays dark all the way into Linux.

Change

Seven commits. The first six each fix one thing the J473's 27.2 firmware ran into; the seventh answers the review of the sixth:

  1. dcp: decide the dptx-port message format from what the firmware announces (AFKv2 on any firmware, the older format still only on 13.5) instead of a firmware version and a T8152 chip exemption.
  2. dart: a locked T8110 display stream that bypasses only the DAPF stage still translates. iBoot locks dart-dispext0 with TCR 0x5 on 27.2.
  3. display: report HPD to the dptx-port when the converter's HPD reaches an AP gpio. The ADT says so with function-hdmi_hpd on the dp2hdmi-gpio node. This replaces if (chip_id == T8152); the J873g's ADT has the same property.
  4. dptx-phy: only the ATC phy acts on route, drive-settings and deactivate requests. A dedicated dptx-phy accepts them, as the pre-AFKv2 handler does.
  5. dptx-phy: the T8112 phy replays one macOS-traced setup that trains at HBR2. Report HBR2 instead of HBR (HBR failed clock recovery on every lane). The "qualified at a single rate" rule now covers any single-rate phy.
  6. display: once an AFKv2 dptx-port has been connected, its DCP acknowledges no power request. aura now hands it on running, as T8152/T8132 already do: endpoints stopped; RTKit, scanout and framebuffer left running; this stage's heap kept out of the next stage. Before, kboot refused to boot ("Display handoff failed; returning to proxy").
  7. display: carry live DCP ownership across aura stages (review fix). A stage that hands a DCP on running now tells the next aura stage so, and that stage keeps the picture instead of starting RTKit a second time. The receiving image advertises CHAINLOAD_HDR_F_LIVE_DCP in its load header; the sender passes a private ADT copy with /chosen/aurora,dcp-retained-heap (start of the retained heap); the receiver's display_init() keeps the inherited framebuffer and display_start_dcp() refuses to start a DCP again. The handoff is completed (display_prepare_live_handoff()) before chainload or kboot_prepare_dt() measure the heap, so a DCP started late (display=, proxy) is covered too, and kboot_boot() refuses entry if the display state changed after the tree was prepared. The heap reservation skips ranges already in the FDT reserve map, and a raw proxy vector is refused while a running DCP still needs a receiver.

Testing

  • J473, macOS 27.2 26B123 stub, attached HDMI (1920x1080), Fedora 7.3.0-40.fc44. Each row is a watchdog-backed one-shot; the production Stage 2 was restored and its SHA-256 checked afterwards.
    • Stage to stage (review point 1): a nested chain where one image with this PR modesets HDMI, hands the DCP on running and chainloads a second image with this PR. The receiver logs preserving live display from the previous stage (1920x1080) and starts no second RTKit session. Linux keeps the inherited range reserved (0x80413c000-0x807633fff), and simpledrm draws at 1920x1080.
    • Timing: Stage 1 vectors at 4.271 s; the receiving stage reports the configured picture at 8.730 s. That is at most 4.46 s from the Stage 1 handoff to a picture.
    • Settled regression row: systemd reaches running with 0 SELinux denials, 0 failed units and 0 new distinct kernel errors. The baseline's existing SEP gap was taken out with the SEP alias DT hunk from soc: apple: sep: Touch ID lines from DT only; alias the SEP on the M2 desktops linux#2256, identical to the SEP-only control boot. aurora-sep succeeds.
  • J413 (M2 Air), 13.5 stub, this Stage 2 as a one-shot: fleet kernel boots, eDP connected at 2560x1664, 0 denials, 0 failed units, 0 new kernel errors.
  • Host: make USE_CLANG=1 BUILDSTD=1 RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1 and the Stage 1 release build both link (Stage 1 vital end 0x11c048 of 0x120000). Full tests/python: 838 passed, 25 skipped, the same as main. New and extended tests cover the ADT marker, the receiver flag, the reservation split and the proxy-vector refusal.

Still to run

  • J473 headless (no HDMI and no USB-C display attached). It needs both cables pulled by hand, and I've asked for that.
  • J873g row from its owner (requested, kit sent).
  • M2 Pro/Max desktops (J474s/J475c/J180d) on 27.2: none in our lab.
  • Stage 1 built from this PR, installed: not done here (no Stage 1 changes in the lab tonight). The nested chain runs the same handoff code, but in a Stage 2 build.

Rollout order: a Stage 1 with this PR that hands a DCP on running will not chainload a Stage 2 that lacks the live-DCP flag. It stops instead of letting that Stage 2 boot the running DCP again. So Stage 2 must ship this PR no later than any Stage 1 that does. The installer payload carries both from one release.

Reviewer detail: what the 27.2 firmware did at each step

Logs: one per step, from the live J473 (aura console over the Stage 1 USB proxy, display_init called over the proxy).

step firmware / aura behaviour fix
gate dcp: dtpx-port is only supported with V13_5 OS firmware 1
DISP DART dart-dispext0 sid 0 locked, tcr 0x5 ... locked stream does not translate -> failed to initialize DISP DART 2
connect dptx-port connect + request_display OK, then 10 s of nothing: connected:0 timing_cnt:0 3 (HPD)
link config group 0 command 5 status 0xe00002bc x5 (WILL_CHANGE_LINK_CONFIG) 4
training group 1 command 3 status 0xe00002bc (SET_DRIVE_SETTINGS) each round 4
clock recovery lanes 4->0->4 loops at HBR, never connected 5
HBR2 set_link_rate 0x14, connected:1 timing_cnt:17, 1920x1080, swapped! -
shutdown AP power transition timed out (QUIESCED and IDLE), IOP power transition timed out (SLEEP), with: 5 s waits, HPD low, release_display + 2 s callback service (DEACTIVATE then OK), display power off, per-endpoint session close. Without a connected port the same DCP sleeps. 6

ADT facts (J473, 27.2): display-crossbar0 dfp 5 "dptx" = dptx-phy@3C540000 (dptx-phy,t8112, dp-switch-dfp-endpoint 5, dp2hdmi-gpio-parent); dp2hdmi-gpio: function-dp2hdmi_pwr_en gP15, function-hdmi_pwr_en gP16 (pKW4, 0x800000), function-hdmi_hpd AOP GPIO 49, pcon-stays-on 1. macOS 27.2 shows the HDMI port's converter link at HBR2.

Hand-on details: dcp_hand_on() = dcp_handoff() (#419) + marking the DCP running, so this stage never starts it again. kboot reserves [_end, heap high-water) when a DCP was handed on, the same rule as for a post-M4 ANS. The display stays lit: the kernel doesn't take over this DCP today, and simpledrm keeps drawing on HDMI.

Review response (Dj, 2ec1295)
  1. Re-init hazard at display.c:1146: commit 7. The marker is an ADT property in a copy that the sender hands to the next stage, so it survives the stage boundary; it is not the per-stage static. display_init() checks it before the external-display reconfigure branch. display_start_dcp() also refuses while it is present, so a display= mode line gives a clear error instead of rebooting RTKit. The sender refuses a receiver without CHAINLOAD_HDR_F_LIVE_DCP. kboot in the receiver reserves from the inherited heap start, so Stage 1's heap stays reserved whether or not the display DARTs are locked.
  2. Reservation ordering at kboot.c:12518: kboot_prepare_dt() now calls display_prepare_live_handoff() first. That stops a live AFKv2 dptx-port DCP's endpoints wherever it was started, then reads display_handed_on_live() and the heap high-water. If the handoff fails, DT preparation fails (fail closed). kboot_boot() repeats the check and refuses entry if a DCP went live after the tree was prepared. Chainload measures the heap after the same call.
  3. Evidence: the J473 settled 0/0/0 and J413 rows are above. Headless J473 and J873g are still to run.

Evidence (lab): traces/display/20261122-j473-live-handoff/ (untainted).

Assisted-by: LLM (Claude:Opus 5.5)

The dptx-port path behind dp2hdmi (M2 desktops, J873) was refused unless
the OS firmware was 13.5, with T8152 exempted by chip. On a J473 with a
27.2 stub aura therefore never drives HDMI, and M2 desktops have no iBoot
framebuffer, so the screen stays black until Linux.

The firmware announces whether its dptx-port service speaks AFKv2, and
the endpoint code already handles both formats. Decide from that instead:
AFKv2 is driven on any firmware, the older format still only on 13.5,
whose layouts are the only ones checked. The chip exemption goes away,
as T8152's endpoint speaks AFKv2.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…lates

dart_init_adt_display() adopts a locked display stream only while it
translates through its inherited tables. For T8110 it counted the DAPF
bypass bit as "not translating", but that bit only skips the DMA
address filter stage; the page tables still translate, and the rest of
dart.c reads TCR that way (only BYPASS_DART and REMAP_EN end
translation).

With the 27.2 firmware, iBoot locks dart-dispext0 on the M2 Mac mini
with TCR 0x5 (translate, DAPF bypass), so the DISP DART was refused and
the external DCP could not be started.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
display_configure() told the dptx-port service about HPD only on T8152.
The reason holds for any machine where the DP-to-HDMI converter's HPD
goes to an AP gpio instead of the phy: a dptx-port service that speaks
AFKv2 does not bring the port up until the AP reports HPD.

The ADT describes that wiring: the converter's dp2hdmi-gpio node has
function-hdmi_hpd. Decide from that and from the service's format. The
J873g's ADT has it on dp2hdmi-gpio0 and its service speaks AFKv2, so it
keeps its HPD report; the M2 Mac mini on the 27.2 firmware now gets one
too, and its firmware then starts link training. The older format never
needed the report and does not get it.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The AFKv2 dptx-port handler passes WILL/DID_CHANGE_LINK_CONFIG,
SET_DRIVE_SETTINGS and DEACTIVATE to the phy, which accepted them only
for T8152's two phys and failed them for every other phy type. On the
M2 Mac mini (dptx-phy,t8112) with the 27.2 firmware, WILL_CHANGE_LINK_
CONFIG then failed every time and link training never started; with
that fixed, SET_DRIVE_SETTINGS failed each training round.

Only a phy behind an ATC port switches its route, takes new drive
levels or powers down per link. A dedicated dptx-phy is wired to its
display-crossbar slot when it is set up, as the T8152 HDMI phy already
was. Accept those requests for it, which is what the pre-AFKv2 handler
does for every phy.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
dptx_phy_set_link_rate() does not program a rate for the T8112
dptx-phy: it replays the one register setup taken from a macOS trace
(fc64fcc). The AFKv2 handler reported HBR as the maximum and accepted
only HBR, so the 27.2 firmware trained at HBR while the phy ran that
setup, and clock recovery failed on every lane in every round. macOS
trains the M2 Mac mini's HDMI converter at HBR2. With HBR2 reported, the
firmware trains at HBR2 and the link comes up.

Report HBR2 for this phy and generalise the "qualified only at HBR"
rule to any phy with a single rate: ACTIVATE starts at that rate and
SET_LINK_RATE accepts only it. Phys qualified at HBR behave as before.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Once a dptx-port that speaks AFKv2 has been connected, its DCP answers
no power request. On the M2 Mac mini with the 27.2 firmware, after the
HDMI modeset neither AP QUIESCED or IDLE nor IOP SLEEP is acknowledged,
not with longer waits, not after HPD is dropped, the display released
or powered off, nor after DEACTIVATE succeeds. dcp_shutdown() then
keeps it as running and kboot refuses to boot the next stage ("Display
handoff failed; returning to proxy"). Without a connected port the same
DCP sleeps fine.

Hand such a DCP on running instead, as the T8152 and T8132 displays
already are: stop the iBoot interface and the other endpoints
(dcp_handoff()) and leave RTKit, its buffers and DART mappings and the
scanout running. The display stays lit, so U-Boot, GRUB and Linux's
simpledrm keep showing the framebuffer aura set up. The DCP counts as
running from then on, so this stage never starts it again, and kboot
keeps this stage's heap, where its RTKit buffers live, out of the next
stage's memory, as it already does for a post-M4 ANS.

A kernel that takes over such a DCP has to adopt a running core, as the
T8132 one does; today's kernel does not drive the 27.2 DCPs of T8112.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

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

Strong, well-structured series — commits 1–5 cleanly replace chip/version gates with firmware- and ADT-driven decisions (dcp_dptx_is_afkv2, function-hdmi_hpd, DPTX_PHY_T8152_ATC vs dedicated dptx-phy, T8110 DAPF bypass consistency with the rest of src/dart.c, and T8112 single-rate HBR2), all 6 commits have clean human attribution + Signed-off-by:, and all 15/15 CI checks pass.

Requesting changes on three blockers (two §3 safety/handoff issues in commit 6, plus §5 hardware evidence):

Blockers

  1. §3 Stage 1 → Stage 2 live-DCP re-init hazard (src/display.c:1146)
    config.h enables USE_FB in both Stage 1 and Stage 2. In testing, Stage 2 ran behind an older Stage 1 (b13) that skipped HDMI on 27.2, so only Stage 2 started dcpext. Once Stage 1 is built from main with this change:

    • Stage 1's display_init() brings up HDMI on dcpext (1920x1080) and main.c:453 hands dcpext on running via dcp_hand_on().
    • Stage 2 then enters display_init() (src/display.c:1146):
      } else if (display_is_external && is_mac) {
          printf("display: External display found, reconfiguring\n");
          return display_configure(NULL);
      }
    • Unlike display_init_t8152() (which adopts any non-640x1136 framebuffer), Stage 2 unconditionally calls display_configure(NULL) → dcp_init() → rtkit_boot() on a dcpext whose RTKit and scanout are already running (and which stops answering power requests after an AFKv2 dptx-port connect).
    • Also note: display_handed_on_live() is a per-stage static bool (dcp_handed_on). On J473 27.2 specifically, Stage 2's kboot_prepare_dt() still keeps Stage 1's heap via display_dart_tables_inherited() because dart-dispext0 is locked, but if Stage 1 ever hands on an AFKv2 dptx-port DCP whose display DARTs are unlocked and Stage 2 adopts the framebuffer, Stage 2 would see display_handed_on_live() == false and drop Stage 1's heap reservation. Please make the Stage 1 → Stage 2 adoption and heap-retention invariant explicit (and verify a chain where Stage 1 also includes this PR, or adopt an already-configured framebuffer instead of re-booting a live DCP).
  2. §3 Retained-heap reservation ordering hole (src/kboot.c:12518 vs src/main.c:513)
    kboot_prepare_dt() reserves this stage's heap ([_end, heapblock_high_water())) when display_handed_on_live() is true, which is only set inside dcp_hand_on() during display_shutdown().

    • On the default main.c:450 → 453 path, display_shutdown() runs before kboot_prepare_dt(), so the heap is reserved.
    • However, if an AFKv2 dptx-port DCP is started after main.c:453 (e.g., via display= in payload.c:329 when display_init() did not start DCP, or via proxy before kboot_prepare_dt() / kboot_boot()), iboot is still open during kboot_prepare_dt(), so display_handed_on_live() is still false and the heap holding the live DCP's RTKit buffers is not reserved — then main.c:513 hands the DCP on running into Linux with unreserved DMA buffers.
    • Please close this window (e.g., hand off before kboot_prepare_dt() as payload.c:639 does for T8152, and/or have display_handed_on_live() cover a live AFKv2 dptx-port DCP that display_shutdown() will hand on, while still failing closed if display_shutdown() fails).
  3. §5 Evidence — J473 regression counts and non-J473 hardware rows

    • On the J473 27.2 Fedora boot, please add the §5 regression check counts (0 SELinux denials, 0 failed units, 0 new kernel errors) and confirm a headless J473 boot (no HDMI cable attached, since dcp_dptx_hpd(..., true) is asserted unconditionally whenever function-hdmi_hpd is present) still boots cleanly without hanging dcp_handoff().
    • Per §1/§5, this series modifies shared dcp_init(), dcp_hdmi_dptx_init(), display_configure(), dptx_phy_*, and dptxport_call_v2() paths used on J873g as well as M2 machines. Please land the J873g (owner run) and J413 regression rows listed under "Still to run" before merge.

Non-blocking notes

  • display= config variable on J473 27.2: Because main.c:453 calls dcp_hand_on() (setting dcp_running = true), a display=<mode> line parsed later in payload.c:329 will hit dcp_left_running() in display_start_dcp() and fail with "display: a DCP did not stop; not starting it again". Worth keeping in mind if custom boot resolutions are expected to work on 27.2.
  • DPTX_PHY_T602X rate in dptx_phy_max_link_rate(): dptx_phy_set_link_rate() writes 0x2a3 (HBR3) for DPTX_PHY_T602X while dptx_phy_max_link_rate() keeps returning 2700 (HBR) — fine to leave untouched until M2 Pro/Max desktops on 27.2 can be tested, just flagging for future follow-up.

Assisted-by: LLM (Gemini 4 Neon)

Advertise live display support in the load header and pass the retained heap in a copy of the ADT. Preserve the inherited framebuffer without starting a second RTKit session. Reject raw proxy vectors while a live receiver is required.

Complete pending live display handoffs before measuring retained memory. Keep the reservation clear of earlier FDT entries and require successful DT preparation before kernel entry.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Thanks for the review. 3daee92 addresses both commit-6 blockers. The PR body has the full response under "Review response".

  1. Stage-to-stage re-init: the sender passes the next stage a copy of the ADT with /chosen/aurora,dcp-retained-heap, and only to a receiver whose load header advertises CHAINLOAD_HDR_F_LIVE_DCP. The receiver's display_init() keeps the inherited framebuffer and starts no second RTKit session. The receiver's kboot reserves from the inherited heap start, whether or not the display DARTs are locked. Tested on the J473 (27.2) with a nested chain in which both images carry this PR: preserving live display from the previous stage (1920x1080), and Linux keeps the range reserved.
  2. Reservation ordering: kboot_prepare_dt() and chainload complete the live handoff (display_prepare_live_handoff()) before they read display_handed_on_live() or the heap high-water, and fail closed if it fails. kboot_boot() refuses entry if a DCP went live after the tree was prepared. A raw proxy vector is refused while a running DCP needs a receiver.
  3. Rows: J473 settled 0 denials / 0 failed units / 0 new kernel errors (SEP gap of the stock DT closed with the linux#2256 hunk, as in the control). J413 13.5: eDP 2560x1664, 0/0/0. Headless J473 (cables pulled by hand) and the J873g owner row are still open.

Rollout note: a Stage 1 with this change will not chainload a Stage 2 without the flag while it holds a running DCP, so Stage 2 has to ship it first or together.

Assisted-by: LLM (Claude:Opus 5.5)

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

Adversarial re-review of commit 7 (3daee9293eab4ddbbfca023dd7f8dd4befdbba82) against 2ec12954 and the pre-PR checklist (§1–§6).

Both §3 code/handoff blockers from 2ec12954 are cleanly resolved (0 new code, ABI, policy, or CI defects found). Keeping the existing REQUEST_CHANGES gate active solely for the two remaining §5 hardware rows listed under Still to run.

Verified in 2ec12954..3daee929

  • Load header ABI (src/chainload.h, src/start.S, src/chainload.c): CHAINLOAD_HDR_F_LIVE_DCP (bit 1) preserves CHAINLOAD_HDR_SIZE (0x20) and field offsets (checked by _Static_assert and .if in start.S), stays forward-compatible with older senders, and chainload_image() refuses any receiver lacking CHAINLOAD_HDR_F_LIVE_DCP when display_needs_live_receiver() is true.
  • Private ADT copy & bounds (src/chainload.c, src/display.c): Inserts /chosen/aurora,dcp-retained-heap (LIVE_DCP_ADT_ENTRY_SIZE = 44 bytes, 4-byte ADT_ALIGN preserved) into a private ADT copy inside fw_data so retries (aura-try fallback) leave the live ADT untouched. chainload_set_adt_range() bounds-checks against cur_boot_args.devtree_size and correctly shifts /chosen/memory-map offsets past the inserted /chosen property (SEPFW, DeviceTree, preoslog, BootArgs). Cache maintenance covers both parked (dc_cvac_range) and staged/in-place (chainload_asm.S) copies. display_init() preserves the inherited display before the external-display reconfigure branch, and display_start_dcp() refuses re-init while the marker is present.
  • Reservation ordering & fail-closed guards (src/kboot.c, src/proxy.c):
    • Both kboot_prepare_dt() and chainload_image() call display_prepare_live_handoff() before measuring heapblock_high_water() / display_handed_on_live(), covering late modesets (display=, proxy) and failing closed if endpoint shutdown fails.
    • kboot_prepare_dt() validates inherited_dcp_heap, extends [image_start, image_end) regardless of whether display DARTs are locked, and uses dt_reserve_retained_span() to emit strictly non-overlapping memreserve intervals around pre-existing reservations (FDT buffer, legacy DART L2 tables) so U-Boot does not drop partially overlapping spans.
    • kboot_boot() re-runs display_prepare_live_handoff() and refuses entry if display_needs_live_receiver() && !dt_retained_live_dcp.
    • proxy.c (P_VECTOR) refuses raw vectoring while display_needs_live_receiver() is true.
  • Rollout safety, §4 hygiene, & CI: Rollout ordering (Stage 2 must ship no later than Stage 1) is clearly documented; all 7 commits carry human identity (Ryan Murray <ryan@aurorasilicon.org>) + Signed-off-by: with zero AI commit trailers; 15/15 CI checks green; J473 nested stage-to-stage + settled 0/0/0 regression row and J413 13.5 regression row are logged.

Non-blocking note

  • Because proxy.c now refuses P_VECTOR whenever display_needs_live_receiver() is true (the right fail-closed §3 choice), proxyclient/tools/chainload.py (which uses P_VECTOR) will be rejected from a Stage 1 that already handed an AFKv2 dptx DCP on running. Worth keeping in mind for lab/recovery workflows (or following up to teach chainload.py the live-DCP marker / chainload_image path).

Remaining merge gate (§5 hardware evidence only)

  1. J473 headless (27.2, no HDMI / no USB-C attached): Especially important to verify on hardware because display_configure() still runs dcp_connect_dptx() + dcp_dptx_hpd(..., true) and display_shutdown() invokes dcp_hand_on() on AFKv2 dptx-port even when hpd == 0.
  2. J873g owner row: Confirms no regression across the shared dcp_hdmi_dptx_init / dcp_dptx_needs_ap_hpd / dptx-phy paths (commits 1, 3, 4).

Once those two rows are posted, this is ready to APPROVE.

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

J473 (M2 Mac mini, 27.2 stub) rows for 3daee92. The physical headless row (both displays unplugged) is still to run; Ryan is asked to unplug them in the morning. The simulation below covers aura's own no-display path in the meantime.

Headless, simulated. I wrote no Stage 1 and no boot.bin; each image ran once via aura-try, on the default Fedora kernel.

  • HDMI 5 V held off alone (ADT function-hdmi_pwr_en) does not work as an unplug. The monitor's HPD pin (ADT function-hdmi_hpd) drops within 0.5 s, but the powered monitor still answers EDID and aura reports HPD high to the dptx-port. The DCP still listed 17 modes and set 1920x1080.
  • 5 V off plus HPD reported low to the dptx-port: waited 10000 ms for display status, connected:0, the DCP handed on running, then U-Boot and Fedora. Systemd reached running with 0 failed units, 0 AVCs and Enforcing, on simpledrm at the 640x1136 placeholder. So a headless boot completes, but this Stage 2 spends its whole 10 s dptx status budget before going on (Linux starts at 15.9 s, against 8.4-8.6 s with a monitor).
  • A real unplug differs: the firmware is told HPD high against a converter with no sink. That is the row Ryan's unplug will give.

Timing, attached, production v1 (same display path). Stage 1 hands over to Stage 2 in 0.125 s. The HDMI frame is up 3.44 s after Stage 1 hands over: 2.7 s of status wait plus 0.44 s of modeset. Two boots.

Details
  • Sim patches are lab-only (one SMC write and the HPD argument) and are not proposed here.
  • Mode: 1920x1080@60, the monitor's native mode. aura's default chooser caps the boot mode at 1920x1200 and 60 Hz.
  • Possible follow-up, not in this PR: read the converter's HPD from function-hdmi_hpd before telling the dptx-port, and cut the status wait when the pin is low. That needs the physical row first.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Contributor

@sithglan — relaying Ryan's J873g regression request for aura#451 at head 3daee929 (one of the two remaining rows before merge):

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Headless follow-up: #458 (stacked on this PR, one commit) reads the HDMI HPD pin from function-hdmi_hpd. When nothing is plugged in it skips the 10 s dptx status wait. On the M2 Mac mini, a no-sink one-shot (5 V held off so the pin was really low) went from a 10000 ms wait and Linux at 15.9 s to no wait and Linux at 6.7 s. The attached case is unchanged: same 1920x1080 modeset. This PR's head is not touched. The physical unplug row and the J873g owner row are still to run.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Follow-up for the running DCP this PR hands on: #467 (stacked, two commits) describes the RTKit session on the DCP node, so a kernel can adopt it without HELLO/EPMAP. It also gives aura's syslog and ioreport buffers reserved-memory regions with iommu-addresses. Without them the kernel's rebuild of the dcpext DART tables dropped those mappings while the firmware was still running. On the M2 Mac mini, the slot is present in the kernel's table at runtime (default kernel, Enforcing, 0 AVC). This PR's head is unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

@sithglan, one J873g row would let this land, together with the stacked #467. The kit from yesterday's request targeted an older commit; this one builds the current heads directly with no patch: https://gist.github.com/RyanTheTide/9ebc3216edd8d9bb3ac82697cac83add

Two aura-try one-shots on your normal kernel and command line: row A is this PR's head (3daee929), row B is #467's head (cbc08d3e). For each one: HDMI and USB-C display modes, the Stage 2 dptx/hpd lines, and the counts against a normal boot (failed units, AVC denials, new kernel errors, DART faults). On the J873g neither change should alter the display path, and that is what the row checks.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

@sithglan @Acelogic, one J873g row would let this land together with the stacked #467, whose head is now final (76f50f2a). The kit is updated to it: https://gist.github.com/RyanTheTide/9ebc3216edd8d9bb3ac82697cac83add

Two aura-try one-shots on your normal kernel and command line (row A = this PR's head 3daee929, row B = #467's head 76f50f2a), with HDMI attached if you can. Record the stage log, whether the HDMI picture survives into Linux, and the DART/DCP error counts, as listed in the gist. The J873g is the only Mac we know of with an AFKv2 DCP that is not a T8112 and takes the dptx hand-on path, so we can't run this row in our lab. No Stage 1 or boot.bin change.

@sithglan

Copy link
Copy Markdown
Contributor

J873g (Mac mini M6) owner row for #451 and #467, as asked. Both rows show no change from the normal boot.

Setup

  • macOS stub 27.2. The installed Stage 1 is 1.0.0b14-gd7f5a487; it was not touched.
  • The committed Stage 2 is the same build. Its tail is only boot= (the ESP's kernel, DTB and initramfs) and chosen.bootargs=, with no DTBs or U-Boot.
  • Trial images: the committed Stage 2 with only the aura head replaced. Both heads were built from your kit's commits with USE_CLANG=1 BUILDSTD=1 RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1:
    • A: 3daee929 (1.0.0b14-g3daee929)
    • B: 76f50f2a (1.0.0b15-g76f50f2a)
  • Kernel: the normal 7.3.0-aurora-j873-avd-usb4-perf+, on the normal command line plus one parameter (see the end).
  • Displays: an EIZO on HDMI and one on the back-left USB-C port. A USB4 NVMe enclosure sits on back-right, so iBoot lights no display, and Stage 2's dptx attempt fails the same way in every boot. Linux's display driver brings both monitors up.
normal boot row A (#451) row B (#467)
Stage 2 / chosen/aurora,trial 1.0.0b14-gd7f5a487 / none 1.0.0b14-g3daee929 / aurora/try451/stage2.bin 1.0.0b15-g76f50f2a / aurora/try467/stage2.bin
HDMI (DP-2) connected, 29 modes, 2560x1440@60 same same
USB-C back-left (DP-1) connected, 29 modes, 2560x1440@60 same same
failed units / AVC denials 0 / 0 0 / 0 0 / 0
kernel error lines 2 the same 2 the same 2
DART faults 0 0 0

Stage 2 log (read from the aura_stage2.log reserved region):

  • The display:, dcp: and dptx lines are identical in all three boots:
    • No supported USB-C display connected
    • trying HDMI (dptx-phy)
    • dcp: failed to power DPTX_PHY
    • continuing with firmware framebuffer
  • FDT: retained live T8152 DCP firmware, VRAM and framebuffer appears in all three.
  • No hpd, handing the DCP on, preserving or not described lines in any boot: no DCP is handed on live here.
  • Row B: the reserved-memory nodes and the three DCP nodes' properties are identical to the normal boot.
  • The trial marker and images were removed afterwards, and the committed Stage 2 boots as before.

aura-try on the J873g resets right after Linux starts.

  • The first four trials, including a control trial of the committed Stage 2 itself, all fell back to the committed Stage 2.
  • Each trial boot reached Linux and early systemd. The kernel logged watchdog: watchdog0 running and kernel based pre-userspace handler disabled, and the journal then stopped with no shutdown: a hard reset. The normal boot has no running watchdog.
  • The whole cycle took 57 s: reboot, trial boot, trial Linux, then a full fallback boot to the kernel. So the reset came seconds after Linux started, not 178 s after the last wdt_arm_trial().
  • My guess, not checked: the T8152 watchdog ticks faster than the 24 MHz wdt_arm() assumes.
  • With watchdog.handle_boot_enabled=1 added to the trial images' chosen.bootargs (this kernel has CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED off), the kernel services the watchdog itself. Both trials stayed up, and row A ran past 200 s. That parameter is the only command-line difference in the rows above.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Physical headless row, J473 (M2 mini, 27.2), with a person unplugging both displays

Both display cables were unplugged at the Mac: the HDMI monitor and the USB-C-to-HDMI cable. Only Ethernet, the debug tether, a USB keyboard and a USB-A stick stayed attached.

Follow-up for #458: with no sink, Stage 2 still spends 2.7 s on the display-status wait. That's fine for this row, but worth checking whether the HPD-low path can return sooner.

Assisted-by: LLM (Claude:Opus 5.5)

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

Formal adversarial pre-PR checklist (§1–§6) re-review at 3daee9293eab4ddbbfca023dd7f8dd4befdbba82 (CI: 15/15 green — build, test x5 incl. native ARM start.S, stage1-size x5, esp-stage2-size, format-check, aurora-agent-policy x2; MERGEABLE / CLEAN).

Verdict: APPROVE

Both remaining §5 hardware rows from my prior 3daee929 review are now in, with 0 code, safety, ABI, CI, or policy blockers remaining:

  1. J873g owner row (@sithglan, row A = 3daee929): Booted via aura-try on 27.2 stub (Stage 1 untouched) with HDMI (DP-2, 2560x1440@60) and USB-C (DP-1, 2560x1440@60) connected: identical display modes, identical Stage 2 display:/dcp:/dptx logs, 0 failed units, 0 AVC denials, 0 DART faults, and identical baseline kernel errors. Confirms no regression across the shared dcp_hdmi_dptx_init / dcp_dptx_needs_ap_hpd / dptx-phy paths.
  2. J473 physical headless row (@RyanTheTide, both displays physically unplugged): Tested on 76f50f2a (#451 + #467, default 7.3.0-aurora-fleet83, default cmdline) — no 10 s stall (waited 2700 ms, Linux up at ~7.7 s), SELinux Enforcing, 0 AVC denials, 0 DART faults, 0 DCP errors, 0 oops (only known unrelated aurora-sep.service).
  3. Prior verified rows: J473 27.2 attached HDMI (1920x1080, nested stage-to-stage live handoff + settled 0/0/0) and J413 13.5 eDP (2560x1664, 0/0/0). Unowned M2 Pro/Max desktops (J474s/J475c/J180d on 27.2) are not in the lab; J473 (T8112 27.2) + J413 (T8112 13.5) + J873g (T8152 AFKv2 dptx) stand in cleanly.

Stage 1 & Rollout Notes

  • Stage 1 touchpoints: This PR touches shared Stage 1/Stage 2 code (src/start.S, src/chainload.{c,h}, src/dcp.{c,h}, src/display.{c,h}, src/dart.c, src/dcp/dptx_phy.{c,h}, src/dcp/dptx_port_ep.{c,h}, src/proxy.c, src/kboot.c). All 5 stage1-size CI jobs pass (headroom unchanged at 16312 B) and the author is the Stage 1 owner.
  • Rollout invariant: A Stage 1 built with #451 that hands a DCP on running refuses to chainload a Stage 2 lacking CHAINLOAD_HDR_F_LIVE_DCP (and #467 will additionally require CHAINLOAD_HDR_F_LIVE_RTKIT). Ship Stage 2 with this change no later than any Stage 1 built from it, and run cold-boot Stage 1 qualification as part of the release cut rather than installing Stage 1 from PR merge.

§1–§6 Checklist Summary

  • §1 No model gating: Pass (firmware AFKv2 announcement, ADT function-hdmi_hpd, and PHY type replace chip/version gates).
  • §2 Production-ready: Pass (default cmdline, no hacks/sleeps).
  • §3 Safety: Pass (CHAINLOAD_HDR_F_LIVE_DCP handoff guard, private ADT copy, non-overlapping memreserve splits, fail-closed kboot_boot() and P_VECTOR refusal).
  • §4 Clean-room & attribution: Pass (all 7 commits carry human identity + Signed-off-by:, 0 AI commit trailers, Assisted-by: in PR body).
  • §5 Evidence: Pass (J473 attached + nested + physical headless, J413 13.5, J873g owner row, 838/838 host tests).
  • §6 Naming: Pass.

Assisted-by: LLM (Gemini 4 Neon)

@sithglan

Copy link
Copy Markdown
Contributor

A correction to my J873g note above: the trial resets are not a T8152 clock problem. aura's 24 MHz is right. On the running M6, WD1_CUR_TIME advances 23.99 M ticks per second.

What happens

  • A trial boot hands Linux a running watchdog with aura's 178 s alarm.
  • apple_wdt_probe() marks it WDOG_HW_RUNNING and still calls apple_wdt_set_timeout() with the driver's 30 s default. That zeroes the count and writes BITE_TIME = 30 s × clk. After a trial boot the M6's alarm reads 0x2AEA5400, exactly 30 s × 24 MHz.
  • From there, only the kernel (WATCHDOG_HANDLE_BOOT_ENABLED) or a userspace watchdog keeps the Mac alive. This M6 kernel has # CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is not set (the Kconfig default is y) and systemd's RuntimeWatchdogSec=0.
  • So every trial resets about 30 s after the driver probes. That matches the 57 s cycles: trial boot, about 32 s of Linux, then a full fallback boot. watchdog.handle_boot_enabled=1 (or the config option) makes the kernel ping it, which is why the rows above stayed up.

Why it matters beyond this Mac: any OS whose kernel turns that option off and runs no watchdog daemon cannot keep an aura-try trial alive past about 30 s of Linux. A healthy trial looks like a failed one and falls back. The release notes have the distributions' Stage 2 updaters install a new Stage 2 as an aura-try trial, so on such an image every update would fall back.

It may be worth a line in the aura-try docs: Linux has to take over the trial watchdog, either with CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED=y or watchdog.handle_boot_enabled=1, or with a userspace watchdog. The Debian image configs should be checked for it.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide
RyanTheTide merged commit 3f7d517 into main Nov 23, 2026
15 checks passed
@RyanTheTide
RyanTheTide deleted the j473-hdmi/afkv2-dptx branch November 27, 2026 13:21
satchlj pushed a commit to satchlj/aura that referenced this pull request Nov 29, 2026
On M1 Mac mini (J274, T8103) running macOS 27.2.1 firmware, /arm-io/dcp
drives HDMI directly (display_is_external = true, display_is_dptx = false)
over an AFKv2 disp0-service iBoot interface. Once the display has been
powered on and modeset, rtkit_sleep() times out waiting for the AP power
transition ("rtkit(dcp): AP power transition timed out"), leaving
dcp_running = true so subsequent handoff fails ("Display handoff failed;
returning to proxy") — the same 27.2 firmware behaviour handled for
AFKv2 dptx-port controllers in aurora-silicon#451.

Without a connected display (headless, connected:0), display_configure()
returns before powering on the display and rtkit_sleep() still succeeds
in <1 ms, so the headless path keeps sleeping the DCP.

Add dcp_ib_is_afkv2() and generalize display_dptx_hands_on() into
display_dcp_hands_on() so a lit external AFKv2 display is handed on
running via dcp_hand_on() and published to Linux through
apple,rtkit-handoff ("dcp-live-v1"). Evaluate display_dcp_hands_on()
before dcp_ib_shutdown() frees iboot.

Tested:
- J274 (M1 Mac mini, T8103, macOS 27.2.1 main OS):
  - Cold boot with HDMI (1920x1200@60) plugged in via enrolled Stage 1:
    modeset succeeded, "display: handing the DCP on running (external
    AFKv2 display)", published live RTKit session v12 (3 buffers,
    epmap 0000051f 00821fff), Linux 7.3.0 apple-dcp adopted dcp-live-v1
    seamlessly (fb0 appledrmfb, 1920x1200@60, 0 DART faults, 0 failed
    units).
  - Headless boot (HDMI unplugged) on patched Stage 2: connected:0,
    slept DCP cleanly in 0.4 ms ("pmgr: resetting device 0.DISP0_CPU0").
- Host: clang-format clean, Stage 1 builds cleanly (12,296 B headroom,
  no __TEXT_BOOT_EXEC), Stage 2 ESP build links cleanly, full pytest
  tests/python: 1251 passed, 26 skipped.

Risk: low — only applies to external displays on an AFKv2 iBoot
interface after power-on; headless external boots, AFKv1 (13.5) external
displays, internal panels, and existing AFKv2 dptx-port displays keep
their previous behaviour.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
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