Skip to content

kboot: T8152: publish the internal DCP's hand-off state - #301

Open
sithglan wants to merge 3 commits into
aurora-silicon:mainfrom
sithglan:thomas/t8152-dcp-handoff-state
Open

sithglan wants to merge 3 commits into
aurora-silicon:mainfrom
sithglan:thomas/t8152-dcp-handoff-state

Conversation

@sithglan

@sithglan sithglan commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

apple_dcpib (aurora-silicon/linux#2176) reads /chosen/apple,dcp-rtkit-running to decide whether to adopt the internal DCP as running or wake it from quiesce. aura never sets the property on T8152, so the kernel always adopts the DCP. That breaks whenever aura quiesced the DCP after a failed display setup:

  • display_start_dcp() calls dcp_shutdown() after the framebuffer DVA lookup or dcp_ib_init() fails.
  • dcp_init() quiesces RTKit again when a step after the RTKit boot fails: the AFK init, or the J873g's HDMI dptx init.

On the J873g (M6 Mac mini) this happened on the first boot after a 1TR session. The loader logged display: failed to initialize DCP iBoot interface, apple_dcpib adopted the quiesced DCP and failed with failed buffer request ep=0x1 and no disp0-service, and the display on that DCP stayed dark.

What this changes

  • display.c tracks the internal DCP's RTKit state: -1 when aura never started it, 1 running, 0 quiesced.
    • It becomes 1 once dcp_init() succeeds.
    • After a failed start it is the result of dcp_shutdown(): 0 when the DCP quiesced, 1 when it did not stop.
    • After a failed dcp_init() it is 1 if dcp_init() left the DCP running, and 0 if it booted RTKit and then quiesced it again. The new dcp_init_left_quiesced() reports the second case. In every other case the state is unchanged.
    • Only the internal DCP's config (/arm-io/dcp) counts. DCPEXT0, swapped in for the second display, does not change the state.
  • On T8152 display_shutdown() returns early because the kernel owns the live controllers, so no other path changes the state.
  • dt_prepare_t8152() publishes the state as apple,dcp-rtkit-running (1 running, 0 stopped) and logs FDT: internal DCP running|stopped at the hand-off. If aura never started the DCP, the property is left out and the kernel behaves as it does today.

Hardware test (J873g, macOS 27.2)

aura main cannot launch the desktop kernel on the M6 yet (see #300). So, as with #300, the change runs on the M6's installed self-boot loader (the aura-test lineage). The functions this PR adds or changes are identical there:

  • display_internal_active
  • display_dcp_handoff_state
  • display_stop_failed_dcp
  • display_start_dcp
  • dcp_init_left_quiesced
  • dcp_init, apart from main's existing dart_init_adt_display() call
  • dt_set_dcp_state_t8152

The lineage differs in one way: it stops the DCP endpoints at the hand-off, so it also records the state in display_shutdown().

All runs were cold boots of the loader installed as Stage 1:

Installed loader aura log Linux apple,dcp-rtkit-running Displays
state published on start only FDT: internal DCP running at the hand-off 1 EV2780 on HDMI, EV2780 and S2431W on USB-C: all up
same, first boot after 1TR failed to initialize DCP iBoot interface 1, wrong because the DCP was quiesced no disp0-service, S2431W dark
start failure recorded (this PR's display_start_dcp) FDT: internal DCP running at the hand-off 1 all three up

Injected failures (E2E on the J873g)

Both failure paths were also run on the installed loader. Each run used a test-only build of the same lineage (v0.1.0-264-gba2b5ab0 plus a few lines injecting the failure for the internal DCP), enrolled from 1TR and cold-booted with HDMI and both USB-C monitors connected.

Injected failure aura log Linux apple,dcp-rtkit-running apple_dcpib, main DCP
dcp_ib_init() fails (as on the boot above) failed to initialize DCP iBoot interface, DCP hand-off -> 0, FDT: internal DCP stopped at the hand-off 0 quiesced DCP wake: 0, then HDMI 2560x1440@60. All three monitors up.
AFK init fails after the RTKit boot (dcp_init() quiesces) failed to initialize DCP, DCP hand-off -> 0, FDT: internal DCP stopped at the hand-off 0 quiesced DCP wake: 0, then a USB-C display

In both runs the kernel woke the DCP instead of adopting a stopped one. In the second run the kernel's shared-port handling then lost HDMI, because nothing powered the PS190 so the HDMI HPD stayed low, and its USB-C EDID reads failed. Both are kernel issues, handled in aurora-silicon/linux#2176, and not related to the loader state.

Not exercised on hardware

  • dcp_init() failing with the DCP left running.

Build: LLVM 22 with no new warnings; git clang-format is clean.

@sithglan

Copy link
Copy Markdown
Contributor Author

New commit a2f3d03: "tests: cover the T8152 DCP hand-off state". The pytest jobs failed because two harnesses copy the code this PR changes verbatim:

  • test_t8152_display_fb didn't compile display_start_dcp(), since dcp_init_left_quiesced() and display_stop_failed_dcp() were missing. The harness now stubs the first and takes the second along, and its dcp_shutdown() stub returns its int.
    • It also checks the new state: 1 after a good start, -1 on other chips, and still 1 after a failed second display.
    • A new case covers a failed internal start: 0 when dcp_init() quiesced the RTKit it booted, 1 when it left it running.
    • Negative controls: dropping the T8152/internal-DCP guard on the success path fails other-chip-growth-remaps, and dropping the quiesced branch fails t8152-failed-start-state.
  • test_legacy_table_lifetime (c4_dcp and its mutants) didn't compile the verbatim out_rtkit label, which now sets dcp_init_quiesced. The harness now declares it.

Locally pytest tests/python is now 744 passed, 3 failed. The same 3 fail on main 3d517e6 here: test_dcp_iboot_wire, test_external_dependency_group and test_xnuboot_layout.

format-check fails on main itself, in src/sptm_virt_s2r.c, a file this PR doesn't touch; #303 formats that file.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the injected-failure runs, they cover both quiesce paths nicely. One request while neither side is merged: /chosen/apple,dcp-rtkit-quiesced is published as 1 when the DCP is running and 0 when it was quiesced. The apple_dcpib side in linux#2176 has to say "despite its name" to read it. Could the property name match the value, e.g. apple,dcp-rtkit-running with the same 1/0, or keep the name and publish 1 for quiesced? Either works as long as both PRs agree. Smaller and optional: the chip_id == T8152 check in display_internal_active() could compare the active config to /arm-io/dcp on any chip, with the publish staying in dt_prepare_t8152(). This also overlaps #300 in dcp.h/display.h/dt_prepare_t8152, so one of the two will need a small rebase.

apple_dcpib reads /chosen/apple,dcp-rtkit-quiesced to tell an internal
DCP the loader handed over running (adopt it) from one the loader
stopped (wake it). Without the property it adopts the DCP as running.

aura quiesces the internal DCP when its display setup fails part way:
display_start_dcp() after the framebuffer DVA lookup or the iBoot
interface fails, and dcp_init() after a step that follows the RTKit
boot (AFK, or the J873g's HDMI dptx init). The kernel then adopts a
quiesced DCP and fails ("no disp0-service"). On the J873g this happened
after the iBoot interface did not come up.

Track the internal DCP's RTKit in display.c: running once dcp_init()
succeeds, and after a failed start the result of the shutdown (stopped
when quiesced, running when it did not stop). dcp_init() now reports
whether it quiesced a DCP it had booted. On T8152 display_shutdown()
leaves the controllers running for the kernel, so nothing else changes
the state. Only the internal DCP is tracked, not DCPEXT0 while it is
swapped in for the second display. dt_prepare_t8152() publishes the
state (1 running, 0 stopped) and omits the property when aura never
started the internal DCP.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The internal DCP's hand-off state changed display_start_dcp() and
dcp_init()'s teardown, which the two harnesses copy verbatim:

- test_t8152_display_fb: stub dcp_init_left_quiesced(), take
  display_stop_failed_dcp() along, and let the dcp_shutdown() stub return
  its int. New checks: the state is 1 after a good start, stays -1 on other
  chips and after a failed second display, and a failed internal start
  reports 0 when dcp_init() quiesced the RTKit it booted and 1 when it left
  it running.
- test_legacy_table_lifetime: declare dcp_init_quiesced, which the
  verbatim out_rtkit label now sets.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The value is 1 when the internal DCP runs at the hand-off and 0 when
aura quiesced it, so a property named "quiesced" read backwards.
apple_dcpib (aurora-silicon/linux#2176) reads the new name with the
same values.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan force-pushed the thomas/t8152-dcp-handoff-state branch from a2f3d03 to e47cd4f Compare November 19, 2026 16:49
@sithglan

Copy link
Copy Markdown
Contributor Author

Renamed to apple,dcp-rtkit-running, with the same values (1 running, 0 quiesced). aurora-silicon/linux#2176 reads the new name (6f320f01c5e9), so both sides agree, and the "despite its name" comment is gone.

I picked the rename over keeping the name and flipping the value, because a mismatched pair then fails safe. If an older aura meets a newer kernel, or the other way round, the kernel just finds no property and takes its existing fallback. With a flipped value it would instead read a running DCP as quiesced. The name is new, so #2176 adds a binding for it (chosen/apple,dcp-rtkit-running.yaml). Integration's apple,dcp-rtkit-quiesced binding stays as it is: aura's T8140 path still removes that name from /chosen, and nothing publishes or reads it any more.

  • New commit e47cd4f on top, and the branch is rebased onto main 5c70a29, which has sptm_virt_s2r: clang-format two printf calls #294, so format-check passes.
  • Checked: clang build with no C warnings; make format-check with clang-format 20.1.8; test_t8152_display_fb.py, test_legacy_table_lifetime.py and the two T8140 display hand-off suites, 71 passed.
  • I left the optional display_internal_active() chip check for now.
  • The description is updated to the new name. Not re-run on the J873g; the M6 tether is off right now.

#300 is rebased onto the same main. Whichever of the two lands second needs only the small rebase in dcp.h/display.h/dt_prepare_t8152().

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