Skip to content

drm/asahi: g16: Write all four 26B123 power-up words, so the GPU survives a deep wake - #2742

Merged
DjDeveloperr merged 1 commit into
djdev/g16-272from
j713/g16-26b123-wake-power-words
Nov 22, 2026
Merged

DjDeveloperr merged 1 commit into
djdev/g16-272from
j713/g16-26b123-wake-power-words

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On the M4 Air (J713) with the macOS 27.2 GPU firmware (26B123), the GPU does not survive a deep sleep. On the first wake the firmware comes back (GPU firmware back in 691 us), and 0.3 ms later RTKit: co-processor has crashed in its power-up path, before any client has submitted work. The GPU is gone until reboot. Deep sleep itself now works on the J713 (#2692, #2721), so this is the last thing stopping it on the default.

Change

The 26B123 POWER_PERFORMANCE layout inserts four u32s at +0x9c. G16 writes only +0xa4 (the powered-up state selector). This writes +0x9c, +0xa0 and +0xa8 = 1 as well, as this driver did before the 26B123 layout was reworked (923d1ec). They are power-state enables (1), not limits or tuning values. The code comment says they are written as a group because the warm restart needs all four. The words belong to the 26B123 layout, which the firmware ABI selects; 25G83 is unchanged. No gates, no parameters.

Stacked on #2676 (djdev/g16-272 at ed41e08), so it can be folded into it.

Testing

J713, default kernel command line, external MSI monitor on USB-C and the USB4 peer attached, rtcwake -m mem on the PMU RTC:

  • Without the change (integration tip + J713 PR heads, "t5"): the first deep wake crashes the GPU firmware, every time it was run.
  • With only these three words added to that same kernel: 3/3 deep sleeps wake with the GPU alive. vkmark ran across the first sleep and finished (3111). dEQP-VK smoke 3/3 and glmark2 3303 after the wakes, no firmware crash.
  • An earlier run that also restored four GLOBALS words (0x38, 0x9dc, 0xe0c, 0x7f0) passed the same way. The split shows that only the POWER_PERFORMANCE words are needed.
  • The host suite (make cpu) passes, including the 26B123 offset oracle, which now expects the three words.

Still to run

  • The J713 promotion gate (deep x10 with the GPU used after each wake, s2idle x3, warm x3) on the next default build that carries this.
Logs and kernels
  • Crash without the change: GPU stop at the commit: idle 0 0, PMP request 0, domain 0xf002800 (-110) -> GPU firmware back in 691 us -> RTKit: co-processor has crashed, the known 26B123 power-up crash PC. After the first wake every later wake prints only back in 43 us and the device is wedged.
  • The older drm/asahi: g16: run the M4 GPU on the macOS 27.2 firmware (26B123) #2676 head 923d1ec, which wrote all four words, woke 6/6 deep sleeps on the J713 (J713-S2R rows X/X2) with the same -110 commit warning and no crash, but those rows ran no GPU work after the wakes.
  • The -110 commit warning is not fixed by this change: on t5p the first sleep, taken with vkmark running, still logged GPU stop at the commit ... (-110), then the firmware was back in 639 us with no crash (wakes 2 and 3 did not log it). What this fixes is the crash after the warm restart; the clean stop at the commit is a separate open item.
  • A/B kernels: 7.3.0-bj713t5w+ (t5 + the four POWER_PERFORMANCE words + the four GLOBALS words) and 7.3.0-bj713t5p+ (t5 + only these three POWER_PERFORMANCE words, i.e. this PR's change). Both passed 3/3. The A/B traces are in the lab store (traces/gpu/20261122-j713-gpu-1000/deepwake-ab, traces/gpu/20261122-j713-deep2).
  • READY reports scheduler 0 with and without the change (the older head reported 1), so that value is not tied to these words.

Assisted-by: LLM (Claude:Opus 5.5)

…ives a deep wake

The 26B123 POWER_PERFORMANCE layout inserts four u32s at +0x9c. G16
writes only +0xa4, the powered-up state selector. That is enough for a
cold boot, but not for the firmware's warm restart after a deep sleep:
on the J713 (M4 Air) the first deep wake ends with "GPU firmware back
in 691 us" and, 0.3 ms later, "RTKit: co-processor has crashed" in the
firmware's power-up path, before any client has submitted work. The GPU
is gone until reboot.

macOS 27.2 sets all four words to 1, and so did this driver before the
26B123 layout was reworked. Write +0x9c, +0xa0 and +0xa8 again, next to
+0xa4. The words belong to the 26B123 layout, so they are selected by
the firmware ABI, as before; 25G83 is unchanged.

On the J713 (macOS 27.2 firmware, default kernel command line) with
the external monitor and the USB4 peer attached: 3 of 3 deep sleeps
wake with the GPU alive, with vkmark running across the first sleep,
then dEQP-VK smoke and glmark2 after the wakes. Without the change the
same kernel crashed on the first wake. The host tests and the 26B123
offset oracle are updated for the three words.

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

Copy link
Copy Markdown
Contributor Author

Adversarial review of 4085b87 (I ran the t5p split kernel this PR is based on). Verdict: no blockers. Two should-fixes, both in the PR text, and one row to add.

Checked, OK

  • Rules: the words sit in the 26B123 layout that the firmware ABI already selects, next to 0xa4, so this adds no new chip, board or firmware gate and no parameter. They are state enables (1), not limits or thresholds, so the safety-values rule doesn't apply. 25G83 is untouched.
  • The power_policy_fits / overlap const checks still hold: +0x9c..+0xab are disjoint from the ADT-derived limiter words at +0xa80.. and from power_sampling.
  • The oracle in test-abi-26b123.py expects exactly the four words.
  • Cold boot with the words: 2 boots (t5p 24463f9d, t5w), READY normal, GPU used (vkmark, glmark2, dEQP smoke).

Should-fix (PR text)

  1. "With this change the -110 warning also stopped" doesn't hold for this exact change. On t5p (this PR's three words, nothing else), the first deep sleep, taken with vkmark running, still logged GPU stop at the commit: idle 0 0, PMP request 0, domain 0xf002800 (-110). The firmware was then back in 639 us and did not crash. Wakes 2 and 3 didn't log it. So the fix is "no crash after the warm restart", not "the stop is clean now". Please reword. The -110 commit stop is a separate, still-open item; it matters for the power state the GPU sleeps in.
  2. "923d1ec2 ... woke 6/6 deep sleeps (rows X/X2)": those rows ran no GPU work after the wakes. Only the absence of a firmware crash was observed there. Worth saying, so nobody reads it as 6/6 with the GPU used.

Add to Still to run

  • The words change how the firmware powers the GPU, so idle power should be checked: awake idle with the panel dark, GPU idle, on t4 vs this change (gauge or PMP over 120 s, as row P measured 4.8 W on t5). Then a few minutes of light GPU load and idle, to make sure the firmware still drops the GPU to its idle state with the words set. Not a blocker for folding into drm/asahi: g16: run the M4 GPU on the macOS 27.2 firmware (26B123) #2676, but it belongs in the gate.

Evidence: traces/gpu/20261122-j713-deep2/deepwake-t5p (s2gpu.txt line 21 for the -110 with the change), traces/gpu/20261122-j713-gpu-1000/deepwake-ab.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Adversarial review at 4085b87: no blockers. One should-fix (documentation), and the gate row is still owed.

What I tried:

  • Scope. The words live in V26B123.power_policy, so only the 27.2 G16 firmware layout writes them, selected by the firmware ABI. 25G83 is unchanged, and the change adds no chip/board check, no parameter and no new code path. On cold boot it writes three more words that the older drm/asahi: g16: run the M4 GPU on the macOS 27.2 firmware (26B123) #2676 head 923d1ec also wrote (rows X/X2 booted with them).
  • Is it the minimal change? Yes. The split A/B separates it cleanly: t5w (these words + the four GLOBALS words) and t5p (only these three) both woke 3/3, while t5 without them crashed on the first wake. The GLOBALS words are not needed.
  • Hidden dependence on the old head. The scheduler 0/1 READY difference tracks the G16 tree and not these words, as the PR says, so it can't mask a second cause.
  • Host oracle. test-abi-26b123.py now expects the three words. A revert would fail it, so the oracle guards the change.

Should-fix (non-blocking): the code names only 0xa4 ("selects the powered-up state"). 0x9c, 0xa0 and 0xa8 stay unnamed, justified by "macOS 27.2 sets them to 1" plus the wake result. If the layout gives them names or meanings (power-up request / warm-restart enable?), name them in the Layout so the next ABI port does not drop them again. Otherwise, say in the comment that they are written as a group because the warm restart needs all four.

Rows: the J713 promotion gate (10 deep sleeps of 20 s with the monitor and USB4 peer, a GPU job after each wake, s2idle 3x, warm 3x) runs on the next J713 default candidate, which carries this PR plus integration tip. I'll post the result here.

@DjDeveloperr
DjDeveloperr merged commit 2244998 into djdev/g16-272 Nov 22, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Promotion gate row on the J713 is done: PASS, and this commit is now in the J713 default.

Kernel 7.3.0-bj713t6+ = integration/aurora cacf355 + the open J713 PR heads, including this PR at 4085b87 on #2676 ed41e08; no other commits. Default kernel command line, external monitor on USB-C and the USB4 peer attached.

  • Deep sleep with vkmark running across it: vkmark finished (3127), dEQP-VK smoke 3/3, glmark2 3291 after the wake, GPU firmware back in 635 us, no firmware crash.
  • 6 more deep sleeps (20 s, PMU RTC): 6/6 woke, dEQP-VK smoke triangle passed after each one. Suspend stats: 7 succeeded, 0 failed. No crash, oops, DART fault or AVC.
  • After a warm reboot: s2idle 3/3, then deep 3/3 with H.264/H.265 encode, camera and a Vulkan triangle after the wakes. Warm boots 3/3.
  • The GPU stop at the commit ... (-110) warning still showed up once (the first sleep, taken with vkmark running), as the PR body now says. The firmware came back without a crash after it.

From our side this is ready to merge into djdev/g16-272, or to be folded into #2676. Dj, it's your call which you prefer.

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