Skip to content

drm/apple: keep what a running DCP drives through s2idle (DP audio, DP PHY, HDMI link) - #2953

Merged
RyanTheTide merged 16 commits into
integration/aurorafrom
m2mini/dpaudio-sleep-hold
Nov 24, 2026
Merged

RyanTheTide merged 16 commits into
integration/aurorafrom
m2mini/dpaudio-sleep-hold

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown

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

  • The DCP records, in its system suspend, whether the sleep leaves its coprocessor running: the default hold, a retained external DCP, or a T8132 DCP that was neither stopped nor power-gated. Every path that stops the firmware (S2R, the 27.x sleep, the T8132 external stop, the power gate) leaves the flag clear. dcp_sleep_keeps_firmware() reads it under the DCP's device lock.

  • The dp-audio late sleep callback finds its DCP through the OF graph. If that DCP keeps its firmware running, or has no driver bound (a boot stage or an earlier bind may have left the firmware running), the callback sets the dp-audio device's wakeup path, so genpd keeps the domain through noirq.

  • The decision comes from the DCP's own sleep state, not from the SoC, board or firmware version. No new parameters.

  • A DCP whose firmware keeps running through the sleep (the same sleep_fw_runs decision) also puts the provider devices of its own dp-phy and 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 suspend no longer reports a still-attached HDMI display unplugged or releases its link: only a display whose HPD reads low is released, as DPMS off does. Before, the J473's HDMI stayed dark after the first s2idle: HPD stays high through the sleep, so no edge comes, and the CRTC userspace had turned off never powered on again.

  • The PHYs to hold are read under the Type-C fabric lock, which guards every change to them (702e0c30).

  • 1274718d added apple,sleep-wakeup-path to the T8112 dptx_ext_phy, atc0_usb and atc1_usb domains, so the hold would also cover a display plugged in after a cold boot with no display. ca69a305 reverts it for now. One combined GPU+display trial boot with that DTB hung early. The same signed combined kernel booted with the earlier Stage 2 without these properties. R14 also booted with the three properties in a separate display-only kernel and Stage 2 pairing. The cold no-sink boot followed by late attachment remains a companion DT/PMGR follow-up. A domain that was off at probe still lacks GENPD_FLAG_ACTIVE_WAKEUP.

  • A display unplugged while the machine sleeps is released on resume (31ba92a7). The HPD IRQ is masked through the sleep, and on a fixed HDMI output nothing else reports the unplug. Before the IRQ is enabled again, the resume releases a kept display whose HPD now reads low, the same steps as an unplug while awake: hotplug event, DPTX link release, fabric update. An edge after that is replayed when the IRQ comes back. A failed GPIO read leaves the display connected, and a pipeline that a Type-C display owns is left alone. be351654 holds the fabric mutex across the fixed-output ownership check, the link release, and the presence update, so the fabric cannot allocate the pipeline midway through the release.

  • A T6030 native HDMI output still releases its link at suspend, attached or not. Its resume sets the converter, PHY and crossbar up again (dcp_fabric_hdmi_reinit()), and that needs the link down.

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

  • Current source head be351654: dcp.o and dcp-fabric.o compiled for arm64 with empty diagnostics. Clang ASan/UBSan passed the resume harness and rejected all six mutations, including removal of the fabric mutex. M2-COMBINE independently replayed the changed path. Hosted KUnit passed. The hardware rows below are earlier candidates.

  • M4 Pro MacBook Pro (J616s, T6040) at 31ba92a7: fleet85 with this PR's appledrm module, default command line, production Stage 2. s2idle 3/3 with 12 s RTC wakes in one boot. Enforcing, 0 AVC, 0 failed units, no kernel errors at journal priority 3. Its external ports were empty, so this is a no-regression row only.

  • Host test tools/asahi/dcp-hdmi-sleep-unplug-tests.py runs the real suspend HDMI block and dcp_hdmi_unplugged_in_sleep() over six cases: kept, unplugged during the sleep, gone before it, GPIO error, Type-C-owned pipeline and T6030 native. It also checks that the release runs before the HPD IRQ comes back. It kills 5 mutations. The Apple DCP host suites pass (53 of 53 apart from this test), Apple DRM KUnit gives 117 passed and 1 skipped, and dcp.o builds clean with W=1.

  • J473, full series at 2267280d (+ #2853 06e155e8 for the AV service): s2idle 5/5, and both monitors light again after every wake (HDMI-A-1 and DP-2 connected and enabled, both CRTCs active). No HDMI release, no RemotePort -110, no converter HPD pulse and no AV re-announce around the sleeps. Before this commit the sleeps passed, but HDMI stayed dark after the first wake.

  • J473 on the earlier c672252b display candidate. Kernel = integration/aurora 0f111a0d + this PR + #2868 + #2853. Default command line, production Stage 2 and DTB (aura main f13056d9), 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-on on chosen domains:

    domains held result
    dptx_ext_phy, atc0_usb, atc1_usb, sio_cpu, sio_adma, dpa0 PASS
    dptx_ext_phy, atc0_usb, atc1_usb PASS
    dptx_ext_phy only RESET
    atc0_usb, atc1_usb only RESET

    pm_test=devices passes. pm_test=platform survived 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.py builds the real dcp_phy_set_wakeup_path() and dcp_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-phy 5/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:

Mac sleeps (control / patch) result hold decision DP audio domains inside the sleep
MacBook Air M2 (T8112) 3 s2idle / 3 s2idle 3/3, 3/3 n/a dpa1 stays on in both
Neo (T8140) 3 s2idle + 2 deep / 5 + 3 5/5, 8/8 s2idle: hold; deep: no hold dpa1 off in every sleep, both
MacBook Pro M1 Pro (T6000) 3 s2idle / 4 s2idle 3/3, 4/4 hold x8 dpa1, dpa2 off in every sleep, both
MacBook Pro M4 Pro (T6040) 3 s2idle / 3 s2idle 3/3, 3/3 hold x6 dpa1, dpa2 off in every sleep, both

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 the dwc3-apple ... genpd_prepare returns -11 lines 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.
  • Host tests: tools/asahi/dcpaud-sleep-hold-tests.py now also builds the real dcp_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.py checks that the flag is set together with the wakeup path and stays clear when the retained sleep is refused.

Still to run

  • An s2idle row on Macs whose HDMI port has an hdmi-hpd GPIO (M1/M2 Pro/Max) with a display attached. A still-attached HDMI display now keeps its link through the sleep, the same state as DPMS off.
  • No-regression rows for the PHY hold on a Mac with an external display attached through the sleep (J413 USB-C, M1 Pro HDMI, J616s). Without an external display the DCP's own dp-phy is still held while its firmware runs.
  • An HDMI display unplugged during the sleep, and a cold boot with no display followed by a late plug and an s2idle. Both need someone at the machine to move the cable.
  • The USB4 peer link-drop-during-sleep case is a separate fault and is tracked with linux#2868's route work.
Evidence and mechanism detail
  • Evidence (lab store): J473 PHY rows 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) and traces/power/20261123-j473-s2idle-usbc (first version: r0 genpd diff on production, r1 dp-audio unbound 5/5, f1 control, f2..f4 fix).
  • genpd_finish_suspend() skips powering off a device's domain only when device_awake_path(dev) is set and the domain has GENPD_FLAG_ACTIVE_WAKEUP. pmgr-pwrstate sets that flag for domains that are on at probe (or that carry its sleep-wakeup-path property). On the J473, dpa0 is on at probe; on the Neo, M1 Pro and M4 Pro the DP audio domains are not.
  • pm_runtime_force_suspend() still runs; genpd_power_off() does nothing while the domain is prepared for system sleep, so only the noirq decision matters.
  • On the J473, dpa0 is not critical in the ADT pmgr device list (flags 0x00), while dpa1 is (0x09, already apple,always-on). So the hold belongs in the driver, not in DT.
  • Every device's .suspend has run before the late phase, so the DCP's flag is final when dp-audio reads it; the DCP's resume clears it.
  • One M1 Pro attempt with this version reset during its second s2idle at the moment the M1 Pro's USB4 peer (a lab Mac on the Thunderbolt cable) rebooted. That matches a separate USB4 peer link-drop-during-sleep fault seen on other lab Macs, and it is independent of this change: the M1 Pro's domains behave as in production with the patch. The repeat with the peer quiet passed 4/4.

