Skip to content

iommu/apple-dart: allow runtime CIO DART power cycles - #3320

Merged
RyanTheTide merged 4 commits into
mainfrom
feat/apple-dart-cio-runtime
Nov 29, 2026
Merged

RyanTheTide merged 4 commits into
mainfrom
feat/apple-dart-cio-runtime

Conversation

@erikwb

@erikwb erikwb commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What: Factor the CIO DART power-cycle preparation in apple_dart_cio_prepare() into a shared helper and export apple_dart_cio_prepare_runtime() so runtime power-gating consumers (such as external display processors powering down while idle) can run the same save/disable/restore/reopen lifecycle outside PM_SUSPEND_MEM, while keeping apple_dart_cio_prepare() restricted to PM_SUSPEND_MEM.
Tested: J313 (M1 MacBook Air, T8103) Group A boot at 36a97130f2c5 (merged onto main ee36fbdcd1c8, all 4 changed PR files verified byte-identical): smoke pass, DPMS off/on x3 PASS, deep S2R x2 PASS, 16 MB RAM integrity PASS, 0 Oops/BUG/WARN (same Group A boot saw an unisolated ISP capture failure -19/DART fault after the first deep-S2R resume, whereas baseline main captured successfully after its first deep-S2R resume and became unreachable after its second deep-S2R cycle, cause unisolated; s2idle hard-resets J313 on baseline main). J713 (M4 MacBook Air, T8132, firmware 27.2) at 36a97130f2c5 in batched candidate b3dbf237542b: boot, 3x DPMS off/on and 3x s2idle clean, 0 DART/CIO faults, 0 failed units (#3321 external DCP idle-off inactive on 27.2). Host builds, KUnit (io-pgtable-dart 31/31), and selftests pass at 36a97130f2c5.
Risk: two-way door · Apple Silicon CIO DART consumers (drivers/iommu/apple-dart-cio.c + include/linux/soc/apple/dart-cio.h across M1-M5: pcie-apple-cio.c, apple-cio-sleep.c, iomfb_m4.c); existing apple_dart_cio_prepare() behavior is unchanged.
Revert: git revert -m 1 <merge_commit> on main (or revert 36a97130f2c5, 50257ff52fd4, and 628ceb95daef in reverse order). Kernel driver, header, and host-test changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.
Not yet: Current-head 26.6.2-firmware external-DCP runtime CIO DART power-cycle evidence showing that the CIO DART reopens and a working external display returns after idle power-off (via stacked PR #3321 feat/iomfb-m4-ext-idle-off; the lab J713 runs 27.2 firmware, where that consumer is inactive); isolating the Group A post-first-S2R ISP capture failure (-19/DART fault) on J313 (left unisolated because J313 became unreachable after the second deep-S2R cycle on baseline main and awaits physical recovery; note also that s2idle hard-resets J313 on baseline main).

Details
  • Extracts apple_dart_cio_prepare_common(struct apple_dart_cio *s) from apple_dart_cio_prepare().
  • Exports apple_dart_cio_prepare_runtime(struct apple_dart_cio *state) in include/linux/soc/apple/dart-cio.h (with -EOPNOTSUPP inline stub when CONFIG_APPLE_DART is disabled) and documents its synchronization against suspend/removal paths and apple_dart_cio_finish() cleanup obligations.
  • apple_dart_suspend() and apple_dart_resume() already skip DART MMIO whenever cio_active is set, so runtime-prepared CIO DARTs stay safely powered off across system suspend and resume until the consumer calls apple_dart_cio_on() / apple_dart_cio_finish().
  • Cleanly merged main (aa3351bc8e6f) into feat/apple-dart-cio-runtime at 830ce303e977 (0 conflicts, signed off) to carry 27.2 internal-DCP support for stacked PR drm/apple: m4: power down idle external DCPs at runtime #3321.
Evidence
  • J313 (M1 MacBook Air, T8103) Group A boot (main ee36fbdcd1c8 + #3085, #3290, #3329, #3333, #3495, #3506, #3546, #3289, #3320, 2026-11-28):
    • Kernel SHA-256: 888c041944da96032a9252504c4d5543b906fd98717234eca5e091150af85798
    • Trial Stage 2 image SHA-256: 949dc089ed390b7535dd5ef2a6e99975c3026658e58dbd9d17e9b20d2bbb7d71
    • Byte parity: all 4 changed files of #3320 (36a97130f2c5) verified byte-identical against #3320 merged alone onto main (ee36fbdcd1c8).
    • Smoke & sleep: boot smoke PASS (eDP-1 connected/enabled, input, networking, audio enumeration, Borealis compute/render checks, 0 AVC denials; one baseline failed unit speakerguardd-v2-switchtest.service also present on baseline main ee36fbdcd1c8); DPMS off/on x3 PASS (dpmsStatus, backlight 0 -> 130); deep S2R (rtcwake -d rtc1 -m mem -s 30) x2 PASS (0 -> 2), 16 MB RAM integrity PASS, 0 Oops/BUG/WARN.
    • Caveats: the same Group A boot saw an ISP capture failure (apple-isp firmware boot -19 / DART translation fault) after the first deep-S2R resume; on baseline main (ee36fbdcd1c8, kernel SHA-256 f750b04aebd30c439edbd3b995c17b3fd9ad805a4561dadc7ecbf78040c89289), ISP capture worked after the first deep-S2R resume, and J313 became unreachable after the second baseline main deep-S2R cycle (cause remains unisolated; awaiting physical recovery), leaving the Group A ISP failure unisolated. Also, s2idle hard-resets J313 on baseline main and on the undocked daily kernel (while docked, the daily kernel — not baseline main — refuses suspend with -16 from the Thunderbolt NHI), so deep S2R with RTC wake is the working sleep path on J313.
  • J713 (M4 MacBook Air, T8132, firmware 27.2) at 36a97130f2c5 in batched candidate b3dbf237542b (main 9e38a276dcb4, default cmdline): boot, 3x real DPMS off/on and 3x s2idle completed with 0 DART/CIO faults or errors and 0 failed units. git diff 36a97130f2c5..b3dbf237542b -- drivers/iommu/apple-dart-cio.c include/linux/soc/apple/dart-cio.h tools/asahi/dart-cio-owner-tests.c tools/asahi/dart-cio-owner-tests.py is empty (all 4 files byte-identical to 36a97130f2c5).
  • make O=_build_3320 ARCH=arm64 LLVM=1 W=1 drivers/iommu/apple-dart.o (defconfig + asahi.config) at 36a97130f2c5 — 0 errors, 0 warnings (apple-dart-cio.c is included by apple-dart.c).
  • python3 tools/asahi/dart-cio-owner-tests.py at 36a97130f2c5 — PASS 35 CIO DART ownership cases, PASS 14 negative controls.
  • python3 tools/asahi/apple-dart-range-tests.py, python3 tools/asahi/dart-sleep-writer-tests.py, python3 tools/testing/selftests/drivers/apple/bcm4377-radio-sids.py at 36a97130f2c5 — PASS.
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --make_options LLVM=1 --kunitconfig=drivers/iommu/io-pgtable-dart.kunitconfig at 36a97130f2c5 — 31 passed, 0 failed.
  • ./scripts/checkpatch.pl --strict --git aa3351bc8e6f..36a97130f2c5 — 628ceb95daef 0 errors/0 warnings/0 checks; 50257ff52fd4 0 errors, 1 pre-existing warning (Missing commit description); 36a97130f2c5 0 errors, 1 commit-body line-length warning; git diff --check clean.
  • git merge-tree --write-tree 36a97130f2c5 origin/main (ee36fbdcd1c8) — clean (8d7e070a3c48), 0 conflicts.
  • CI at 36a97130f2c5: 22/22 checks passed (apple-build, host-tests, kunit, 16 KUnit suites, pr-text, readiness).

apple_dart_cio_prepare() restricts CIO DART power cycles to
PM_SUSPEND_MEM because existing callers only ran during deep sleep.
External display processors that power down while idle at runtime need
the same save/disable/restore/reopen lifecycle outside system suspend,
while apple_dart_suspend() and apple_dart_resume() already skip DART
MMIO whenever cio_active is set.

Factor the shared preparation logic into apple_dart_cio_prepare_common()
and export apple_dart_cio_prepare_runtime() for runtime power-gating
consumers, keeping the PM_SUSPEND_MEM check on apple_dart_cio_prepare().

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb requested review from a team as code owners November 26, 2026 22:06
@erikwb
erikwb requested review from LiamRay11 and malik-na November 26, 2026 22:06
@github-actions github-actions Bot added door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Merge readiness at 36a97130: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
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 36a97130
Conflicts ok none
PR text ok Risk: two-way · Apple Silicon CIO DART consumers (drivers/iommu/apple-dart-cio.c + include/linux/soc/apple/dart-cio.h across M1-M5: pcie-apple-cio.c, apple-cio-sleep.c, iomfbm4.c); existing appledartcioprepare() behavior is unchanged. Revert: git revert -m 1 <merge_commit> on main (or revert 36a97130f2c5, 50257ff52fd4, and 628ceb95daef in reverse order). Kernel driver, header, and host-test changes only; no persistent on-disk, ESP, Stage 2, or DT state is modified.

Areas: area:gpu

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

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 26, 2026
…ommon

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb
erikwb requested a review from DjDeveloperr as a code owner November 27, 2026 02:15
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 27, 2026

@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: Code approved at 50257ff52fd4. Runtime hardware evidence remains open.

Checked: The suspend wrapper still rejects prep outside suspend-to-RAM. The runtime wrapper requires the same bound owner and takes the same writer-close, register-save and provider-reference path. I ran the exact-head owner harness here: 35 ownership cases and 14 negative controls passed. Hosted Apple build, KUnit and host tests pass.

Before merge, attach the current-head 26.6.2 external DCP runtime power-cycle row, including reopen and a working display after idle power-off.

Signed-off-by: Erik Bourget <erik@ebourget.net>
Document the caller's serialization and cleanup obligations on apple_dart_cio_prepare_runtime().

Signed-off-by: Erik Bourget <erik@ebourget.net>
@erikwb

erikwb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Updated feat/apple-dart-cio-runtime to 36a97130f2c5:

  • Re-signed the forward merge of main (aa3351bc8e6f) at 830ce303e977 (50257ff52fd4 remains first parent, so it strictly fast-forwards the published head) with Signed-off-by: Erik Bourget <erik@ebourget.net>.
  • Added a concise doc comment at include/linux/soc/apple/dart-cio.h on apple_dart_cio_prepare_runtime() (36a97130f2c5) documenting that it drops the PM_SUSPEND_MEM check, leaves a successful transaction active until apple_dart_cio_finish(), and requires callers to serialize against suspend/removal paths and call finish() on every exit.

At 36a97130f2c5, drivers/iommu/apple-dart.o (ARCH=arm64 LLVM=1 W=1, 0 warnings), tools/asahi/dart-cio-owner-tests.py (35 ownership cases, 14 negative controls), tools/asahi/apple-dart-range-tests.py, tools/asahi/dart-sleep-writer-tests.py, tools/testing/selftests/drivers/apple/bcm4377-radio-sids.py, and io-pgtable-dart KUnit (31/31) all pass.

J713 (M4 MacBook Air, T8132, firmware 27.2) at 36a97130f2c5 in batched candidate b3dbf237542b on main 9e38a276dcb4: boot, 3× real DPMS off/on and 3× s2idle are clean, with 0 DART/CIO faults or errors and 0 failed units.

The on-device 26.6.2-firmware external DCP runtime CIO DART power-cycle row remains open under **Not yet:**.

@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.

The follow-up documents the runtime transaction's serialization and finish requirements. Reviewed the signed forward merge and the current-head owner harness and J713 DPMS/s2idle report. Code approved. The external DCP runtime CIO DART power cycle on 26.6.2 remains the landing hold.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-hw-row No hardware row at the PR head (bot) labels Nov 27, 2026
@erikwb

erikwb commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledged the code approval at 36a97130f2c5.

Updated the PR body with **Revert:**, byte-identical verification (git diff empty) for all four PR files in candidate b3dbf237542b, and refreshed offline verification at 36a97130f2c5:

  • drivers/iommu/apple-dart.o (ARCH=arm64 LLVM=1 W=1): 0 errors, 0 warnings.
  • io-pgtable-dart KUnit: 31 passed, 0 failed.
  • tools/asahi/dart-cio-owner-tests.py (35 cases + 14 negative controls), apple-dart-range-tests.py, dart-sleep-writer-tests.py, and bcm4377-radio-sids.py: PASS.
  • git merge-tree --write-tree 36a97130f2c5 origin/main (ee36fbdcd1c8): clean with 0 conflicts and no upstream changes to the four PR files.
  • CI checks at 36a97130f2c5: all 22 checks pass (gh pr checks), superseding the earlier cancelled pr-text and readiness runs.

2026-11-28 J313 (M1 MacBook Air, T8103) Group A hardware verification:

  • Kernel SHA-256 888c041944da96032a9252504c4d5543b906fd98717234eca5e091150af85798, trial Stage 2 image SHA-256 949dc089ed390b7535dd5ef2a6e99975c3026658e58dbd9d17e9b20d2bbb7d71; all 4 changed PR files verified byte-identical against #3320 (36a97130f2c5) merged alone onto main (ee36fbdcd1c8).
  • Boot smoke PASS, DPMS off/on x3 PASS, deep S2R x2 PASS (0 -> 2), 16 MB RAM integrity PASS, 0 Oops/BUG/WARN, 0 AVC denials (one baseline failed unit speakerguardd-v2-switchtest.service also present on baseline main).
  • Caveats: ISP capture failed (apple-isp firmware boot -19 / DART translation fault) after the first deep-S2R resume in Group A; on baseline main (ee36fbdcd1c8), capture worked after the first deep-S2R resume, and J313 became unreachable after the second baseline main deep-S2R cycle (cause remains unisolated; awaiting physical recovery), leaving the Group A ISP failure unisolated. Also, s2idle hard-resets J313 on baseline main and on the undocked daily kernel (while docked, the daily kernel — not baseline main — refuses suspend with -16 from the Thunderbolt NHI), so deep S2R with RTC wake is the working sleep path there.

Open items remain tracked under **Not yet:**: current-head 26.6.2-firmware external-DCP evidence that the CIO DART reopens and a working external display returns after idle power-off (via stacked #3321), and isolating the Group A post-first-S2R ISP capture failure once J313 is physically recovered.

@github-actions github-actions Bot added blast:m1 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) labels Nov 28, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

code-owner ping @DjDeveloperr: closeout merge at 36a97130. The App approved at this head, and REVIEW6 confirmed that the runtime hold belongs to #3321 (now retargeted to main). apple_dart_cio_prepare_runtime() has no in-tree caller until #3321, and prepare() is unchanged. Rows J313 (T8103) and J713 (T8132) at this head, CI green. Merging under the 6-point rule 1 h from now unless you object.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging under the 6-point rule (Ryan 09:29, permanent), at 36a97130. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J313+J713@head;no-caller-until-3321. (5) There's no blocking review. (6) Dj was pinged here 60 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit 694a5fb into main Nov 29, 2026
23 of 26 checks passed
@RyanTheTide
RyanTheTide deleted the feat/apple-dart-cio-runtime branch November 29, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:gpu Area from CODEOWNERS (bot) blast:m1 Macs affected, from Merge risk (bot) blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (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