Repository navigation
drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known - #2070
drm/apple: T6050: refuse deep sleep at .prepare where the firmware 27 display sleep is not known#2070rolotrealanis98 wants to merge 1 commit 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. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: FINISH at f0d63f6f7c44
Blockers:
- §5 (Evidence) — no hardware row at exact head
f0d63f6f7c44yet. Add a default-cmdline row atf0d63f6f7c44on T6050 hardware (J714s or J716c on 27.0 confirming deep sleep enters and resumes with the panel back, no refusal line, and 0 AVC / 0 failed units / 0 new kernel errors; plus a J714s on 27.2 refusal row if available, or state what the closest T6050 row stands in for per merge policy §3).
Checked: §1–§4 and §6 pass across the 7-file diff and commit f0d63f6f7c44 (data-driven method-table check, PM .prepare/.complete/s2idle/backstop audit, clean attribution and IP hygiene); CI is green (kunit, host-tests, pr-text) and mergeable == MERGEABLE; waiting only on the §5 exact-head hardware row.
Evidence
- §1 (No model gating):
iomfb_v27_sleep_missing_method()indrivers/gpu/drm/apple/iomfb_v27.c:344-356gates solely on whether the build's selecteddcp->v27_methodstable carries the 6 table-mapped sleep RPCs (dcpep_set_power_state,dcpep_unnamed_500,dcpep_pipe_cfg_414,dcpep_pipe_query_478,dcpep_pipe_set_476,dcpep_is_main_display) under the 27.0 wire tags currently sent bydcp-v27-sleep.incandiomfb.c(A484,A500,A414,A489,A487,A412;A115andA442have no table entry and only ride with checked calls). No board, SoC, or firmware-version check is added. J714s (iomfb_v27_methods_j714s()copy differing only indcpep_swap_submit) and J716c on 27.0 remain admitted; J714s on 27.2 (currently admitted tov27_sleep_transportviadcp->v27_j714s) or 27.3 is refused cleanly. Non-T6050 SoCs never satisfydcp_v27_sleep_selected(), so there is no interaction with #2710 or #2721. Interaction with #2187 is clean and documented (once #2187 switches sleep RPCs to dynamic table lookup, the check narrows to non-empty tags). - §2–§3 (PM lifecycle & safety):
drivers/gpu/drm/apple/dcp.c:8499-8502: gated onpm_suspend_via_firmware() && dcp_v27_sleep_selected(dcp), so s2idle (pm_suspend_via_firmware() == false) and hibernation are unaffected.- Returning
-EOPNOTSUPPfromdcp_platform_prepare()aborts before any device.suspend()runs, with no firmware RPCs or endpoint mutations;dcp_v27_sleep_invalidate()is idempotent, PM core skips.complete()on the failing device, and any sibling DCP that already passed.prepare()completes cleanly indcp_platform_complete(). drivers/gpu/drm/apple/dcp-v27-sleep.inc:424-435:dcp_read_fw_version()initializescompatsafely (writing"UNKNOWN"on failure);#elsestub at line 1777 matches forward declaration forCONFIG_APPLE_SOC_SLEEP=n.- Backstops:
dcp_v27_sleep_prepare()(dcp-v27-sleep.inc:1464-1465) re-checksiomfb_v27_sleep_missing_method()before any teardown or RPCs;dcp_v27_sleep_endpoints_open()(dcp-v27-sleep.inc:1043-1044) returns-EPROTOifdcp_afkep(dcp, id)already has a live untracked ring (safe on admitted processors becausev27_sleep_transportis set atdcp.c:7624before anyafk_init()runs). - Unit & host tests: KUnit
dcp_firmware_27_sleep_methods(dcp-firmware-test.c:75-104) covers 27.0, 27.2, 27.3,NULL, J714sA407copy, mismatched tag, and cleared tag;tools/asahi/display-sleep-merge-tests.pycovers.preparerefusal plusprepare-ignore-knownnegative control;tools/testing/selftests/drivers/gpu/apple-dcp/boot.pyaddsARRAY_SIZEfor the extracted table slice.
- §4 (IP & attribution hygiene): Commit
f0d63f6f7c44, PR title, PR body, and code comments carry no firmware assertion filenames/lines/internal symbols and no AI attribution. HumanSigned-off-by:is present. - §5 (Evidence & CI): PR body includes
What:,Tested:,Risk:(two-way door), andNot yet:. CI atf0d63f6f7c44:kunitPASS,host-testsPASS,pr-text / pr-textPASS (readinessrun cancelled by newer trigger). Missing only the exact-head hardware row atf0d63f6f7c44. - §6 (Naming): Clean.
- Non-blocking nit: Commit
f0d63f6f7c44has twoSigned-off-by:lines for the same author separated by a blank line (rolotrealanis98andRolando Trevino); fine to tidy if you amend for any reason, not blocking.
What: refuse a T6050 deep sleep at
.preparewhen the build's firmware 27 method table does not carry the display sleep's calls under the IDs the sleep sends, instead of sending them anyway.Tested: no hardware row at f0d63f6 yet; KUnit, host tests and
checkpatch --strictpass at that SHA (Testing below).Risk: two-way door. T6050 DCP/DCPEXT on firmware 27 under the T6050 deep sleep; a J714s on 27.2 or 27.3 now refuses deep sleep (its table gives the sleep's IDs to other methods); the J714s and J716c on 27.0 are unchanged.
Not yet: a J714s 27.0 deep sleep at this head, and the refusal itself on a J714s 27.2 or 27.3 (see the end).
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()). 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 or 27.3 is admitted, and its table gives several of those IDs to other methods or to none, so the sleep would send 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, decided by the method table rather than by the board:
iomfb_v27_sleep_missing_method()names the first call of the display sleep that the selected table (dcp->v27_methods) 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 sleep with -EOPNOTSUPP on a processor the display sleep would run on whose table does not carry it, before any device suspends, and logs the build and the first missing call. s2idle never reaches this check.dcp_v27_sleep_prepare()refuses the same way, anddcp_v27_sleep_endpoints_open()returns -EPROTO rather than start an endpoint that already runs but is not tracked for the sleep. On an admitted processor every endpoint is tracked, so it does not trigger there.Affected: T6050 DCP/DCPEXT on firmware 27 under the T6050 sleep. The J714s and the J716c on 27.0 keep their deep sleep; a J714s on 27.2 or 27.3 is refused at
.prepare. No other SoC reaches this code.No board or firmware-version check is added: the decision comes from the method table the driver already selects for the build, the same data
iomfb_v27_missing_method()uses to decide whether a build may start at all. A build is admitted as soon as its table carries the sleep's calls under the IDs the sleep sends.Interaction with #2187: that change makes the sleep send each build's own IDs and admits processors by
iomfb_v27_sleep_methods_complete(). With both applied, the.prepareanddcp_v27_sleep_prepare()checks use that helper, so 27.2 stays admitted and 27.3 stays refused; the untracked-endpoint backstop is independent of it.Testing
KUnit (
display.kunitconfig, arm64, LLVM): 148 run, 147 passed, 1 skipped, including the newdcp_firmware_27_sleep_methods. Host tests (tools/asahi/run-host-tests.py): 505/505, includingdisplay-sleep-merge-testswith the addedprepare-ignore-knownnegative control.checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.drivers/gpu/drm/apple/builds withW=1, no warnings, withCONFIG_APPLE_SOC_SLEEPon and off.Not yet run
Related, not in this PR: the boot timer write on the J716s
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. Only the J714s and the J716c are admitted to the T6050 sleep today, so nothing here reaches that code on another board. Noting it for whichever board is admitted next.