Assisted-by: LLM (Claude:Opus 5.5), LLM (OpenAI:Codex)

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

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), sets device_set_wakeup_path(dev) when !device_is_bound(&dcp_pdev->dev) || device_wakeup_path(&dcp_pdev->dev), drops all node/device references, and delegates to pm_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) and Signed-off-by:, zero AI trailers in commits; PR body ends with Assisted-by:.
  • §5 Evidence: Fail (see Blockers 1 & 2).
  • §6 Naming: Pass.

Blockers

  1. §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, in drivers/gpu/drm/apple/dcp.c, dcp_s2r_suspend() (dcp.c:8850), dcp_s2r_ext_suspend() (dcp.c:8796), and iomfb_m4_suspend() (dcp.c:9802) all call device_set_wakeup_path(dcp->dev) even when the DCP coprocessor is stopped for sleep (only dcp_v27_sleep_suspend() and ext_dead omit it). Consequently, on Macs whose DP audio domains are not apple,always-on (e.g., M4 Pro ps_dpa1/ps_dpa2, Neo ps_dpa1, M5 ps_dispext0_adma), dcpaud_suspend_late() will also set wakeup_path during S2R/s2idle whenever those domains carry GENPD_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 holding dpa* across S2R is benign or narrow the condition so stopped-firmware S2R paths do not hold the domain unnecessarily.
  2. §5 — Full regression triad & unmerged stack dependency: The J473 row ran on fleet82 + #2853 + #2868 (both unmerged; #2853 is still OPEN/DIRTY) and reports Enforcing, 0 AVC without 0 failed units and 0 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

  1. device_is_bound() locking contract (drivers/gpu/drm/apple/audio.c:2097): drivers/base/dd.c:438 documents that device_is_bound() must be called with device_lock() held, and device_suspend_late() does not hold device_lock(&dcp_pdev->dev). Taking device_lock(&dcp_pdev->dev) around the check (or using device_trylock / checking READ_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 RyanTheTide left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Author

Cross-Mac regression results for the v2 driver on the stock fleet85 command lines and production Stage 2. The signed appledrm build used fleet85 (2ad96595b154) plus the driver changes through d64d9816b3de. The current head 19f90d0e8a3a changes only the retained-sleep host fixture. Both host-tests and KUnit are green at that head.

Mac Stock fleet85 Fleet85 + v2 DP audio power-domain observation
M2 Air (J413) 3/3 s2idle 3/3 s2idle dpa1 stayed on in both.
Neo (J700) 3/3 s2idle, 2/2 deep 5/5 s2idle, 3/3 deep across two boots dpa1 cycled in both. v2 reported firmware running on both instrumented s2idle cycles and stopped on the instrumented deep cycle.
M1 Pro (T6000) 3/3 s2idle 4/4 s2idle with the USB4 peer quiet dpa1/dpa2 cycled in both. An earlier v2 run passed cycle 1 and reset during cycle 2, concurrent with the USB4 peer reboot.
M4 Pro (J616s) 3/3 s2idle 3/3 s2idle v2 reported firmware running on all six decisions. dpa1/dpa2 cycled as on stock.

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 RyanTheTide left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

@RyanTheTide

Copy link
Copy Markdown
Author

J413 (MacBook Air M2, T8112, 13.5 stub), fleet85 2ad96595b154, production cmdline and Stage 2, 12-second PMU RTC alarms.

Arm s2idle DP audio domains Enforcing / AVC / failed units / new kernel errors
Stock fleet85 3/3 dpa0 cycled, dpa1 stayed on Yes / 0 / 0 / 0
Fleet85 + v2 appledrm module, d64d9816b3de 3/3 dpa0 cycled, dpa1 stayed on Yes / 0 / 0 / 0

Both arms logged the same pre-existing dwc3-apple genpd_prepare returns -11 once per cycle. All three module wakes came from PMU RTC IRQ 70. Normal device resume on the module was 847, 857 and 848 ms. The separate stock fleet85 promotion gate measured 850 and 843 ms with the external display attached. J413 offers s2idle only. Production fleet85 was restored and verified after the module trial.

Current PR head 19f90d0e8a3a differs from the tested head only in tools/asahi/dcpext26-suspend-route-tests.py. Both heads have the same driver code. The active-external-DCP audio domain stays on in both Air arms. The live primary-DCP dpa0 case still needs the J473 row.

@RyanTheTide

RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Author

Host and arm64 QEMU regression row at 19f90d0e8a3a1dffc753589b17f06ca2430a2baa.

  • dcpaud-sleep-hold-tests.py passed 128/128 late-suspend cases under ASan and UBSan. Six cases held the domain. The matrix detected all seven mutations, including the missing device lock and leaked OF or device references.
  • The repaired dcpext26-suspend-route-tests.py passed and detected both route mutations. Its assertions cover retained firmware, H17P park/unpark, native route retention and disconnect rollback.
  • A test-only overlay linked apple-dcp-audio-sleep into appledrm.ko. It passed after loading the module on arm64 QEMU with fleet85. The case checks an unbound DCP, a bound DCP without driver data, a stopped DCP with the wakeup-path bit set, and a DCP that kept its firmware running.

The J473 dpa0 noirq and after-resume hardware rows remain open.

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 RyanTheTide left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

@RyanTheTide

Copy link
Copy Markdown
Author

Hardware provenance for 002e5071067d1c7ae3cb28dd81aff48115c06652. The signed appledrm module used for the fleet85 A/B was built with d64d9816b3de. The two later commits update the retained-sleep host fixture and document that dcp_sleep_keeps_firmware() may sleep and is called from late suspend. The driver statements and data declarations are unchanged.

Mac Stock fleet85 Fleet85 + v2
J413 3/3 s2idle 3/3 s2idle
J700 3/3 s2idle, 2/2 deep 5/5 s2idle, 3/3 deep
J316s 3/3 s2idle 4/4 s2idle with the USB4 peer quiet
J616s 3/3 s2idle 3/3 s2idle

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 dpa0 noirq and post-resume DP audio checks remain open.

Four-Mac observations and J413 timings.

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

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 tracks dcp->sleep_fw_runs separately from device_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_m4 when !iomfb_m4_sleep_stopped(dcp) under dcp->lock, retained external, and default hold), and leaving it false on dcp_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) reads dev->driver and drvdata under device_lock(dev) (with no AB-BA inversion since dcp_platform_pm_ops has 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 and platform_device references, delegates to pm_runtime_force_suspend(dev), and device_prepare() resets dev->power.wakeup_path at 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 human Signed-off-by: only, zero AI trailers in commits; PR body disclosure present).
  • §5 Evidence: Blocked — see below.
  • §6 Naming: Pass.

