Repository navigation
drm/asahi: stop G15S in prepare and preserve firmware SRAM - #3813
Conversation
|
J516s |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
J516s (T6030, M3 Pro) hardware qualification PASS for exact head
|
|
Added |
|
J516s hardware verification for exact head
|
Stop the T6030 GPU before the firmware sleep starts and keep its SRAM data before power is lost. Leave the firmware stopped across a refused sleep and restore it on a real wake. Let thermal zones provide cooling when the PMP lacks the GPU telemetry entry. Signed-off-by: Diljit Singh <hey@djdev.me>
When the system wakes into a dark wake (pm_dark_wake()), avoid restarting the G16/G15S GPU firmware only to stop it again milliseconds later for re-entry. Record sleep_dark_held in Shared while parked so the re-entry prepare path only lowers the GFX power domain without clobbering the saved awake power word, and ensure SRAM is restored on the eventual full wake (including for SleepStop::Commit devices). Register a devm PM_POST_SUSPEND notifier as a safety net so if a dark-wake re-entry aborts before reaching the GPU's .prepare/.complete callbacks, the GPU firmware is still restarted cleanly before userspace resumes. Expose pm_dark_wake() via rust/helpers/suspend.c. Signed-off-by: Diljit Singh <hey@djdev.me>
Keep the two-argument commit registration used by the T8122 runtime. Give the Rust G16 backend a separate entry point for the G15S quiet stop and SRAM options. The default registration still skips SRAM saving and leaves the PMP vote alone. Signed-off-by: Diljit Singh <hey@djdev.me>
35b425b to
51dcfea
Compare
|
J714s (M5 Pro, T6050) second-generation peer-control S2R row at exact unchanged head Candidate:
|
|
J516s (M3 Pro, T6030) integration receipt on PR #3813 exact head:
|
There was a problem hiding this comment.
Verdict: MERGE at 51dcfea
Checked:
- Other GPUs: the two-argument
asahi_g16_commit_prepare()stays as a wrapper (quiet=false, no SRAM save), so T8122 (m3_drm.rs) registers as before. Theasahi_g17_commit_free()line only acts wheng16_sram_savedis set.apple_pmp_gpu_get()is only used by g16/glue.c. Only the t6030 config gets stop-in-prepare + SRAM save. G13/G14G/G15G/G17 paths are unchanged. - #3865 hold: this PR doesn't touch sleep_pd.c/driver.rs. A trial merge with main is clean and keeps
asahi_sleep_pd_suspend_noirq_hold(). - Error/abort paths: the receive-interrupt hold and resume pair once per stop on real wake, refused sleep, dark park + re-entry, and re-entry failing before or after .prepare (the PM_POST_SUSPEND notifier restarts the firmware). Registration failure drops the snapshot and the PMP vote.
- SRAM: length and alignment are checked, the mapping is bounds-checked, the 128 KiB kvmalloc buffer is reused, the save and restore lengths must match, and everything is under the
Shared::statemutex (the sleeping calls are legal). rust/helpers/suspend.cwraps an inline that exists with and without CONFIG_PM_SLEEP. Provenance is our own macOS MMIO/s2r traces, with no blobs or disassembly.
Follow-ups (not blocking):
- g16/boot.rs:907 sets start-policy word 1 = 1 whenever
layout.poweredis set. That includes the 27.2 G16 layout (0x648), so J713 (T8132) gets it too, along with the dark-wake parking. There is no J713 row at this head. Post a J713 G16 27.2 boot+wake row, or gate both to T6030. - A sleep refused after the GPU's .prepare leaves T6030's firmware stopped until the next real sleep. That is intended per the PR and is not a regression (main refuses deep on T6030). The
SleepStop::Preparedoc in g16/hw.rs says it "restarts warm after every sleep, real or refused", which contradicts this. The aborted-suspend row is still "Not yet". - The PM notifier is registered in
Gpu::newbefore the driver data is set, andsleep_gpu()has no NULL check. The window is narrow (POST_SUSPEND during probe or unbind). - The static
asahi_g16_srambuffer and ioremap leak on each DRM_ASAHI module unload. - Consider refusing the sleep when the SRAM save fails, instead of stopping anyway.
satchlj
left a comment
There was a problem hiding this comment.
Verdict: APPROVE at 51dcfeaa
Reviewed the full diff across g16/{boot,hw,mod,sleep}.rs, g16/glue.c, g17/sleep.{c,h}, pmp-telemetry.c, and rust/helpers/suspend.c:
- SoC scoping & shared paths:
SleepStop::Prepare,sleep_quiet_stop, andsleep_sram(0xd60000, save0x20000, restore0x14000) are enabled only ont6030;t8132andt8122remainSleepStop::Commitwithquiet: falseandsleep_sram: None.asahi_g16_commit_prepare()stays a wrapper preserving existing callers.asahi_g16_tvm_enable()checksapple,t8132-gfx-tvmand returns 0 when absent.apple_pmp_gpu_get()checksdevice_is_bound()underdevice_lockso a bound PMP without telemetry returns-ENODEVinstead of deferring forever, lettingasahi_g16_cooling_register()fall back cleanly to thermal-zone backstop cooling. - SRAM & dark-wake lifecycle:
asahi_g16_sram_save()validates non-zero length,restore_len <= save_len, and 8-byte alignment, runs underShared::state, and clearsasahi_g16_sram_restore_lenboth on abort (!c->ran) and after restore beforeASC_RUN. Dark-wake parking (sleep_dark_held+PM_POST_SUSPENDsleep_dark_finishsafety net) pairsapple_rtkit_hold_rx()andapple_rtkit_resume_rx()once per stop across real wake, refused sleep, dark-wake re-entry, and aborted re-entry. - CI & hardware evidence: CI passes at
51dcfeaaaba8, with exact-head J516s 2-cycle physical deep-sleep + post-wakegpubench-vkPASS (#issuecomment-7343746020), prior J516s 600 s dark-wake soak PASS (#issuecomment-7329205610), and J714s (G17S) second-generation peer-control S2R PASS (#issuecomment-7339043925).
Non-blocking follow-ups:
g16/boot.rs:907(policy.words[1] = 1wheneverlayout.powered.is_some()) and dark-wake parking ing16/sleep.rsalso apply to T8132 (G16) on 27.2; please post the queued G16 27.2 boot+wake check (or gate to T6030 if G16 objects).g16/mod.rs:754registers thePM_POST_SUSPENDnotifier inGpu::newbeforedev_set_drvdatacompletes, andsleep_gpu()does not null-checkdev_get_drvdata(dev)— worth guarding that narrow probe/unbind window in a follow-up.- Update the
SleepStop::Preparedoc comment ing16/hw.rsto match the refused-sleep behavior, and free/unmap staticasahi_g16_sram/asahi_g16_sram_ioon module unload.
|
J773g (G16 27.2) hardware validation PASS on exact head Environment & Build
Results
|
What: Stop G15S during suspend prepare, save its firmware SRAM before power-down, and restore it before restarting the ASC. Keep the firmware stopped after a refused sleep until a real wake. Use thermal zones when PMP has no GPU telemetry entry. This series uses the qualified prepare path without bring-up parameters or PMU scratch writes.
Tested: Strict checkpatch and whitespace checks passed. AArch64 built the Aurora module object and PMP telemetry object. The GPU module build emitted the same 38 warnings as its parent. Both PMP GPU-vote host runs passed.
J516s, integrated kernel
af2647f710fd,direct-t357h-02: the G15S firmware stopped in prepare and recovered after both wakes. Vulkan produced the expected render checksum, the GPU returned toACTUAL 0, and the sensor, fault and recovery counters stayed unchanged. The second RTC latch check failed.Risk: Two-way door. The prepare stop and SRAM region are selected by the G15S match data. The C glue and cooling fallback are shared.
Not yet: Hardware rows at this head on J516s and another generation, including an aborted suspend and a real wake, and independent review. Stacked on #3806 for the shared RTKit mailbox interface.