Repository navigation
drm/apple: keep the DP audio and DP PHY domains while the DCP firmware runs - #2953
RyanTheTide wants to merge 7 commits into
Conversation
A DCP that keeps its coprocessor running through a system sleep sets its wakeup path in its suspend, so genpd keeps its power domains on. The DP audio block that DCP firmware drives sits in a domain of its own, which the dp-audio device holds only while runtime-active: its late sleep callback suspends it, and genpd powers the domain off at noirq under the still running DCP firmware. On the Mac mini M2 (J473, macOS 27.2 firmware), once Linux has started the primary DCP, s2idle then hard-resets the machine almost every time (19 of 20 attempts, no log). The J473 is the M2 machine that enables the primary DCP's DP audio block; the external DCP's block, enabled on every M2, sits in a domain marked always-on. With the dp-audio device unbound, which leaves the domain held, the same kernel passes 5 of 5 sleeps in one boot; with appledrm not loaded, 4 of 4; and the production kernel, which never starts that DCP, 5 of 5. Hold the domain from the late callback when the linked DCP has set its wakeup path for this sleep, or has no driver bound (its firmware may still run, left by a boot stage or an earlier bind). Every device's .suspend has run by then, so the DCP's choice is known. The decision comes from the DCP's own sleep state and the OF graph link, not from the SoC or firmware version. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Build the real dcpaud_suspend_late() and dcpaud_pm_ops from drivers/gpu/drm/apple/audio.c against stubs and run every combination of OF graph link, DCP device, bound driver, DCP wakeup path and runtime force-suspend result. The domain is held exactly when the linked DCP is on its own wakeup path or has no driver; every reference is dropped; pm_runtime_force_suspend() runs once and its result is returned; the late sleep slots carry the new callback. Four mutations (bound-only, leak-device, leak-node, invert-wakeup) and the code before the change must fail. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at live head 16930559199091aa1f83267934a31d5ac4e1455c (CI green: host-tests).
Technical Audit
drivers/gpu/drm/apple/audio.c(dcpaud_suspend_late): Looks up the linked DCP via OF graph (port@0/endpoint@0->of_graph_get_remote_port_parent->of_find_device_by_node), setsdevice_set_wakeup_path(dev)when!device_is_bound(&dcp_pdev->dev) || device_wakeup_path(&dcp_pdev->dev), drops all node/device references, and delegates topm_runtime_force_suspend(dev).- Host test (
tools/asahi/dcpaud-sleep-hold-tests.py): Clean 128-case topology/refcount matrix with 4 mutations and old-code negative control (a7638d51880c).
Checklist Summary
- §1 No model gating: Needs cross-Mac proof (mechanism itself has no chip/board/FW gates, but per §1 the change must be proven across the other lab Macs that contain a DP audio block — see Blocker 1).
- §2 Production-ready: Pass (default cmdline, no module params, no sleeps/retries).
- §3 Safety: Pass (no hardcoded safety limits).
- §4 Clean-room & attribution: Pass. Both commits (
7e8f0dce,16930559) have human author/committer (Ryan Murray) andSigned-off-by:, zero AI trailers in commits; PR body ends withAssisted-by:. - §5 Evidence: Fail (see Blockers 1 & 2).
- §6 Naming: Pass.
Blockers
- §1 / §5 — Unverified cross-Mac & S2R impact (
device_wakeup_path()is also set when DCP stops firmware): The PR description states "no change expected where the DCP stops its firmware for the sleep or the block is already always-on." However, indrivers/gpu/drm/apple/dcp.c,dcp_s2r_suspend()(dcp.c:8850),dcp_s2r_ext_suspend()(dcp.c:8796), andiomfb_m4_suspend()(dcp.c:9802) all calldevice_set_wakeup_path(dcp->dev)even when the DCP coprocessor is stopped for sleep (onlydcp_v27_sleep_suspend()andext_deadomit it). Consequently, on Macs whose DP audio domains are notapple,always-on(e.g., M4 Props_dpa1/ps_dpa2, Neops_dpa1, M5ps_dispext0_adma),dcpaud_suspend_late()will also setwakeup_pathduring S2R/s2idle whenever those domains carryGENPD_FLAG_ACTIVE_WAKEUP. Per §1 ("Prove the change on every Mac you have that contains the block") and §5, run the pending s2idle and S2R regression rows on the other lab Macs with DP audio blocks (M2 Air, M1 Pro, M4 Pro, Neo) and either confirm holdingdpa*across S2R is benign or narrow the condition so stopped-firmware S2R paths do not hold the domain unnecessarily. - §5 — Full regression triad & unmerged stack dependency: The J473 row ran on
fleet82 + #2853 + #2868(both unmerged;#2853is still OPEN/DIRTY) and reportsEnforcing, 0 AVCwithout0 failed unitsand0 new kernel errors. Please include the full §5 regression check (0 SELinux denials, 0 failed units, 0 new kernel errors) alongside the cross-Mac rows.
Non-blocking nits
device_is_bound()locking contract (drivers/gpu/drm/apple/audio.c:2097):drivers/base/dd.c:438documents thatdevice_is_bound()must be called withdevice_lock()held, anddevice_suspend_late()does not holddevice_lock(&dcp_pdev->dev). Takingdevice_lock(&dcp_pdev->dev)around the check (or usingdevice_trylock/ checkingREAD_ONCE(dcp_pdev->dev.driver)) would satisfy the driver-core locking contract cleanly.
Assisted-by: LLM (Gemini 4 Neon)
…e runs dcpaud_suspend_late() kept the DP audio domain whenever the linked DCP was on its wakeup path. The DCP's suspend also sets that path where it stops its firmware (the S2R stops, the T8132 external stop and power gate), so on those sleeps the domain stayed on with nothing using it. Have the DCP record whether its suspend left the coprocessor running (the default hold, a retained external DCP, a running T8132 DCP) and read that from the DP audio late suspend through dcp_sleep_keeps_firmware(). A DCP without a driver still counts as running, as before. The driver data is read under the DCP's device lock. The host test now builds dcp_sleep_keeps_firmware() too and checks the lock; its mutations cover holding for a stopped DCP, inverting the flag, dropping the unbound case and skipping the lock. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
left a comment
There was a problem hiding this comment.
Independent source review at d64d9816b3de. The updated late callback uses the DCP's suspend decision instead of its wakeup bit and holds a device reference while reading driver state. Please add the final J473 row with the live DCP stack: verify dpa0 stays on in the noirq interval across short s2idle cycles and DP audio enumerates again after wake. The 13.5 Air's no-regression row exercises a different PM domain. Include the USB4 peer-drop variant once #2868 makes the route available.
… test dcpext26-suspend-route-tests builds the retained-external block of dcp_platform_suspend() against its own struct apple_dcp, which now needs the sleep_fw_runs field that block sets. Add it, and check that the flag is set together with the wakeup path and stays clear when the retained sleep is refused (firmware not running, disconnect failure). Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
Cross-Mac regression results for the v2 driver on the stock fleet85 command lines and production Stage 2. The signed
The completed rows were Enforcing with zero AVC denials, zero failed units, and no new kernel error signatures. The recurring DWC3 prepare error also appears on the stock rows. Each short cycle used a 12-second RTC wake. J473 with both firmware-27.2 DCP routes active still needs the v2 A/B on the same stack, including the dpa0 noirq power state and post-wake ALSA ELD and PipeWire availability. The USB4 peer-disconnect case also remains open. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Re-review at 19f90d0. The driver now uses a firmware-runs flag set by the DCP suspend branch, separate from the wakeup-path bit used by stopped-firmware paths. The late callback reads the bound device and its state under the device lock. The updated retained-route fixture compiles and passes its native26, H17P and rollback cases. The DP-audio matrix also passed 128/128 and held the domain in six cases. Host and KUnit checks are green at this head.
Please describe the helper as late-suspend only. Its current kernel-doc also names noirq as a valid caller, but device_lock() can sleep there. The hardware items remain a J473 combined 27.2 DCP/DP-audio row at the v2 driver revision, with the full regression checks, and the remaining shared-path rows.
|
J413 (MacBook Air M2, T8112, 13.5 stub), fleet85
Both arms logged the same pre-existing dwc3-apple Current PR head |
|
Host and arm64 QEMU regression row at
The J473 |
It takes the DCP's device lock, which can sleep, so a noirq caller must not use it. Its only caller is the DP audio late suspend. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
RyanTheTide
left a comment
There was a problem hiding this comment.
Re-reviewed 002e5071067d. The kernel-doc now restricts the helper to late suspend and explains the sleepable device lock. The cumulative delta since 19f90d0e8a3a changes that comment only. The DP-audio PM entry point remains wired to late suspend.
On the exact new source, the host matrix passed 128/128, including six domain holds, and the retained-route fixture passed its native v26, H17P, PM refusal and disconnect rollback checks. That closes my documentation finding. The J473 combined v27.2 DCP and DP-audio resume row remains open.
|
Hardware provenance for
The completed rows used the default command line, production Stage 2 and short RTC wakes. They had zero AVCs, failed units or new kernel error signatures. An earlier J316s attempt reset when its USB4 peer rebooted. The live J473 |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist re-review at verified live head 002e5071067d1c7ae3cb28dd81aff48115c06652 (CI 2/2 green: Apple DRM KUnit / kunit, Host tests / host-tests).
Prior Finding Verification
- Stopped-firmware S2R/T8132 over-holding (Prior Blocker 1) — FIXED:
dcp_platform_suspend()now tracksdcp->sleep_fw_runsseparately fromdevice_wakeup_path(), clearing it at both suspend entry (dcp.c:9773) and resume entry (dcp.c:9931), setting it only when firmware remains running (iomfb_m4when!iomfb_m4_sleep_stopped(dcp)underdcp->lock, retained external, and default hold), and leaving itfalseondcp_s2r_suspend(),dcp_s2r_ext_suspend(),dcp_v27_sleep_suspend(),ext_dead, and refused-suspend paths. - Driver-core locking & documentation (Prior Nit) — FIXED:
dcp_sleep_keeps_firmware()(dcp.c:9755-9767) readsdev->driveranddrvdataunderdevice_lock(dev)(with no AB-BA inversion sincedcp_platform_pm_opshas no.suspend_late) and documents late-suspend-only calling context (002e5071067d). - Cross-Mac non-regression (Prior Blocker 1) — FIXED: fleet85 A/B rows on J413 (3/3 s2idle), J700 (5/5 s2idle, 3/3 deep), J316s (4/4 s2idle with USB4 peer quiet), and J616s (3/3 s2idle) are complete with Enforcing / 0 AVC / 0 failed units / 0 new kernel errors.
- Refcounting & PM lifecycle audit:
dcpaud_suspend_late()(audio.c:2085-2105) balances all OF node andplatform_devicereferences, delegates topm_runtime_force_suspend(dev), anddevice_prepare()resetsdev->power.wakeup_pathat the start of every sleep cycle. Host tests (dcpaud-sleep-hold-tests: 128 cases + 7 mutations + old-code negative control;dcpext26-suspend-route-tests+ 2 mutations) all pass in CI.
Checklist Summary
- §1 No model gating: Pass (uses OF graph link and DCP sleep state; cross-Mac non-regression complete).
- §2 Production-ready: Pass (no new parameters, sleeps, or hacks).
- §3 Safety: Pass (0 code/locking/refcount blockers).
- §4 Clean-room & attribution: Pass (all 5 commits carry human author/committer
Ryan Murray <ryan@aurorasilicon.org>and humanSigned-off-by:only, zero AI trailers in commits; PR body disclosure present). - §5 Evidence: Blocked — see below.
- §6 Naming: Pass.
Remaining Blocker
- §5 — Owed v2 affected-hardware row on J473 (Mac mini M2): None of the four cross-Mac non-regression Macs exercise the
dpa0active-wakeup hold path in hardware (dpa1on J413 is always-on;dpa1/dpa2on J700, J316s, and J616s lackGENPD_FLAG_ACTIVE_WAKEUP). As noted in## Still to runand your comment at002e5071067d, the target J473 row has not yet been run on the v2 driver (d64d9816b3de/002e5071067d) withdpa0noirq domain logging, post-wake DP audio enumeration, and the full §5 regression triad (SELinux Enforcing, 0 AVC denials, 0 failed units, 0 new kernel errors).
Verdict
REQUEST_CHANGES — code and CI are clean; ready to approve once the owed J473 v2 hardware row and full regression triad are posted.
Assisted-by: LLM (Gemini 4 Neon)
|
J473 (M2 mini) booted a guarded 27.2 DCP test kernel containing the exact PR head The first 12-second Apple PMU RTC freeze reset the machine at the scheduled wake. The GPU had reported a compute timeout earlier in the same boot, and one systemd unit had already failed before suspend. The reset prevented capture of the noirq transition log and post-wake DP-audio enumeration. Fleet85 came back as the saved default with This run establishes the live setup and records the reset. The isolated dpa0 hold and post-wake enumeration row with a clean regression tuple remains open. Assisted-by: LLM (Codex) |
…a sleep A DCP that keeps its coprocessor running through a sleep puts itself on the wakeup path, so genpd leaves its own domains up. The DP PHY that its firmware drives is a separate device under its own domain, and genpd powers that domain off at noirq like any other. With the firmware still running, that resets the SoC: on the M2 Mac mini (J473) with firmware 27.2, s2idle reset in the first freeze whenever a DCP driver was bound, both for the HDMI dcpext (dptx_ext_phy) and for the USB-C primary (its route's ATC PHY). Holding both PHY domains on through the sleep was enough for the sleep to pass; holding either one alone was not. Where the suspend leaves the firmware running (sleep_fw_runs), also put the provider devices of the DCP's dp-phy and of its active Type-C route's PHY on the wakeup path. A DCP that stops its firmware for the sleep leaves its PHYs to genpd as before. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Build the real dcp_phy_set_wakeup_path() and dcp_sleep_hold_phys() from dcp.c against a small driver-core model and check which PHY providers end up on the wakeup path: a dcpext's own dp-phy, a primary's Type-C route PHY, both, neither, an error pointer from the optional lookup and a PHY without a provider. Four mutations (no route PHY, no own PHY, the class device instead of the provider, no error check) must fail. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
MERGETRAIN6 source review at The affected J473 row still reset before post-wake verification. Please qualify the exact integrated driver with both PHY and audio domains kept over three short RTC wakes, both displays active, and the DP audio endpoints still present after wake. The PHY fix can be verified on the production DT without enabling audio playback. Assisted-by: LLM (Codex) |
|
MERGETRAIN6 review at Blocking in the added PHY change: PMGR providers that start off only honor a consumer wakeup-path mark if they advertise active wakeup. The J473 PHY provider nodes in the trial DT lack the explicit capability, so cold/no-sink boot followed by a late plug still needs coverage and a scoped provider fix where necessary. Please also snapshot the active route and its PHY under the fabric lock. The final J473 row should verify that both outputs relight and that DP audio endpoints remain visible after wake, with a peer regression on the same code. Assisted-by: LLM (Codex) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist re-review at verified live head c672252ba5d2569273cf90b1bc6b01fbf5ba8361 (CI: Apple DRM KUnit / kunit SUCCESS, Host tests / host-tests FAILURE).
Delta Audit (3437a5a3730e, c672252ba5d2)
dcp_phy_set_wakeup_path()/dcp_sleep_hold_phys()(drivers/gpu/drm/apple/dcp.c:9775-9788): Clean, hardware-driven mechanism putting the provider devices (phy->dev.parent) ofdcp->phyandREAD_ONCE(dcp->active_typec_route)->phyon the wakeup path only whendcp->sleep_fw_runsis true (iomfb_m4when!iomfb_m4_sleep_stopped(dcp), retained external, and default hold). Stopped-firmware paths (dcp_s2r_suspend,dcp_s2r_ext_suspend,dcp_v27_sleep_suspend,ext_dead) remain untouched.tools/asahi/dcp-sleep-phy-hold-tests.py: Good topology and mutation coverage (6 topologies, 4 mutations).- J473 hardware progress: s2idle 5/5 in one boot at
c672252b(integration/aurora 0f111a0d+#2953+#2868+#2853, default cmdline, production Stage 2f13056d9, Enforcing, 0 AVC, 0 failed units) is a great step forward.
Checklist Summary
- §1 No model gating: Code has no SoC/board/FW gate; cross-Mac hardware proof for the new PHY-hold path is still owed (Blocker 2).
- §2 Production-ready / CI: Blocked —
host-testsCI fails (Blocker 1). - §3 Safety: Pass in mechanism; pending cross-Mac verification of holding PHY provider domains across sleep.
- §4 Clean-room & attribution: Pass — all 7 commits carry human author/committer (
Ryan Murray <ryan@aurorasilicon.org>) and humanSigned-off-by:only, zero AI trailers in commits; PR body disclosure present. - §5 Evidence: Blocked — see Blocker 2.
- §6 Naming: Pass.
Blockers
- CI failure (
Host tests / host-tests):tools/asahi/dcpext26-suspend-route-tests.pyfails to compile because commit3437a5a3730eaddeddcp_sleep_hold_phys(dcp);inside thedcp_is_retained_external()suspend block extracted by that harness without declaring/stubbing it (error: call to undeclared function 'dcp_sleep_hold_phys'). Updatedcpext26-suspend-route-tests.pyto model/verifydcp_sleep_hold_phys()and get CI green. - §1 / §5 — Cross-Mac non-regression rows for the new PHY-hold commits (
3437a5a3730e) & complete J473 triad:- The four peer Mac rows (J413, J700, J316s, J616s) were run on
d64d9816b3de(DP-audio hold only) beforedcp_sleep_hold_phys()was added. Note also thatdcp->phyis acquired at probe for fixeddp-phyoutputs even when no external display is attached, so the new code is not inert on HDMI Macs without a display plugged. As listed in## Still to run, please add cross-Mac no-regression rows at the fixed head with external displays attached (e.g., J413 USB-C, M1 Pro HDMI, J616s) with full §5 regression counts. - On the J473 row at the fixed head, please also confirm
0 new kernel errorsexplicitly alongside Enforcing / 0 AVC / 0 failed units (and post-wake DP audio enumeration on the relit USB-C path).
- The four peer Mac rows (J413, J700, J316s, J616s) were run on
Assisted-by: LLM (Gemini 4 Neon)
Problem
On the Mac mini M2 (J473, macOS 27.2 system firmware), once Linux has started the primary DCP (the state linux#2853 brings up), s2idle hard-resets the machine on almost every attempt, with no log. The DCP keeps its coprocessor running through s2idle, so its own domains stay on. The DP audio block that this DCP's firmware drives sits in a separate domain (dpa0). The dp-audio device holds that domain only while it is runtime-active, so genpd powers it off at noirq under the still-running DCP firmware.
Update (DP PHY): with both J473 DCPs bound and the live 27.2 stack on today's production Stage 2, holding the DP audio domain was not enough: s2idle still reset in the first freeze in 9 of 9 one-shots, with either version of the hold and with the kernel that passed 13/13 on 11-23. Lab device trees that held selected power domains through the sleep found the second cause: the DP PHY that the running DCP firmware drives. The HDMI dcpext drives
dptx_ext_phy, and the USB-C primary drives its route's ATC PHY. Holding both PHY domains let the sleep pass; holding either one alone did not.Change
dcp_sleep_keeps_firmware()reads it under the DCP's device lock.sleep_fw_runsdecision) also puts the provider devices of its owndp-phyand of its active Type-C route's PHY on the wakeup path, so genpd keeps those domains at noirq too. A DCP that stops its firmware leaves its PHYs to genpd as before. The PHYs come from the DCP's own DT (phys,typec-routes). No SoC, board or firmware gate.The first version keyed on the DCP's wakeup path. The S2R and T8132-stop paths set that path too after stopping the firmware, so it would also have held the domain on sleeps where nothing uses it. The second commit narrows this.
Testing
J473 at this head (
c672252b). Kernel =integration/aurora0f111a0d+ this PR + #2868 + #2853. Default command line, production Stage 2 and DTB (aura mainf13056d9), both monitors on apple-drm (HDMI 1080p180, USB-C 1440p144). Result: s2idle 5/5 in one boot (suspend_stats success 5, fail 0), Enforcing, 0 AVC, 0 failed units. The same kernel without the PHY hold reset on the first freeze every time.J473 split rows with lab aura-try DTBs that set
apple,always-onon chosen domains:dptx_ext_phy,atc0_usb,atc1_usb,sio_cpu,sio_adma,dpa0dptx_ext_phy,atc0_usb,atc1_usbdptx_ext_phyonlyatc0_usb,atc1_usbonlypm_test=devicespasses.pm_test=platformsurvived the default 5 s hold once and reset once, and it reset with a 20 s hold. Disabling the CPU PD idle state still reset, which puts the fault in the noirq hold.Host test
tools/asahi/dcp-sleep-phy-hold-tests.pybuilds the realdcp_phy_set_wakeup_path()anddcp_sleep_hold_phys(). It runs 6 topologies and kills 4 mutations: no route PHY, no own PHY, the class device instead of the provider, and no error-pointer check.run-host-tests --only dcp-sleep-phy5/5.J473 (first version, same decision for this s2idle path): kernel = fleet82 + linux#2853 + linux#2868, default cmdline, production Stage 2. Control without the patch: RESET on the first freeze. With the patch: 13 of 13 freezes PASS over 3 boots.
Current version on the fleet85 kernel (appledrm module only differs), default cmdline, production Stage 2, 12 s RTC wakes. Each Mac has a production control row in the same boot setup. pmgr dynamic debug records every power-domain change inside each sleep, and a kretprobe records each
dcp_sleep_keeps_firmware()result:On the Neo, M1 Pro and M4 Pro the DP audio domains were off at probe and carry no
GENPD_FLAG_ACTIVE_WAKEUP, so a requested hold changes nothing in hardware there. Their domain sequences match production exactly. On the Neo's deep sleeps the S2R stop clears the flag, so no hold is requested at all. All patch rows: SELinux enforcing, 0 AVC denials, 0 failed units, no new kernel errors (the only error lines are thedwc3-apple ... genpd_prepare returns -11lines that every production control row shows too).dcp_sleep_keeps_firmware()is documented as late-suspend only: it takes the DCP's device lock, which can sleep.tools/asahi/dcpaud-sleep-hold-tests.pynow also builds the realdcp_sleep_keeps_firmware()and checks it reads the driver data under the device lock. 128 cases; 7 mutations killed (hold for a stopped DCP, inverted flag, unbound case dropped, no lock, two reference leaks, DCP ignored) plus the old-code control.dcpext26-suspend-route-tests.pychecks that the flag is set together with the wakeup path and stays clear when the retained sleep is refused.Still to run
Evidence and mechanism detail
traces/display/20261124-m2mini-display-full(r1b..r10, README);traces/power/20261123-s2idle2-dpa(this version: per-Mac control and patch rows, PS lines, kretprobe results, triad) andtraces/power/20261123-j473-s2idle-usbc(first version: r0 genpd diff on production, r1 dp-audio unbound 5/5, f1 control, f2..f4 fix).Assisted-by: LLM (Claude:Opus 5.5)