Remaining Blocker

  1. §5 — Owed v2 affected-hardware row on J473 (Mac mini M2): None of the four cross-Mac non-regression Macs exercise the dpa0 active-wakeup hold path in hardware (dpa1 on J413 is always-on; dpa1/dpa2 on J700, J316s, and J616s lack GENPD_FLAG_ACTIVE_WAKEUP). As noted in ## Still to run and your comment at 002e5071067d, the target J473 row has not yet been run on the v2 driver (d64d9816b3de / 002e5071067d) with dpa0 noirq 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)

@RyanTheTide

Copy link
Copy Markdown
Author

J473 (M2 mini) booted a guarded 27.2 DCP test kernel containing the exact PR head 002e5071067d1c7ae3cb28dd81aff48115c06652 and the changes from #2853 and #2868. The Linux command line was the production default. With the DCP handoff enabled, both DCPs and both ALSA DP-audio controllers bound, and dpa0 and dpa1 were on before suspend.

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 next_entry empty, Enforcing and zero failed units.

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

Copy link
Copy Markdown
Author

MERGETRAIN6 source review at 002e5071067d. Blocking: none in this diff. The late audio callback uses the DCP's actual suspend outcome, holds the device reference while reading it, and leaves the stopped-firmware case to normal PM. The four peer results cover that side of the change.

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)

@RyanTheTide RyanTheTide changed the title drm/apple: audio: keep the DP audio domain while its DCP firmware runs drm/apple: keep the DP audio and DP PHY domains while the DCP firmware runs Nov 24, 2026
@RyanTheTide

Copy link
Copy Markdown
Author

MERGETRAIN6 review at c672252ba5d2. The J473 R10 module with the PHY hold returned from 5/5 RTC sleeps on the production Stage 2 and DT. HDMI still stayed dark after resume, with its connector connected and CRTC off.

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

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) of dcp->phy and READ_ONCE(dcp->active_typec_route)->phy on the wakeup path only when dcp->sleep_fw_runs is true (iomfb_m4 when !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 2 f13056d9, 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-tests CI 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 human Signed-off-by: only, zero AI trailers in commits; PR body disclosure present.
  • §5 Evidence: Blocked — see Blocker 2.
  • §6 Naming: Pass.

Blockers

  1. CI failure (Host tests / host-tests): tools/asahi/dcpext26-suspend-route-tests.py fails to compile because commit 3437a5a3730e added dcp_sleep_hold_phys(dcp); inside the dcp_is_retained_external() suspend block extracted by that harness without declaring/stubbing it (error: call to undeclared function 'dcp_sleep_hold_phys'). Update dcpext26-suspend-route-tests.py to model/verify dcp_sleep_hold_phys() and get CI green.
  2. §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) before dcp_sleep_hold_phys() was added. Note also that dcp->phy is acquired at probe for fixed dp-phy outputs 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 errors explicitly alongside Enforcing / 0 AVC / 0 failed units (and post-wake DP audio enumeration on the relit USB-C path).

Assisted-by: LLM (Gemini 4 Neon)

