Skip to content

iommu: apple-dart: keep a live MTP through a firmware-driven sleep - #3425

Merged
satchlj merged 1 commit into
mainfrom
fix/dart-live-mtp-firmware-sleep
Nov 28, 2026
Merged

satchlj merged 1 commit into
mainfrom
fix/dart-live-mtp-firmware-sleep

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

What: A DART that took the boot loader's live MTP handoff (apple,bypass-handoff-streams) refused every system sleep but suspend-to-idle with -EBUSY, so a firmware-driven (deep) sleep failed in dpm_suspend before the sleep driver ran (J615, M3 Air 15"). The rtkit helper already keeps the MTP running through a firmware sleep (AP idle notice only), so its DART is now kept the same way as through s2idle: no save or reset, its domains on the awake path, and the resume checks that stream 1 is still in bypass. Split out of #3413, whose review cleared this part.

Tested: J615 (M3 Air 15", 27.2 firmware) on a kernel carrying this exact commit (df442f67, built as part of #3413's head 6a757b15; drivers/iommu/apple-dart.c byte-identical): default-cmdline boot smoke (eDP, MTP keyboard + trackpad bound, Wi-Fi, NVMe) and s2idle 3/3 with the MTP still bound and 0 live MTP bypass lost; with apple_sleep.deep=1 the deep dry run now passes every check (was apple-dart 2fa808000.iommu: platform_pm_suspend returns -16). J473 (M2 mini, no live MTP handoff) on the same kernel: boot smoke + s2idle 3/3.

Risk: two-way · only DARTs with a live MTP handoff (the loader sets the property; J615/J613 today), only in a firmware (deep) sleep, which T8122 still offers only with apple_sleep.deep=1. s2idle unchanged.

Not yet: a completed deep wake on the J615 (blocked elsewhere: see #3413) to show the MTP and its DART come back from a real power-down; until then the resume check fails closed (-EIO, error logged) if the bypass is lost.

Details
  • apple_dart_system_suspend(): a live-MTP DART now accepts pm_suspend_via_firmware() sleeps as well as s2idle, with the same handling (device_set_awake_path(), live_mtp_sleep, TCR bypass check).
  • apple_dart_sys_suspend_noirq() / apple_dart_sys_resume_noirq(): skip a DART kept that way, since the runtime suspend they would call refuses a live MTP.
  • Refusal ordering: the change only removes a refusal; nothing is torn down.
Evidence

J615 rows r1dry (before: -EBUSY from 2fa808000.iommu), r2dry/prBdry (after: dry run: every check passed), prA (s2idle 3/3, MTP bound after each), J473 prJ473: lab store traces/power/20261128-m3-deepsleep/README.md. Review of the DART part on #3413: aurora-silicon-review, "The live-MTP DART retains bypass and checks it on resume."

A DART that took a live MTP handoff (apple,bypass-handoff-streams) refused
every system sleep but s2idle, so on J615 the deep sleep failed in
dpm_suspend with -EBUSY before the sleep driver ran. The rtkit helper
already keeps the MTP running through a firmware-driven sleep (it sends
the AP idle notice and nothing else), so keep its DART the same way as
through s2idle: no save, no reset, its domains on the awake path, and the
resume checks that stream 1 is still in bypass. The noirq callbacks skip
it, since the runtime suspend they would call refuses a live MTP.

Signed-off-by: Ryan Murray <[email protected]>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at df442f67 pending hosted checks. The isolated DART change is approved.

Checked: A live MTP DART must pass the stream 1 bypass check before the retention flag is set. That flag skips the runtime suspend and resume path in noirq. Normal resume clears it and returns EIO if bypass was lost. The non-live path is untouched. The change adds no binding or board selector.

The author tested this exact DART commit in the combined build. J615 passed s2idle and deep dry run, and J473 passed the non-live control. A full J615 deep wake remains unqualified.

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Merge readiness at df442f67: not ready yet

Check Detail
CI at head ok 19 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at df442f67
Conflicts ok none
PR text ok Risk: two-way · only DARTs with a live MTP handoff (the loader sets the property; J615/J613 today), only in a firmware (deep) sleep, which T8122 still offers only with applesleep.deep=1. s2idle unchanged.

Areas: area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@satchlj

satchlj commented Nov 28, 2026

Copy link
Copy Markdown
Member

Tested on J413 (MacBook Air 13" M2, T8112, macOS 27.2 stub 26B123) with a committed deep sleep + resume: PASS.

  • Kernel: aurora-silicon/linux main (ff59991a6) + feat/t8112-s2r + J413 DT (#3470) + #3425 (df442f67)
  • Stage 2: aura (b6beaa66) + t8112-j413-fw27.dtb + U-Boot mtp-live-v1 handoff (u-boot#79)
  • Boot: rtkit-helper 24e400000.mtp: adopted the running RTKit session (4 retained buffers), apple-dart 24e808000.iommu bound (protect 0000001a/0000001a), all 3 MTP input devices registered (Apple MTP keyboard, Apple MTP multi-touch, Apple MTP multi-touch Force Click).
  • Dry-run S2R (apple_sleep.deep=1, untested_commit=0): reached apple-sleep 23b700000.sleep: dry run: every check passed; live MTP survived with 0 DART/MTP errors.
  • Committed S2R (untested_commit=1, rtcwake -d rtc1 -m mem -s 20): apple-sleep 23b700000.sleep: back from sleep, boot object resumes 0 -> 1, 162 of 213 AP pins changed by the sleep, all put back, PM: suspend exit. Live MTP survived committed deep sleep and resume with 0 24e808000.iommu / 24e400000.mtp / dockchannel-hid errors and all 3 MTP input devices intact.

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at exact head df442f67:

  • apple_dart_system_suspend() cleanly extends the existing live-MTP keep-alive path (device_set_awake_path(), live_mtp_sleep = true, stream 1 bypass check) to pm_suspend_via_firmware(), failing closed (-EIO) if bypass is not active.
  • apple_dart_sys_suspend_noirq() / apple_dart_sys_resume_noirq() skip runtime suspend/resume when dart->live_mtp_sleep is set, preventing a live-MTP refusal or inherited-DMA reset/invalidate.
  • apple_dart_system_resume() clears live_mtp_sleep and verifies stream 1 TCR bypass is still intact across sleep, failing closed (-EIO) otherwise.
  • Non-live-MTP DARTs and s2idle behavior are unchanged.

Hardware-verified on J613 (MacBook Air 13" M3, T8122) across 3/3 committed mem/deep cycles in addition to the J413 committed deep-sleep row above and the author's J615/J473 rows. CI is 19/19 green at df442f67.

satchlj added a commit to satchlj/linux that referenced this pull request Nov 28, 2026
Keep .untested = true and .display_no_restart = true on t8122_sleep_soc
so /sys/power/mem_sleep remains [s2idle] by default until all T8122
deep-sleep prerequisites (aurora-silicon#3425, aurora-silicon#3504, aurora-silicon#3445, aurora-silicon#3452) have landed and
27.2-firmware T8122 boards (J615) have a matching display sleep path.

With .untested and .display_no_restart preserved, default s2idle and
apple_sleep.deep=1 dry runs stay intact on both 26.6.2 (J613) and 27.2
(J615), while committed J613 deep sleep runs via apple_sleep.deep=1
apple_sleep.untested_commit=1.

Signed-off-by: Satya Benson <[email protected]>
@satchlj
satchlj merged commit 57418f6 into main Nov 28, 2026
22 checks passed
@satchlj
satchlj deleted the fix/dart-live-mtp-firmware-sleep branch November 28, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants