Repository navigation
drm/apple: T6050: check the deep sleep's endpoints before starting any - #2070
rolotrealanis98 wants to merge 11 commits into
Conversation
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) |
|
This no longer applies to the current integration/aurora tip 110861f. Since it was opened, #2124 (fd5cc59) admitted the J716c on 27.0.0 to the firmware 27 sleep through a new v27_sleep_transport flag, and dcp_v27_sleep_selected() now requires that flag. A J716s on 27.3 therefore no longer takes the v27 sleep at all, but a J714s on 27.2 or 27.3 still does. Rebased as is, the J716c's merged deep sleep would be refused at .prepare, because v27_sleep_known is only set for the J714s 27.0 table. @rolotrealanis98 could you rebase and derive v27_sleep_known from the selected method table carrying every ID the sleep sends, as suggested in the 11-21 review? The comment and commit message should also describe the firmware assertion in our own words rather than quoting its source file, line and method names. |
… display sleep is not known A T6050 deep sleep runs the firmware 27 display sleep on every DCP and DCPEXT admitted to its transport (dcp_v27_sleep_selected()). That sleep sends its calls by their firmware 27.0 IDs, and admission does not look at the build's method table: a J714s on 27.2, whose table gives several of those IDs to other methods or to none, takes the sleep and sends them anyway. On a J716s (27.3), before admission to the transport was decided per processor, this sleep left the display dark until a reboot. None of its endpoints were tracked for the sleep, so the sleep started the running system endpoint a second time; the firmware asserted, the call timed out after 1 s and the suspend failed with -ETIMEDOUT. Refuse such a deep sleep where it starts, decided by the method table rather than by the board: - iomfb_v27_sleep_missing_method() names the first call of the display sleep that a build's table does not carry under the ID the sleep sends, NULL if it carries them all. The 27.0 table and its J714s copy carry them; the 27.2 and 27.3 tables do not. - dcp_platform_prepare() refuses a firmware-driven (deep) sleep with -EOPNOTSUPP, before any device suspends, on a processor the display sleep would run on whose table does not carry it, and logs one line with the build and the first call it lacks. 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 a ring already runs on an endpoint that is not tracked for the sleep, instead of starting that endpoint again. Every endpoint of an admitted processor is tracked, so it does not trigger there. The J714s and the J716c on 27.0 keep their deep sleep. Another build is admitted as soon as its table carries the sleep's calls under the IDs the sleep sends; once the sleep sends each call by the build's own ID, the check becomes whether the table has an ID for each call. The apple-dcp-firmware KUnit suite checks the tables against the sleep's calls, and display-sleep-merge-tests checks the refusal at .prepare. Signed-off-by: rolotrealanis98 <122947376+rolotrealanis98@users.noreply.github.com> Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com>
df8aaf5 to
f0d63f6
Compare
|
@RyanTheTide thanks, reworked and rebased on main (83950d0), one commit:
At f0d63f6: KUnit display suites 147/148 (1 skipped, none failed), host tests 505/505, On #2187: today the sleep sends 27.0 IDs, so a 27.2 table is refused here. Whichever lands second rebases. If #2187 lands first, I'll switch the .prepare and No hardware row yet at this head. On main the J716s no longer takes this sleep, so it can only show its deep sleep is unaffected; the refusal itself needs a J714s on 27.2 or 27.3. I don't have a J714s, so a run of the J714s 27.0 row would be very welcome. |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Pushed d7448bc (normal push):
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
The merge-up preserves the DCP endpoint checks. The new prepare path evaluates the sleep table once and returns the saved refusal before DPMS prepare. I ran all 25 display-sleep checks on the merge with main 6162827, including both new negative controls. Merge still awaits the J714s physical deep-sleep and display-resume result at this head.
One conflict, in the display-sleep merge test: main added the ext272 pointer to the mocked struct apple_dcp and this branch added v27_known; the mock now carries both. dcp.c, dcp-v27-sleep.inc, iomfb.h, iomfb_v27.c and dcp-firmware-test.c merged without conflicts. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merged main 06fceca into the branch at Checks on the merged tree:
The merge clears the 12-02 approval. Still needed: a quick re-review of the merge, and the T6050 deep-sleep and display-resume row at |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Re-checked the forward merge at 15b496b. The mock retains both ext272 and v27_known. On the GitHub merge candidate 082fe65 against main 87c01c2, git diff --check and all 25 compiled display-sleep boundary runs passed, including the runtime controls. The supported-table T6050 deep-sleep and display-resume row is still pending.
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 696ad13a, after the hardware row below.
Blockers: none.
Checked: the forward merge and the change itself. At 15b496b8 the only conflict was the mock struct apple_dcp in tools/asahi/display-sleep-merge-tests.py. It now carries both main's ext272 and this branch's v27_known, which is right; every other file matches a clean merge. The host-tests failure at 15b496b8 was only centauri-scan-tests (996/998 passed). That failure came from main's own harness at that point, and main has since fixed it (#3987). This PR touches none of its files. I merged current main into the branch server-side (696ad13a). That merge matches a clean merge, this PR's dcp.c hunks are unchanged, and display-sleep-merge-tests.py passes all 25 runs there. In dcp_platform_prepare(), the refusal still comes after main's ext272 and cold-stopped early returns and before the DPMS prepare. It follows the same method table that admission uses, and the endpoint set is checked whole before any endpoint starts. No Apple material, no board or firmware gate, no new parameter.
Still owed before merge: a J714s deep sleep and display resume at this head, on firmware whose table carries the display sleep (27.0 or 27.2): no refusal line, the panel comes back, 0 AVC, 0 failed units, 0 new kernel errors.
Evidence
git merge-tree --write-treeof each merge's parents:696ad13aanded611931match exactly, and15b496b8differs only in the conflicted test file. The earlier merges were reviewed at their own heads. I read the net diff against main.- Main's
dcp.cchange since06fceca4(#3893) merges cleanly with this PR's hunk. Comparing the diff against main before and after the merge shows the same lines. python3 tools/asahi/display-sleep-merge-tests.pyon the696ad13atree:PASS: 25 compiled merge-boundary runs, including runtime controls.
There was a problem hiding this comment.
Verdict: MERGE at 696ad13
Checked: The latest merge preserves the selected firmware method table as the source of truth and checks it before DPMS prepare. The full endpoint set is preflighted before any ring starts, so refusal cannot leave it partly opened. All 25 exact-head compiled host cases passed, including the tests that catch reordered preparation and partial endpoint opening. s2idle keeps the existing path.
…y the table Main now keeps a processor whose firmware 27 method table lacks a display sleep call out of the sleep transport at admission (iomfb_v27_sleep_methods_complete()), so the .prepare refusal this branch added could only fire if the two checks disagreed. Drop it, its helper and their tests. What stays is the endpoint backstop: the whole endpoint set is checked before the first endpoint starts, and an endpoint the sleep does not track that already runs a ring is refused (-EPROTO) instead of started a second time. Signed-off-by: Rolando Trevino <122947376+rolotrealanis98@users.noreply.github.com>
DjDeveloperr
left a comment
There was a problem hiding this comment.
The endpoint check covers the full set before starting any ring. It leaves tracked endpoints in place and refuses an endpoint already routed elsewhere, so a late missing or occupied endpoint cannot leave an earlier ring started.
On the merge tree with main at 16a732e9c8e0, git diff --check was clean, all 22 display sleep host checks passed including the endpoint negative controls, and ARM64 dcp.o built with W=1 without DCP warnings.
The remaining merge gate is the M5 lead’s J714s run at this head. Use a firmware build admitted to the firmware 27 display sleep path and verify a committed deep sleep and panel recovery without new DCP errors.
|
Ready to merge at |
|
The approval and relevant CI checks are in for The remaining merge gate is a J714s run at |
What: before the T6050 deep sleep starts its firmware 27 endpoints, check the whole set: each exists, and an endpoint the sleep doesn't track that already runs a ring is refused (-EPROTO) instead of started a second time.
Scope change (33890e1): the
.preparerefusal this PR first added is gone. Main now keeps a processor whose method table lacks a display sleep call out at admission (#2124, #2187:iomfb_v27_sleep_methods_complete()), so that check could only fire if the two disagreed. Only the endpoint backstop remains, which main doesn't have.Tested: KUnit, host tests, W=1 and checkpatch at 33890e1 (Testing below). The J716s row in the comments is from 7987e8f, with the earlier
.preparecheck.Risk: two-way door. T6050 DCP/DCPEXT on firmware 27 under the T6050 deep sleep. On an admitted processor every endpoint is tracked, so the check passes and the endpoints start in the same order as before.
Not yet: a J714s deep sleep at this head (I have no J714s).
Problem
A T6050 deep sleep (
mem_sleep=deep) runs the firmware 27 display sleep on every DCP and DCPEXT admitted to the firmware 27 sleep transport (dcp_v27_sleep_selected()). Before #2187 that sleep sent its calls by their firmware 27.0 IDs, and admission did not look at the build's method table. A J714s on 27.2 or 27.3 was admitted, and its table gives several of those IDs to other methods or to none, so the sleep would have sent them anyway.How it shows up, from the J716s (16-inch M5 Pro, firmware 27.3) on the base this was first written for, before #2124 decided admission per processor: a
pm_test=devicesdeep sleep crashed the DCP in the device suspend. None of the J716s's endpoints were tracked for the sleep (sleep_v27_ep), so the sleep started the already running system endpoint 0x20 a second time. The firmware asserted, the call timed out after 1 s, the suspend returned -110, and the display stayed dark until a reboot.Change
One commit on main,
dcp-v27-sleep.inconly:dcp_v27_sleep_endpoints_check()walksv27_sleep_endpoints[]before anything starts. A missing endpoint returns -ENODEV, as before, but now before the first endpoint starts rather than midway. An endpoint the sleep tracks (sleep_v27_ep) is kept. An untracked endpoint that already runs a ring returns -EPROTO.dcp_v27_sleep_endpoints_open()calls it first. A refusal leaves every endpoint as it was, with nothing sent.Testing
At 33890e1 (main merged in):
drivers/gpu/drm/apple/tests/display.kunitconfig(arm64 QEMU, LLVM): 344 run, 343 passed, 1 skipped.tools/asahi/display-sleep-merge-tests.py: 22 compiled runs pass. The 5 endpoint runs include 4 negative controls: the check in the loop (the old order), no preflight, no running-ring check, and tracked endpoints refused.drivers/gpu/drm/apple/dcp.owith W=1: 0 warnings.checkpatch.pl --strict: clean.