Repository navigation
drm/apple: dcp: hold fw27 idle-off until the DP audio DMA has suspended - #4256
m0d16l14n1 wants to merge 1 commit into
Conversation
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>
|
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 |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
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()takesext_idle_lockbefore the new check, and the check runs before the hpd block, the drain anddcp_s2r_ext_domains_off(). A deferral therefore changes no Type-C or firmware state. It re-arms throughmod_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_nodeanddcp_s2r_find_dartresult is put on all paths, including the earlybreak(which putsep). The new host test checks this balance, and itsleak-epmutation is killed. - No chip or board gate: the only users are DTs whose external DCP graph links to an
apple,dpaudionode. In this tree the T8142 display ADMAC nodes arestatus = "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=nor a probe failure) now keeps the external DCP powered and re-arms the worker everyDCP_EXT_IDLE_OFF_DELAY_MSindefinitely. A one-timedev_infothe first time it defers on an unbound device would make that state visible in a row, instead of onlydev_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.
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-admacandapple-dartare bound and runtime-suspended, anddispext0_admais 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 remoteapple,dpaudionode, then followsdmasto the ADMAC and the ADMAC'siommusto its DART. No chip or board gate: the DT decides.dcp_audio_dma_get(), which waits forext_idle_lockand 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.pycompiles 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. Mutationsskip-dart,skip-admac,skip-boundandleak-epare 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):The faulting address (
x0/x21=0x506181000) is insideiommu@506180000, the DART behind the display ADMACadmac_dispext0(dma-controller@506140000,iommus = <&dispext0_isoc_dart 30>), which the dpaudio node uses throughdmas. 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):Host tests at the head SHA: