Repository navigation
drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known - #2070
Conversation
… display sleep is not known A pm_test=devices deep sleep on the J716s (firmware 27.3) crashed its DCP in the device suspend. dcp_platform_suspend() took dcp_v27_sleep_suspend(): dcp_v27_sleep_selected() asks only for a T6050 DCP on firmware 27 under the T6050 sleep. Its "open" step found no endpoint in sleep_v27_ep, which afk_init() fills only for dcp->v27_j714s, so it ran afk_init() and afk_start() on the system endpoint 0x20 that systemep_init() had started at boot: START_EP (mgmt 0x0050002000000002), then RBEP_INIT (0x0080000000000000) on its running ring. The firmware asserted at afk_messenger_common.c:246 with that message, afk_start() timed out after 1 s and the suspend returned -110. The display stayed dead until reboot. Past that step the sleep would send 27.0's tags (A484, A500, A414, A489, A487, A412, A115). 27.2 and 27.3 renumbered those methods: set_power_state is A534/A535 there and A500 is set_parameter_dcp. The 27.3 tags of the sleep's own calls are not known, so there is no 27.3 path to enable yet. - dcp->v27_sleep_known is set only where the sleep's calls are known: the J714s with its 27.0 table copy (iomfb_v27_methods_j714s()). - dcp_platform_prepare() refuses a firmware-driven (deep) sleep on any other T6050 firmware 27 processor with -EOPNOTSUPP, before any device suspends, and logs one line. s2idle does not come here (no pm_suspend_via_firmware()). - dcp_v27_sleep_prepare() refuses the same way if it is ever reached. - dcp_v27_sleep_endpoints_open() refuses with -EPROTO when an AFK ring already runs on an endpoint it does not track, instead of starting it again. On the J714s every AFK endpoint is tracked, so it never triggers there. Tested on the J716s (27.3, aura stage 2 with the S2R mailbox): pm_test=devices with mem_sleep=deep now ends at prepare with -95 and the line "deep sleep refused: no display sleep known for firmware 27.3.0 on this machine (only the J714s on 27.0); s2idle is not affected"; no device suspended, the display stayed up. A pm_test=devices s2idle afterwards succeeded. Not run on a J714s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TYoPBXdNYTj12jEVptd1y7
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
A data point for the 27.2 side of this, from the K116s (16" M5 Pro, 27.2): the firmware 27 display sleep does run to completion there, so 27.2 need not stay in the "not known" set. What it took, on top of the J714s 27.0 path:
Details and logs are in #2075, the experiment branch is linked there. I have no 27.3 machine, so I can't say whether its tags follow the same shift. |
|
Thanks, that's useful. I'd like to keep this PR as the guard and admit 27.2 separately:
|
|
Blockers: 2. The fail-closed direction is right: refusing at .prepare (drivers/gpu/drm/apple/dcp.c:7528) stops the deep sleep before any device suspends, and the untracked-endpoint backstop at drivers/gpu/drm/apple/dcp-v27-sleep.inc:968 is a good generic check.
HW row: J714s on 27.0 with this branch, default cmdline: a deep sleep still enters and resumes with the panel back (no refusal line); J716s on 27.3: the refusal line, no device suspended, s2idle unaffected; 0 AVC / 0 failed units / 0 new kernel errors on both. Nit: the PR body ends with "Generated with Claude Code" and a session link; the last line should be Assisted-by: LLM (Claude:Opus 5.5) |
On a T6050 whose internal DCP runs firmware 27 other than the J714s's 27.0 table, a deep sleep (
mem_sleep=deep) now stops at the DCP's.preparewith one line, instead of running the firmware 27 display sleep and crashing the DCP.What happened
On the J716s (16-inch M5 Pro, firmware 27.3) a
pm_test=devicesdeep sleep crashed the DCP in the device suspend:dcp_v27_sleep_selected()asks only for a T6050 DCP on firmware 27 under the T6050 sleep, sodcp_platform_suspend()tookdcp_v27_sleep_suspend().sleep_v27_ep(filled only fordcp->v27_j714s). It ranafk_init()/afk_start()on the system endpoint 0x20, which was already running since boot:START_EP, thenRBEP_INITon the running ring.afk_messenger_common.c:246,afk_start()timed out after 1 s, and the suspend returned -110. The display was dead until reboot.Past that step, the sleep sends 27.0's method tags. 27.2 and 27.3 renumbered them (set_power_state is A534/A535 there, A500 is set_parameter_dcp), and the 27.3 tags for the sleep's own calls are not known. This also applies to a J714s running 27.2 or 27.3 firmware.
The change (one commit)
dcp->v27_sleep_knownis set only where the sleep's calls are known: the J714s with its 27.0 table copy.dcp_platform_prepare()refuses a firmware-driven sleep on any other T6050 firmware 27 DCP with -EOPNOTSUPP, before any device suspends. s2idle never reaches this check.dcp_v27_sleep_prepare()refuses the same way, anddcp_v27_sleep_endpoints_open()returns -EPROTO rather than restart an AFK endpoint that is already running but untracked. On the J714s every endpoint is tracked, so the backstop does not trigger there.Tested
pm_test=devicesnow ends atpreparewith -95 anddeep sleep refused: no display sleep known for firmware 27.3.0 on this machine (only the J714s on 27.0); s2idle is not affected;pm_test=devicesrun afterwards succeeded.drivers/gpu/drm/applewith W=1 on this base (d5a8a25), no warnings in the touched files.Related, not in this PR
On the J716s,
t6050_sleep_boot_timer_off()oopses: itsMSR S3_4_C15_C2_7(SYS_APL_AGT_CTL_EL02) is an undefined instruction there (ESR 0x02000000, in the bound worker). The oops kills CPU0's high-priority kworker, so block I/O completions stop and the root file system hangs a couple of minutes later.Upstream only admits the J714s to this driver, so nothing here reaches that code on another board today. I'm noting it for whichever board is admitted next. My branch puts the write behind a module parameter (rolotrealanis98/linux@77f43d0e2a53). If the J714s's loader makes these registers accessible and it works there, that would explain the difference.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TYoPBXdNYTj12jEVptd1y7