Skip to content

drm/apple: iomfb 26.6: the DCP's sleep shutdown as macOS sends it (draft, on #2572) - #2583

Draft
satchlj wants to merge 8 commits into
soc-apple/j613-sleep-portfrom
drm-apple/v26-sleep-shutdown
Draft

satchlj wants to merge 8 commits into
soc-apple/j613-sleep-portfrom
drm-apple/v26-sleep-shutdown

Conversation

@satchlj

@satchlj satchlj commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf. Draft, stacked on #2572 (the J613 sleep port), and needs #2558 (the 26.6 power-down callbacks). The deep sleep it serves has not woken yet.

What it does

Before the DCP's cold stop for a system sleep, behind trial switches that are off by default:

  • appledrm.v26_sleep_calls=1: the calls the 26.6 firmware receives from macOS at its sleep entry: A478, A476(1), A473 (16 bytes), A115, A500 (0, 1).
  • appledrm.v26_sleep_calls=2: the panel-off group macOS sends 6.9 s earlier comes first: A414, A478 ×2, A476, A478, A412, A473 zeroed, A500 (0, 0).
  • Reply check: every reply is compared byte for byte with macOS's, and a mismatch makes the result -EPROTO.
  • appledrm.v26_sleep_rtkit_idle: then RTKit AP and IOP idle, on the 26.6 session's RTKit (dcp->v26->rtk).

The calls and their inputs are observed traffic on the DCP's mailbox and RPC memory (Aura capture run 68, with aurora-silicon/aura#390). Each call's meaning is not known beyond what the traffic shows.

Results

J613 trial kernel n33 (f44bf7af + 39), the same Image and DTB for every run, n=1 each:

v26_sleep_calls (trial name j613_sleep_calls) Calls RTKit idle SoC power after the commit
1 0, replies as macOS's 0 (0x30002e) kept (watchdog witness fired)
2 0, replies as macOS's 0 (0x30002e) kept
0 (control) — -62 (0x3000ac) kept

The calls are what make the DCP's RTKit idle succeed. They do not, alone, let the SoC power down.

Untested:

Not yet shown on hardware: with f687047a the sleep calls and the RTKit idle run by default, with no module parameters. This form has not been booted or put through a sleep.

Assisted-by: LLM (Anthropic:Claude Opus 5.5)

@satchlj
satchlj force-pushed the soc-apple/j613-sleep-port branch from 6da1c0e to 4820c62 Compare November 20, 2026 16:29
@satchlj
satchlj force-pushed the drm-apple/v26-sleep-shutdown branch from 06d9663 to 8d801c2 Compare November 20, 2026 16:31
@RyanTheTide

Copy link
Copy Markdown
Contributor

Fine as a draft behind switches that default to off. Some small things to fix before it leaves draft:

  • dcp.c:9486: the new comment and the module parameters went in between the existing comment that ends "Not in the sleep driver's dry run..." and dcp_j613_sleep_owned(), which that comment describes. It now sits above the parameters instead. Moving the new block above it, or below the function, keeps both readable.
  • The group numbers disagree. The comment above dcp_v26_sleep_call() calls the panel-off set "Group 1" and the sleep-entry set "Group 2" ("@groups: 1 sends group 2 only"), while MODULE_PARM_DESC says "1: the sleep-entry group, 2: the panel-off group first". The behaviour is the same, but naming the sets "panel-off" and "sleep-entry" in both places would avoid the mix-up. That comment also describes dcp_v26_sleep_calls() but sits on the helper.
  • dcp_v26_call() sets v26->failed on any error (iomfb_v26_6.c:307), so one failed trial call makes every later call return -EIO. After the cold stop that changes nothing, but it is worth saying in the comment.
  • The bare { } block in dcp_platform_suspend() would read better as a small helper, for example dcp_v26_sleep_trial(dcp).

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

dcp_platform_suspend() only performs the RTKit idle and the 26.6 pre-sleep calls when the v26_sleep_rtkit_idle / v26_sleep_calls module parameters are set; both default off, and the block logs its state with dev_warn on every suspend. As written this is a trial harness, not a sleep path: the DCP shutdown has to work with no parameters. Once it is known which of the idle and call groups the firmware requires, make that the fixed sequence for dcp_j613_sleep_owned() devices, drop both parameters and lower the logging to dev_dbg. Until then this should stay a draft.

@satchlj

satchlj commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. Pushed 878dfdb (comments only, signed off):

  • The trial parameters' block now sits above the comment that describes dcp_j613_sleep_owned(), so that comment again directly precedes the function.
  • The call groups are named "panel-off" and "sleep-entry" in both the function comment and MODULE_PARM_DESC.

On the switches: agreed, they shouldn't merge. What we know so far, all on J613:

  • With both groups sent, every reply matches macOS's (n33–n49).
  • The RTKit idle answers, and the DCP ends at the same ASC state as macOS.
  • With those in place, a WD1 witness still shows the SoC keeping its power after the commit (n49–n53). We checked tonight that WD1 can't bite a SoC that really sleeps: macOS slept 29 s with WD1 armed and wasn't bitten (capture 76). So the DCP sequence isn't what's holding sleep up, but we can't yet say which parts of it the firmware requires.

Once a J613 sleep wakes, I'll make the minimal sequence fixed for dcp_j613_sleep_owned() devices, drop both parameters, and lower the logging to dev_dbg. Until then this stays a draft.

Before the cold stop for a system sleep (switches, off by
default), send the 26.6 firmware the calls macOS sends it before a sleep,
observed on its mailbox and RPC memory (Aura capture run 68), then ask
RTKit for AP and IOP idle on the 26.6 session's RTKit:

- appledrm.v26_sleep_calls=1: the sleep-entry group, A478, A476(1),
  A473 (16 bytes), A115, A500 (0, 1); =2: the panel-off group first,
  A414, A478 x2, A476, A478, A412, A473 zeroed, A500 (0, 0). Every reply
  is compared with macOS's; a mismatch is -EPROTO.
- appledrm.v26_sleep_rtkit_idle: the RTKit idle before the cold stop, on
  dcp->v26's RTKit where the 26.6 path keeps it.

Without the calls the idle is never acknowledged (-62); with either
group it is (status 0x30002e). Needs the power-down callbacks (#2558).

Signed-off-by: Satya Benson <satya@benson.earth>
The trial parameters' comment and definitions now sit above the comment that describes
dcp_j613_sleep_owned(), which again directly precedes it. The call groups are named
panel-off and sleep-entry in both the function comment and the parameter description.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj force-pushed the soc-apple/j613-sleep-port branch from 4820c62 to 7f160c1 Compare November 21, 2026 17:58
@satchlj
satchlj force-pushed the drm-apple/v26-sleep-shutdown branch from 878dfdb to 0a87098 Compare November 21, 2026 17:58
…idle by default

The sleep shutdown's panel-off and sleep-entry calls and the RTKit AP
and IOP idle before the cold stop were behind two module parameters.
Run them on every such sleep instead, in the firmware's own order, and
report only a failed idle.

Signed-off-by: Satya Benson <satya@benson.earth>
Conflict in dcp_platform_suspend(): keep this branch's sleep calls and
RTKit idle, with the base's rename of the cold-stop flag.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

J613 row (on #2572 and the current tip, trial-only conditions as on #2572): the DCP sleep shutdown fails before the commit.

  • J613 unhandled kernel callback 0x44323039 0/8 ("D209"), then "DCP call 0x41343733 failed: -95; recovery requires a reboot"
  • "panel-off calls before the sleep: -95", "sleep calls (groups 2): -95"
  • "RTKit: AP idle not acknowledged: -62", "RTKit idle before the cold stop failed: -62"
    I'm looking at handling D209 next.

J613's DCP calls D209 (no input, a u64 out) during the sleep shutdown.
Left unhandled it fails with -EOPNOTSUPP, and the panel-off and sleep
calls behind it return -95. The M4 and H17P ABIs already answer it as
get_calendar_time_ms; answer it the same way here.

Signed-off-by: Satya Benson <satya@benson.earth>
J613's DCP sends D002 (no input, no output) during the sleep shutdown.
Unhandled, it fails with -EOPNOTSUPP and the panel-off and sleep calls
behind it return -95. The other ABIs take it as a notification.

Signed-off-by: Satya Benson <satya@benson.earth>
…, D594)

After D002, J613's DCP sends D592 (20 bytes in, no reply) during the
sleep shutdown, and unhandled it fails the panel-off and sleep calls with
-95. The M4 ABI groups D002, D008, D592 and D594 as notifications
(set_power_trace_enable, swap_complete_intent,
enable_backlight_message_ap_gated); take the remaining three the same way
when no reply is asked for.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

With f540e0b the J613 DCP sleep shutdown now completes: panel-off calls before the sleep: 0, sleep calls (groups 2): 0, replies as macOS's, and RTKit idle is acknowledged (no -62). That's on the same trial stack as before (with #2572, SEP disabled and its gate skipped by a local trial commit, RAM boot). That row also carried a trial-only fallback that logs and zero-answers any unhandled callback, and it never fired, so these commits alone are enough. The callbacks answered are D209 (get_calendar_time_ms), D002 (will_power_off_signal), D592 (20/0, a notification) and D572 (4/4, set_kernel_power_assert: success). D008 and D594 were dropped until J613 shows them.

The SoC still doesn't power down after the commit (WD1 resets it about 60 s later), so the DCP isn't what holds it up.

…, D572)

The previous change took D008, D592 and D594 at any input size, but only
D592 (20 bytes in, no reply) has been seen from J613's DCP. Narrow it to
that shape, and leave D008 and D594 unhandled until they are observed.

After D592 the DCP's sleep shutdown sends D572 (4 in, 4 out). The M4 and
H17P ABIs answer it, powerUpDART, with success; do the same.

Signed-off-by: Satya Benson <satya@benson.earth>
@satchlj
satchlj force-pushed the drm-apple/v26-sleep-shutdown branch from f540e0b to f386099 Compare November 22, 2026 10:29
@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. Amended the head commit (f540e0b → f386099, pushed with a lease): D572 is powerUpDART (the H17P table, and M4's comment in case order), not set_kernel_power_assert. Only the message and a code comment changed; the behaviour (answer success) is the same.

@satchlj

satchlj commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf. Correction to my last note: J613's own callback table isn't known, so D572's name is uncertain. H17P's table calls it powerUpDART, and M4's comment is ambiguous. Both answer it with success, which is what this does; the commit message's name is a best guess.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-checked at f386099. The diff from f540e0b is one comment line, so the 09:59 J613 row is effectively at this head.

  • Fixed: the comment order and group names, and both module parameters. The sequence is now fixed.
  • Still open: the sequence logs at dev_warn on every suspend, success included: "panel-off calls before the sleep: 0" and "sleep calls (groups 2): 0, replies as macOS's" in iomfb_v26_6.c. Please make the success lines dev_dbg and keep warnings for failures and reply mismatches.
  • Still open: the bare { } block in dcp_platform_suspend() (dcp.c ~9563) is now also mis-indented. A small dcp_v26_sleep_shutdown(dcp) helper would fix both.
  • New: dcp_v26_sleep_calls() has only one caller, and it always passes 2, so the groups argument and the sleep-entry-only path are dead. They can go, along with the "J613 trial:" label on dcp_v26_rtkit() in iomfb_v26_6.h.
  • The new callbacks match the M4 (dcp-m4-callback.h) and H17P (dcp-link.h) handling. That looks fine.
  • The completing row still ran with the SEP disabled by a local commit and on a trial DTB. Before undraft we need one row at this head on the stack's own DTB with the SEP on, showing the same "0 / replies as macOS's" result.

Assisted-by: LLM (Claude:Opus 5.5)

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