The system suspend of a DCP whose firmware keeps running reported its
fixed HDMI output unplugged and released its link on every sleep, since
0b1c93b ("drm: apple: dptx: Issue HPD event early on gpio/type-c
disconnect"), also with the display still attached. After the wake nothing
connects it again: HPD stayed high through the sleep, so no edge comes, and
the CRTC that userspace turned off for the unplug never runs dcp_poweron().
On the M2 Mac mini (firmware 27.2) the release also timed out (RemotePort
call 7, -110) and the converter pulsed HPD after the relink, and HDMI stayed
dark after the first s2idle.

Release it only when its HPD reads low, as DPMS off does (dcp_poweroff()).
A display that stays attached keeps its link through the sleep, as through
DPMS off, and resume lights it again through dcp_poweron(). A display that
is unplugged during the sleep is still reported and released as when awake.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide RyanTheTide changed the title drm/apple: keep the DP audio and DP PHY domains while the DCP firmware runs drm/apple: keep what a running DCP drives through s2idle (DP audio, DP PHY, HDMI link) Nov 24, 2026
@RyanTheTide

Copy link
Copy Markdown
Author

MERGETRAIN6 re-review at 2267280d9c77. The keep-link change retains an attached fixed HDMI link only on the path where DCP firmware continues running. J473 R13 used the production Stage 2 and both outputs relit on 5/5 wakes with the stacked module.

Blocking: the previously reported cold-probe provider and route snapshot findings still apply. This head retains the lockless PHY/route lookup, and the J473 providers still lack the explicit active-wakeup property for a domain that starts off. Please carry the scoped fix and its host fixture update, then verify cold/no-sink boot and late attachment. The cross-Mac HDMI and USB-C cases on the final heads remain outstanding.

Assisted-by: LLM (Codex)

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

Formal §1–§6 pre-PR checklist re-review at verified live head 2267280d9c771a7df3b616272977b18c6a19c698 (CI: Apple DRM KUnit / kunit SUCCESS, Host tests / host-tests FAILURE — 475/478 passed).

Delta Audit (c672252ba5d2...2267280d9c77)

  • Commit 2267280d9c77 (drm/apple: dcp: keep a still-attached HDMI link through a sleep): Narrowly guards the dcp_platform_suspend() HDMI disconnect (drivers/gpu/drm/apple/dcp.c:9943-9947) with gpiod_get_value_cansleep(dcp->hdmi_hpd) <= 0. Good hardware progress on J473 (both HDMI-A-1 and DP-2 now relight across 5/5 s2idle cycles with no RemotePort -110 timeout), and dcp->hdmi_hpd_irq != 0 guarantees dcp->hdmi_hpd != NULL (dcp.c:7598-7610, 7052-7053). However, keeping the HDMI link across sleep introduces two correctness issues on resume/unplug (Blockers 2 & 3 below), and neither blocker from #6033495066 nor the MERGETRAIN6 findings were cleared.

Checklist Summary

  • §1 No model gating: Code has no SoC/board/FW gate; cross-Mac hardware proof for both PHY-hold (3437a5a3730e) and HDMI keep-link (2267280d9c77) is still owed (Blocker 6).
  • §2 Production-ready / CI: Blocked — host-tests CI still fails (Blocker 1); code/locking/resume bugs (Blockers 2–5).
  • §3 Safety: Blocked — cold/no-sink boot PMGR GENPD_FLAG_ACTIVE_WAKEUP gap (Blocker 5) and T6030 external_native resume teardown under an active HDMI link (Blocker 3).
  • §4 Clean-room & attribution: Pass — all 8 commits (7e8f0dce76e8..2267280d9c77) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, zero AI trailers in commits; PR body disclosure present.
  • §5 Evidence: Blocked — see Blocker 6.
  • §6 Naming: Pass.

Blockers

  1. CI failure (Host tests / host-tests, still open from #6033495066): tools/asahi/dcpext26-suspend-route-tests.py (all 3 runs: default, --native-parks, --drop-h17p-park) still fails to compile with error: call to undeclared function 'dcp_sleep_hold_phys' because 3437a5a3730e added dcp_sleep_hold_phys(dcp); inside the dcp_is_retained_external() block extracted by that test. Update dcpext26-suspend-route-tests.py to model/verify dcp_sleep_hold_phys() and get CI green.
  2. §1 / Correctness — HDMI unplug during sleep leaves stale connected state (2267280d9c77): dcp_platform_suspend() calls disable_irq(dcp->hdmi_hpd_irq), which writes REG_GPIOx_IN_IRQ_OFF (drivers/pinctrl/pinctrl-apple-gpio.c:323-324), so a falling HPD edge while asleep is not latched. On resume, dcp_platform_resume() runs dcp_fabric_run_resume(&dcp_resume_ops, dcp) -> enable_irq() + dcp_fabric_hdmi_resume(), which is a no-op on non-hybrid fixed HDMI DCPs (dcp_hdmi_settle_enabled() requires nr_typec_routes > 0, dcp-fabric-effects.h:15) and on hybrids only updates hdmi_presence without calling disconnected_hpd_event() / dcp_dptx_disconnect(). Then dcp_poweron() (dcp.c:5201-5208) only connects when connected is true and never disconnects when connected is false. Consequently, an HDMI display unplugged during s2idle remains stuck connected in DRM and DCP (contradicting the commit message claim "A display that is unplugged during the sleep is still reported and released as when awake"). After re-enabling hdmi_hpd_irq in dcp_platform_resume(), sample dcp->hdmi_hpd when !dcp->active_typec_route and, if low, call disconnected_hpd_event(dcp->connector) and dcp_dptx_disconnect(dcp, 0) (and update fabric state on hybrids).
  3. §1 / §3 — T6030 external_native HDMI resume tears down PHY & crossbar underneath a kept link (dcp.c:10007-10008, dcp-fabric.c:1343-1379): dcp->external_native reaches dcp.c:9931, so 2267280d9c77 now keeps its HDMI link connected across sleep. Yet dcp_platform_resume() still unconditionally calls dcp_fabric_hdmi_reinit(dcp, "after system sleep"), which documents "No HDMI link is up when this runs" and cycles typec_mux_set(SAFE -> DP_STATE_C) plus mux_control_deselect(dcp->fixed_xbar) / dcp_fixed_output_select() underneath the active DPTX link. Either keep disconnecting on external_native or guard dcp_fabric_hdmi_reinit() so it does not tear down an active kept HDMI link.
  4. Locking & PR-body accuracy in dcp_sleep_hold_phys() (dcp.c:9781-9788, concurring with MERGETRAIN6): dcp->phy and dcp->active_typec_route are mutated under dcp_typec_fabric_lock (dcp-fabric.c:714,751,862,911,924,936,5181). dcp_sleep_hold_phys() reads dcp->phy without READ_ONCE and reads both fields without dcp_typec_fabric_lock, including on paths (iomfb_m4, dcp_is_ext26) where dcp_disable_typec_work() has not run. Snapshot the active PHY(s) under dcp_typec_fabric_lock (e.g., via a helper in dcp-fabric.c). Also correct the PR body note "On Macs without an external display the new code holds nothing": dcp->phy is populated at probe for both fixed dp-phy (dcp.c:7513) and Type-C routes (dcp-fabric.c:4957-4958, and parked back on typec_routes[0].phy on deactivate at dcp-fabric.c:924,938), so dcp_sleep_hold_phys() marks that provider even when no display is attached.
  5. Cold/no-sink boot PMGR GENPD_FLAG_ACTIVE_WAKEUP gap (concurring with MERGETRAIN6): apple_pmgr_ps_probe() (drivers/pmdomain/apple/pmgr-pwrstate.c:1026-1035) only sets GENPD_FLAG_ACTIVE_WAKEUP when a domain is already ON at probe or carries apple,sleep-wakeup-path. ps_dptx_ext_phy, ps_atc0_usb, ps_atc1_usb, and ps_dpa0 in arch/arm64/boot/dts/apple/t8112-pmgr.dtsi lack apple,sleep-wakeup-path, so on a cold/no-sink boot followed by a late monitor plug, device_set_wakeup_path() in dcp_sleep_hold_phys() / dcpaud_suspend_late() will be silently ignored by genpd at noirq. Carry the scoped PMGR/DT fix (or track/gate explicitly if landed in a companion DT PR per §1 chicken-and-egg) and verify cold/no-sink boot + late plug + s2idle.
  6. §1 / §5 — Exact-head hardware evidence & cross-Mac non-regression (still open from #6033495066):
    • On J473 at the final fixed head, include the complete §5 regression tuple (SELinux Enforcing, 0 AVC denials, 0 failed units, 0 new kernel errors), post-wake DP audio enumeration, HDMI unplug-during-sleep behavior, and cold/no-sink boot + late-plug s2idle.
    • Peer Mac rows (J413, J700, J316s, J616s) are still from d64d9816b3de (prior to both 3437a5a3730e and 2267280d9c77). Add exact-head cross-Mac no-regression rows with external displays attached across hdmi-hpd Macs (e.g., M1/M2 Pro/Max, and T6030 external_native if applicable) and USB-C Macs (J413, J616s) with full §5 regression tuples.

Assisted-by: LLM (Gemini 4 Neon)

The test builds dcp_platform_suspend() from dcp.c, which now also holds the
DP PHYs of a DCP whose firmware runs through the sleep. That hold has its
own test; stub it here.

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

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

Formal §1–§6 pre-PR checklist re-review at verified live head 245f899b2725ea8111f6ceb71bdd15a90fb2693f (CI at review time: Apple DRM KUnit / kunit SUCCESS, Host tests / host-tests IN_PROGRESS).

Delta Audit (2267280d9c77...245f899b2725)

  • Commit 245f899b2725 (tools/asahi: stub the DP PHY hold in the dcpext26 suspend route test): Adds static void dcp_sleep_hold_phys(struct apple_dcp *d) { (void)d; } to tools/asahi/dcpext26-suspend-route-tests.py:73-74, addressing the undeclared function 'dcp_sleep_hold_phys' compile failure from #6034135865 Blocker 1 (pending Host tests / host-tests completion to confirm green). Note (non-blocking): unlike wake_paths and sleep_fw_runs, the stub is a no-op rather than counting invocations (phy_holds), so the fixture does not assert dcp_sleep_hold_phys() is called on retained-sleep success and skipped on -EHOSTDOWN/-EBUSY refusal.
  • No driver, DT, or hardware-evidence changes landed in this push; Blockers 2–6 from #6034135865 remain open.

Checklist Summary

  • §1 No model gating: Code remains free of SoC/board/FW gates; cross-Mac hardware proof for 3437a5a3730e and 2267280d9c77 is still owed (Blocker 5 below).
  • §2 Production-ready / CI: Blocked — host-tests still IN_PROGRESS at review time (compile fix landed, awaiting green CI); code/locking/resume bugs remain open (Blockers 1–4 below).
  • §3 Safety: Blocked — T6030 external_native resume teardown underneath a kept HDMI link (Blocker 2 below) and cold/no-sink boot PMGR GENPD_FLAG_ACTIVE_WAKEUP gap (Blocker 4 below).
  • §4 Clean-room & attribution: Pass — all 9 commits (7e8f0dce76e8..245f899b2725) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, zero AI trailers in commits; PR body disclosure present.
  • §5 Evidence: Blocked — see Blocker 5 below.
  • §6 Naming: Pass.

Status of Previous Blockers (#6034135865)

  • Cleared in code (awaiting green CI): Previous Blocker 1 (tools/asahi/dcpext26-suspend-route-tests.py compile fix in 245f899b2725; confirm Host tests / host-tests finishes SUCCESS).

Remaining Blockers

  1. §1 / Correctness — HDMI unplug during s2idle leaves stale connected state (previous Blocker 2, unchanged): dcp_platform_suspend() (drivers/gpu/drm/apple/dcp.c:9932,9943-9947) masks dcp->hdmi_hpd_irq (REG_GPIOx_IN_IRQ_OFF) and only disconnects if HPD is already low at suspend. On resume, dcp_platform_resume() (dcp.c:10010-10011) calls dcp_fabric_run_resume(&dcp_resume_ops, dcp) -> dcp_fabric_hdmi_resume() (drivers/gpu/drm/apple/dcp-fabric.c:1329-1335), which is a no-op on non-hybrid fixed HDMI DCPs (dcp_hdmi_settle_enabled() requires nr_typec_routes > 0) and on hybrids does not invoke disconnected_hpd_event() / dcp_dptx_disconnect(). dcp_poweron() (dcp.c:5201-5208) only calls dcp_dptx_connect() when connected is true and never disconnects when false. Unplugging HDMI during s2idle therefore leaves DRM/DCP stuck connected. After re-enabling hdmi_hpd_irq in dcp_platform_resume(), sample dcp->hdmi_hpd when !dcp->active_typec_route and, if low, call disconnected_hpd_event(dcp->connector) and dcp_dptx_disconnect(dcp, 0) (and update hybrid fabric state as needed).
  2. §1 / §3 — T6030 external_native HDMI resume tears down PHY & crossbar underneath a kept link (previous Blocker 3, unchanged): dcp->external_native reaches dcp.c:9931 and now keeps its HDMI link across sleep, but dcp_platform_resume() (dcp.c:10007-10008) still unconditionally calls dcp_fabric_hdmi_reinit(dcp, "after system sleep") (dcp-fabric.c:1343-1379, which documents "No HDMI link is up when this runs" and cycles typec_mux_set(SAFE -> DP_STATE_C) plus mux_control_deselect(dcp->fixed_xbar) / dcp_fixed_output_select()). Either keep disconnecting on external_native or guard dcp_fabric_hdmi_reinit() so it does not tear down an active kept HDMI link.
  3. Locking & PR-body accuracy in dcp_sleep_hold_phys() (previous Blocker 4, unchanged): dcp_sleep_hold_phys() (dcp.c:9781-9788) still reads dcp->phy without READ_ONCE and reads both dcp->phy and dcp->active_typec_route without dcp_typec_fabric_lock (the lock guarding mutations in dcp-fabric.c:714,751,862,911,924,936,4958,5181), including on iomfb_m4 (dcp.c:9853) and dcp_is_ext26 (dcp.c:9910) paths where dcp_disable_typec_work() has not run. Snapshot the active PHY(s) under dcp_typec_fabric_lock. Also correct the PR body note "On Macs without an external display the new code holds nothing", since dcp->phy is populated at probe (and parked on typec_routes[0].phy on deactivate).
  4. Cold/no-sink boot PMGR GENPD_FLAG_ACTIVE_WAKEUP gap (previous Blocker 5, unchanged): apple_pmgr_ps_probe() (drivers/pmdomain/apple/pmgr-pwrstate.c:1026-1035) only sets GENPD_FLAG_ACTIVE_WAKEUP when a domain is ON at probe or carries apple,sleep-wakeup-path. ps_dpa0, ps_dptx_ext_phy, ps_atc0_usb, and ps_atc1_usb in arch/arm64/boot/dts/apple/t8112-pmgr.dtsi (:443-450, :712-718, :1285-1301) still lack apple,sleep-wakeup-path, so on a cold/no-sink boot followed by a late monitor plug, device_set_wakeup_path() in dcp_sleep_hold_phys() / dcpaud_suspend_late() will be ignored by genpd at noirq. Carry the scoped DT/PMGR fix (or explicitly gate/track per §1 chicken-and-egg) and verify cold/no-sink boot + late plug + s2idle.
  5. §1 / §5 — Exact-head hardware evidence & cross-Mac non-regression (previous Blocker 6, unchanged):
    • At the final fixed head on J473, provide the complete §5 regression tuple (SELinux Enforcing, 0 AVC denials, 0 failed units, 0 new kernel errors), post-wake DP audio enumeration, HDMI unplug-during-sleep verification, and cold/no-sink boot + late-plug s2idle.
    • Peer Mac rows (J413, J700, J316s, J616s) are still from d64d9816b3de (prior to 3437a5a3730e and 2267280d9c77). Add exact-head cross-Mac no-regression rows with external displays attached across hdmi-hpd Macs (M1/M2 Pro/Max, plus T6030 external_native if applicable) and USB-C Macs (J413, J616s) with full §5 regression tuples.

Assisted-by: LLM (Gemini 4 Neon)

Read the selected Type-C route and the PHY pointers together while the display fabric holds its route lock. Mark those provider devices before a route handoff can change the selected PHY. The host fixture checks that the provider is marked under the same lock.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Describe active wakeup for the external DPTX and two ATC USB domains. A domain that is off at PMGR probe can be powered by a later display attachment. The property lets genpd honor a subsequent consumer wakeup-path mark while the DCP keeps running through suspend.

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

Copy link
Copy Markdown
Author

The cold-attach and route cases are addressed at 1274718dc5fd. The driver marks the fixed and borrowed PHY providers under the fabric lock. The DT describes active wakeup for the DPTX and both ATC providers even when they are off at probe. The provider still needs a consumer wakeup-path mark to stay powered through suspend.

The arm64 W=1 objects built, the PHY and suspend fixtures passed 5/5 and 3/3, and the J473, J413 and J413 firmware-27 DTBs compiled with all three properties present. R13 remains the prior both-monitor result. The next hardware row needs the updated DT and module, a cold/no-sink boot with late attach, and both monitors returning from short RTC wakes, with shared regressions on the named peer Macs.

Assisted-by: LLM (Codex)

A DCP whose firmware runs through a sleep keeps an attached HDMI
display's link, so the display lights again on wake. Its HPD IRQ is
masked through the sleep, and on a fixed HDMI output nothing else sees
an unplug made then: the connector stayed connected after the wake.

On resume, before the HPD IRQ is enabled again, release a display whose
HPD now reads low, as an unplug while awake is: report the hotplug,
release the DPTX link and tell the fabric. An edge from then on is
replayed when the IRQ comes back. A failed GPIO read cannot establish
absence and leaves the display connected; a pipeline a Type-C display
owns is not touched.

A T6030 native HDMI output still releases its link at suspend, attached
or not: its resume sets the converter, PHY and crossbar up again
(dcp_fabric_hdmi_reinit()), which needs the link down.

tools/asahi/dcp-hdmi-sleep-unplug-tests.py runs the real suspend HDMI
block and the resume release over kept, unplugged-in-sleep, gone-before,
GPIO error, borrowed and T6030 native cases, and checks the release runs
before the IRQ comes back; five mutations are killed.

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

Copy link
Copy Markdown
Author

Review of the HDMI resume change at 31ba92a7d68c. The extracted fixture passed independently. It exercises fixed HDMI release and an already borrowed route separately.

The new resume path still needs to serialize its fixed-output release against route reassignment. dcp_hdmi_unplugged_in_sleep() checks active_typec_route and clears connector->connected before releasing DPTX port 0. Only the later dcp_fabric_hdmi_unplugged() call takes the fabric mutex. Clearing the fixed connector's connected bit changes whether dcp_typec_route_fixed_output_busy() considers the pipeline available. Under the fabric mutex, another Type-C or tunnel assignment can repoint the shared connector and use that same DPTX port. The mutex in dcp_dptx_disconnect() serializes the link RPC without preserving the earlier route decision.

Please keep the ownership check, disconnect and presence update in one fabric critical section using the existing fabric-to-HPD lock order, or identify the existing PM fence that excludes both route entry points until this release returns. This is a source review finding. The exact J473 wake and peer rows are still pending.

Assisted-by: LLM (Codex)

The J473 combined kernel stalled before journald with the newly composed
Stage 2 and reached userspace with the earlier Stage 2 on the same kernel.
The compiled device trees differ by the three wakeup properties added by
1274718. Remove those properties while the handoff is investigated.

The J473 and J413 device trees compile, and the combined J473 firmware-27
DTB built after this revert is byte-identical to the booted reference.

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

Copy link
Copy Markdown
Author

The T8112 wakeup properties are reverted at ca69a305525d. The J473 stalled before journald with the combined kernel adec412c0223 and Stage 2 5a6fcfc699e6. The same signed kernel reached userspace with Stage 2 735f11c86f88, and both outputs and the GPU came up. The two embedded DTBs differ by the three properties from 1274718dc5fd.

Four J473/J413 device trees compiled. On the exact combined source, restoring the prior provider properties produced the same firmware-27 J473 DTB SHA-256 as the payload that booted, 57b467dd41c7170be992e11d835f98db907d5b44bc4aa323b1e340a502792b0c. Six PHY host cases passed. The fabric-locked PHY selection remains in this head. Cold attach and current-head display wake qualification are still open.

Assisted-by: LLM (Codex)

@RyanTheTide

Copy link
Copy Markdown
Author

Hardware rows at this head (31ba92a7):

J473 (Mac mini M2, 27.2). Kernel = integration/aurora 7946d189 + this PR + #2853 2e95be31 + #2868 612c36f4, default command line. Stage 2 = the production one (aura f13056d9, U-Boot 5445237f, byte-identical), with only the DTB replaced by this tree's t8112-j473.dtb, so 1274718d's apple,sleep-wakeup-path is live.

  • It boots normally. Both monitors come up under apple-drm at their maximum modes: HDMI 1920x1080 at 180.00 Hz, USB-C 2560x1440 at 144.00 Hz.
  • The paired modeset and DPMS relight work, and HDR PQ commits on both outputs.
  • s2idle 5/5 with 12 s RTC wakes, all in the same boot. After every wake both connectors were connected and enabled, and both CRTCs were active.
  • Enforcing, 0 AVC, 0 failed units. The new kernel error lines are the ones production fleet85 shows too (dwc3 genpd_prepare -11, brcmf LPAS).

M4 Pro MacBook Pro (J616s, T6040). fleet85 + this PR's appledrm module, default command line, production Stage 2. s2idle 3/3, Enforcing, 0 AVC, 0 failed units, 0 kernel errors at priority 3. Its external ports were empty.

Not run yet: an HDMI unplug during the sleep, and a cold boot with no display followed by a late plug. Both need someone at the machine to move a cable, and the lab has no switchable sink. The new resume release is covered by tools/asahi/dcp-hdmi-sleep-unplug-tests.py (6 cases, 5 mutations killed). A 13.x/14.x HDMI Mac with a monitor attached has been requested.

Evidence paths (lab store)
  • traces/display/20261124-m2mini-display-full/r14 (J473, row index in README)
  • traces/display/20261124-m2mini-display-full/peer-j616s-r1 (J616s)
  • Trial Stage 2 SHA-256 prefix 1af6add1 = production 57716af7 with the DTB swapped (aura and U-Boot bytes unchanged)

Takes linux#2853 (merged) and the current integration tip. The only
conflict is the host-test registry, where both sides add entries.

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

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

Formal §1–§6 pre-PR checklist re-review at exact live head 87819806b2a214c9ff19acb982fe02671004ccb8 (base: integration/aurora; follows review #6034212495 at 245f899b2725).

Resolved Since 245f899b2725

  • Previous CI compile failure: Cleared — both Apple DRM KUnit / kunit and Host tests / host-tests passed at ca69a305525d (re-running now on merge head 87819806b2a2).
  • dcp_sleep_hold_phys() locking (702e0c301cfb): Cleared — moved into drivers/gpu/drm/apple/dcp-fabric.c:5008-5019 under guard(mutex)(&dcp_typec_fabric_lock), snapshotting dcp->active_typec_route, dcp->phy, and route->phy and marking providers under the fabric lock (dcp-sleep-phy-hold-tests.py verifies lock ownership).
  • T6030 external_native HDMI resume safety (31ba92a7d68c): Cleared — dcp_platform_suspend() (drivers/gpu/drm/apple/dcp.c:9924-9929) releases dcp->external_native links at suspend so dcp_fabric_hdmi_reinit() does not tear down an active link on resume (covered by dcp-hdmi-sleep-unplug-tests.py + keep-native mutation).
  • HDMI unplug-during-sleep resume hook added (31ba92a7d68c): dcp_hdmi_unplugged_in_sleep() + tools/asahi/dcp-hdmi-sleep-unplug-tests.py (6 cases, 5 mutations) added; see Blocker 1 for a remaining lock-serialization bug.
  • Merge conflict resolved (87819806b2a2): Clean merge of integration/aurora (e1826fa80960, carrying #2853 and #2868), resolving only tools/asahi/run-host-tests.py (mergeable: MERGEABLE).
  • §4 Attribution & §6 Naming: Pass — all PR commits (7e8f0dce76e8..87819806b2a2) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, with 0 AI commit trailers; clean naming.

Remaining Blockers (REQUEST_CHANGES)

  1. Concurrency / locking race in dcp_hdmi_unplugged_in_sleep() (drivers/gpu/drm/apple/dcp.c:9950-9960, 10004-10010 — concurring with source review #7123427417): dcp_platform_resume() runs dcp_enable_typec_work(dcp) (dcp.c:10004) before dcp_hdmi_unplugged_in_sleep(dcp) (dcp.c:10010), and dcp_hdmi_unplugged_in_sleep() checks READ_ONCE(dcp->active_typec_route), clears connector->connected via disconnected_hpd_event(), and calls dcp_dptx_disconnect(dcp, 0) without holding dcp_typec_fabric_lock (only dcp_fabric_hdmi_unplugged() takes it afterward). Once disconnected_hpd_event() clears fixed_connector->connected with HPD low, dcp_typec_route_fixed_output_busy() (dcp-fabric.c:286-291) reports the pipeline free, allowing a concurrent Type-C or tunnel assignment under dcp_typec_fabric_lock to claim the pipeline and DPTX port 0 before dcp_dptx_disconnect(dcp, 0) executes. Keep the ownership check, connector disconnect, DPTX port-0 disconnect (already called under dcp_typec_fabric_lock in dcp-fabric.c:644), and fabric presence update serialized under dcp_typec_fabric_lock (and cover the lock assertion in the host fixture).
  2. Cold/no-sink boot PMGR GENPD_FLAG_ACTIVE_WAKEUP gap reopened by ca69a305525d + stale PR body: Commit ca69a305525d reverted 1274718dc5fd (apple,sleep-wakeup-path on ps_dptx_ext_phy, ps_atc0_usb, ps_atc1_usb) after J473 stalled before journald with combined Stage 2 5a6fcfc699e6 (and ps_dpa0 was still uncovered). The PR body still states "On the T8112, dptx_ext_phy, atc0_usb and atc1_usb carry apple,sleep-wakeup-path (1274718d)". Either resolve the Stage 2 stall and carry the scoped DT/PMGR fix, or update the PR body to remove the stale 1274718d claim and explicitly track the cold/no-sink boot limitation as a companion DT/PMGR follow-up per §1 chicken-and-egg.
  3. CI on 87819806b2a2: Apple DRM KUnit / kunit and Host tests / host-tests are currently IN_PROGRESS on the merge head and must finish SUCCESS.
  4. §1 / §5 Exact-head hardware & cross-Mac non-regression evidence:
    • J473 r14 (#7124720416) ran at 31ba92a7 with 1274718d's DTB swapped into production Stage 2 (prior to ca69a305525d's DT revert and 87819806b2a2) and still omits post-wake DP audio enumeration; post the exact-head J473 wake row on the reverted/final DT + lock-fixed head (with post-wake DP audio enumeration and full 0/0/0 regression tuple).
    • Cross-Mac non-regression with external displays attached remains open (peer-j616s-r1 had empty external ports; attached-display rows on hdmi-hpd Macs such as M1/M2 Pro/Max and USB-C Macs such as J413/J616s are still pending).

Assisted-by: LLM (Gemini 4 Neon)

The resume path checks the fixed HDMI connector before releasing the
link, then acquires the fabric mutex to update connector presence. A
competing Type-C route selection can claim the DPTX port in that gap.
Hold the fabric mutex across the ownership check, port release and
presence update. Keep the established fabric-to-HPD lock order.

The extracted fixture verifies that resume holds the fabric guard while
releasing the link. Both arm64 DCP objects build and all six fixture
mutations are rejected.

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

Copy link
Copy Markdown
Author

The resume ownership finding is fixed at be351654938d. The fixed HDMI check, DPTX link release and fabric presence update now run under the same fabric mutex. The release uses the existing fabric-to-HPD lock order. The attached, removed, already borrowed and unreadable-HPD cases pass, and the fixture rejects releasing the port without the fabric guard.

Both arm64 DCP objects compiled with empty diagnostics. The ASan/UBSan fixture passed and rejected all six mutations. The current-head hardware request includes the normal paired-display wake and the shared output case. Prior source finding

Assisted-by: LLM (Codex)

@RyanTheTide

Copy link
Copy Markdown
Author

Changed-head hardware row at be351654, J473 (Mac mini M2, 27.2): the signed m2combo8 kernel (integration/aurora with the merged G14 27.2 GPU stack + this PR at be351654), its Stage 2, default command line.

  • Both monitors run under apple-drm at their maximum modes: HDMI 1920x1080 at 180.00 Hz and USB-C 2560x1440 at 144.00 Hz. The paired modeset and DPMS relight work, and HDR PQ commits on both.
  • s2idle 5/5 in one boot (success 5, fail 0). After the wakes both connectors were connected and enabled, and both CRTCs were active. SSH dropped once during the loop, which is the J473's known Ethernet gap after a freeze. The boot ID did not change.
  • The GPU renders on G14G in the same boot: OpenGL Apple M2 (G14G B0), Vulkan driver Borealis.
  • Enforcing, 0 AVC, 0 failed units. The kernel error lines are the same set as the display-only row without the GPU stack.

Not run: an HDMI unplug during the sleep. It needs someone at the machine.

@RyanTheTide
RyanTheTide merged commit 04e94d2 into integration/aurora Nov 24, 2026
2 checks passed
RyanTheTide added a commit that referenced this pull request Nov 24, 2026
Takes linux#2853, #2868 and #2953. The only conflict is the host-test
registry, where both sides add entries.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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