Skip to content

drm/apple: dcp: hold fw27 idle-off until the DP audio DMA has suspended - #4256

Open
m0d16l14n1 wants to merge 1 commit into
aurora-silicon:mainfrom
m0d16l14n1:fix/dcp-ext-idle-audio-dma
Open

m0d16l14n1 wants to merge 1 commit into
aurora-silicon:mainfrom
m0d16l14n1:fix/dcp-ext-idle-audio-dma

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What: the firmware-27 idle power-off of an external DCP now waits until the DP audio ADMAC and its DART are bound and runtime-suspended before it cuts the display island. Cutting the island while they were active made the DART's later runtime suspend read a powered-off block, and the SError panicked every boot on a J815.
Tested: J815 (MacBook Air 15" M5), this commit on main 59c55677a7a8 + the J815 carry, with the dpaudio, ADMAC and DART nodes enabled and no external display: 2 boots in a row without the panic (the same tree without the fix panicked at 8.66 s on 3 boots in a row). In both, apple-admac and apple-dart are bound and runtime-suspended, and dispext0_adma is off in genpd. 0 SELinux denials, 0 failed units, 0 SError/Oops/BUG. Host tests 81/81 (dcp- set).
Risk: two-way door · Macs whose external DCP uses fw27 idle-off (T8142 dcpext today; T8122 has no_ext_idle). If the ADMAC driver never binds, the external DCP stays powered instead of idling off.
Not yet: DP audio playback on a connected USB-C display after an idle-off/wake cycle; J813/J704 rows from their owners; the system-sleep island path is unchanged.

Details

dcp_ext_idle_off_work() (from 3daae87) cuts the external display island with direct PMGR writes. Before the cut it darkens only the DCP and display DARTs. The DP audio ADMAC (apple,t8142-display-admac) and its DART live in the same island, in their own genpd domain (dispext0_adma). The ADMAC probe sets itself runtime-active with a 100 ms autosuspend, and the IOMMU device link keeps its DART active along with it. If the 5 s idle-off timer fires inside that window, or while a channel is still held, the DART's runtime suspend (apple_dart_suspend() → apple_dart_save_state()) reads registers after the cut.

The fix:

  • dcp_audio_dma_busy() walks the DCP's graph endpoints to the remote apple,dpaudio node, then follows dmas to the ADMAC and the ADMAC's iommus to its DART. No chip or board gate: the DT decides.
  • The worker defers, re-arming its own delayed work as the other defer paths do, while either device is unbound (its probe and IOMMU link would resume it after the cut) or not runtime-suspended. A disabled node has no device and is skipped.
  • The check sits before the Type-C/firmware state changes, so a deferral has no side effects. Once both devices are bound and suspended, audio DMA only starts again through dcp_audio_dma_get(), which waits for ext_idle_lock and wakes the DCP first, or on a connected link, which already blocks idle-off.

New host test tools/asahi/dcp-ext-idle-audio-dma-tests.py compiles the real helpers against a mock DT graph. It covers: no dpaudio; bound and suspended; ADMAC active; DART active; ADMAC unbound; DART unbound; disabled nodes. It checks that all node and device references are balanced, and that the check comes before the hpd block, the drain and the domain power-off. Mutations skip-dart, skip-admac, skip-bound and leak-ep are all killed.

Fixes: 3daae87 ("drm/apple: power off idle firmware-27 external display processors")

Evidence

J815, 7.3.0-aurora-j815-dev #3, panic at 8.66 s on three boots in a row (the PMU then logged a watchdog reset):

SError Interrupt on CPU7, code 0x00000000be000000 -- SError
CPU: 7 UID: 0 PID: 232 Comm: kworker/u40:7 Tainted: G S M  7.3.0-aurora-j815-dev #3 PREEMPT(full)
Tainted: [S]=CPU_OUT_OF_SPEC, [M]=MACHINE_CHECK
Hardware name: Apple MacBook Air (15-inch, M5) (DT)
Workqueue: pm pm_runtime_work
pstate: 034000c9 (Nzcv daIF +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : el1_abort+0x40/0x64
lr : el1_abort+0x24/0x64
x23: 00000000034000c9 x22: 0000000000000000 x21: 0000000506181000
x20: ffff800083fb7ab0 x19: 0000000096000410 x18: 0000000000000000
x2 : ffff800083fb7ab0 x1 : 0000000096000410 x0 : 0000000506181000
Kernel panic - not syncing: Asynchronous SError Interrupt
Call trace:
 show_stack+0x18/0x24 (C)
 __dump_stack+0x28/0x38
 dump_stack_lvl+0x24/0x6c
 dump_stack+0x18/0x24
 vpanic+0x148/0x340
 vpanic+0x0/0x340
 check_panic_on_warn+0x0/0x90
 arm64_serror_panic+0x6c/0x78
 is_valid_bugaddr+0x0/0x8
 el1h_64_error_handler+0x38/0x5c
 el1h_64_error+0x6c/0x70
 el1_abort+0x40/0x64 (P)
 el1h_64_sync_handler+0x40/0xcc
 el1h_64_sync+0x6c/0x70
 apple_dart_save_state+0x64/0x100 (P)
 pm_generic_runtime_suspend+0x28/0x3c
 genpd_runtime_suspend+0x104/0x300
 __rpm_callback+0x7c/0x470
 rpm_suspend+0x294/0x64c
 pm_runtime_work+0x8c/0xa4
 process_scheduled_works+0x1dc/0x50c
 worker_thread+0x270/0x3e0
 kthread+0xf0/0x124
 ret_from_fork+0x10/0x20
---[ end Kernel panic - not syncing: Asynchronous SError Interrupt ]---

The faulting address (x0/x21 = 0x506181000) is inside iommu@506180000, the DART behind the display ADMAC admac_dispext0 (dma-controller@506140000, iommus = <&dispext0_isoc_dart 30>), which the dpaudio node uses through dmas. With those three nodes disabled in the DT, the same kernel boots.

J815 boots with the fix (same tree, 7.3.0-aurora-j815-dev, about 1 min after boot):

boot 1: 506180000.iommu suspended drv=apple-dart active_ms=9310; 506140000.dma-controller suspended drv=apple-admac active_ms=131
boot 2: 506180000.iommu suspended drv=apple-dart active_ms=8674; 506140000.dma-controller suspended drv=apple-admac active_ms=125
/proc/device-tree/audio-controller-1/status: okay
pm_genpd_summary: dispext0_adma  off-0
card 8: USBC [Apple USB-C DisplayPort], device 0
card 9: USBC_1 [Apple USB-C DisplayPort], device 0
kernel: 0 SError/Oops/BUG; no err-level line that the boot before the fix did not have
systemctl --failed: 0; avc denied: 0

Host tests at the head SHA:

ok dcp-ext-idle-audio-dma-tests (0.2s)
ok dcp-ext-idle-audio-dma-tests --mutation skip-dart
ok dcp-ext-idle-audio-dma-tests --mutation skip-admac
ok dcp-ext-idle-audio-dma-tests --mutation skip-bound
ok dcp-ext-idle-audio-dma-tests --mutation leak-ep
81/81 passed

The firmware-27 idle power-off of an external DCP cuts the display
island with direct PMGR writes and darkens only the DCP and display
DARTs first. The DP audio ADMAC and its DART sit in the same island, in
their own genpd domain. When the cut lands while they are still active
(the ADMAC probe keeps itself active for its autosuspend delay), the
DART's later runtime suspend saves its registers from a powered-off
block. On a J815 this panicked every boot with the external DCP idle:

  SError Interrupt on CPU7, code 0x00000000be000000 -- SError
  Workqueue: pm pm_runtime_work
  pc : el1_abort+0x40/0x64
  Kernel panic - not syncing: Asynchronous SError Interrupt
  Call trace:
   el1_abort+0x40/0x64 (P)
   el1h_64_sync_handler+0x40/0xcc
   el1h_64_sync+0x6c/0x70
   apple_dart_save_state+0x64/0x100 (P)
   pm_generic_runtime_suspend+0x28/0x3c
   genpd_runtime_suspend+0x104/0x300
   __rpm_callback+0x7c/0x470
   rpm_suspend+0x294/0x64c
   pm_runtime_work+0x8c/0xa4

with x21 = 0x506181000, inside the display ADMAC's DART.

Find the ADMAC and its DART through the DCP's graph link to its dpaudio
node (dmas, iommus) and defer the idle power-off until both are bound
and runtime-suspended, so their domain has gone off through genpd and
neither touches its registers again before the island is cut. After
that the audio DMA only starts through dcp_audio_dma_get(), which wakes
the DCP under the same lock, or on a connected link, which already
blocks idle-off.

Fixes: 3daae87 ("drm/apple: power off idle firmware-27 external display processors")
Signed-off-by: Nick <nekreshen@yandex.ru>
@m0d16l14n1
m0d16l14n1 marked this pull request as ready for review December 4, 2026 01:57
@m0d16l14n1
m0d16l14n1 requested review from a team and DjDeveloperr as code owners December 4, 2026 01:57
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 4, 2026
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

Ready for review. @erikwb, this touches the fw27 idle-off from #3410: it holds the island cut until the DP audio ADMAC and its DART are bound and runtime-suspended. Could you check that it fits the wake path you had in mind for dcp_audio_dma_get()? @DjDeveloperr, thanks for taking a look as well.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Merge readiness at 83822f74: not ready yet

Check Detail
CI at head ok 8 checks passed
Review no needs one approving review from Core, Omarchy Mac or Aurora Maintainers (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 83822f74, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · Macs whose external DCP uses fw27 idle-off (T8142 dcpext today; T8122 has noextidle). If the ADMAC driver never binds, the external DCP stays powered instead of idling off.

Areas: area:display, area:gpu

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 83822f7

The fix is narrow and keyed on the DT. The fw27 external idle-off now defers while the DP audio ADMAC or its DART (found through the DCP graph endpoint, then apple,dpaudio, dmas, iommus) is unbound or not runtime-suspended. With no dpaudio link, or with disabled nodes, behaviour is unchanged. It fixes a shown SError panic (J815, 3/3 without the fix, 2/2 boots clean with it).

Checked:

  • dcp_ext_idle_off_work() takes ext_idle_lock before the new check, and the check runs before the hpd block, the drain and dcp_s2r_ext_domains_off(). A deferral therefore changes no Type-C or firmware state. It re-arms through mod_delayed_work() the same way as the existing defer paths.
  • Reference handling: every of_graph_get_remote_port_parent, of_parse_phandle, of_find_device_by_node and dcp_s2r_find_dart result is put on all paths, including the early break (which puts ep). The new host test checks this balance, and its leak-ep mutation is killed.
  • No chip or board gate: the only users are DTs whose external DCP graph links to an apple,dpaudio node. In this tree the T8142 display ADMAC nodes are status = "disabled", so main T8142 boards see no change until their DTs enable them.
  • CI at head: 4/4 green, including the new host test in run-host-tests.

Follow-ups (not blocking):

  • As the Risk line says, an enabled ADMAC node with no bound driver (e.g. CONFIG_APPLE_ADMAC=n or a probe failure) now keeps the external DCP powered and re-arms the worker every DCP_EXT_IDLE_OFF_DELAY_MS indefinitely. A one-time dev_info the first time it defers on an unbound device would make that state visible in a row, instead of only dev_dbg.
  • The system-sleep island path (dcp_s2r_ext_domains_off() from suspend) doesn't wait on the ADMAC/DART yet. The PR lists this under Not yet. The DART runtime-suspend race there deserves its own check.
  • The merge gate still needs a hardware row line at this exact head.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) area:gpu Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant