Skip to content

iommu: apple-dart: confine the T8132 radio's always-on SID16 bypass to the one page it needs - #2502

Draft
erikwb wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
erikwb:j713/radio-sid16-page
Draft

erikwb wants to merge 3 commits into
aurora-silicon:integration/aurorafrom
erikwb:j713/radio-sid16-page

Conversation

@erikwb

@erikwb erikwb commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On T8132, stream 16 of the radio's PCIe DART stays in bypass for the whole uptime. A bypassed stream can reach all of physical memory, and the RID-to-SID admission check can't tell which requester might be routed to it, so this is a standing hole in the radio's DMA isolation.

The bypass can't simply be turned off, because the radio does use the stream at runtime. Blocking it on a J713 made a write to 0x381204000 fault within seconds, after which Wi-Fi failed. That one 16 KiB page is all the stream needs.

Change

This series names that page in the DT (apple,sid16-page). When the property is present, the DART driver translates SID16 through a 3-level table that maps only that page, identity, instead of leaving it in bypass:

  • The narrowing happens at probe, after managed admission and before any radio DMA is set up, and validates dart->hw->type == DART_T8110, dart->num_streams > 16, dart->pgsize == SZ_16K, dart->oas >= 36 / dart->sid16_page < BIT_ULL(dart->oas), and restorable entry state (tcr_disabled without a valid root, or static bypass with bypass support) before allocating the table.
  • Before writing TTBR0 or TCR, apple_dart_managed_narrow_sid16() snapshots the inherited SID16 TCR, TTBR0, and ENABLE[16] state; it writes and verifies TTBR0 readback before switching TCR to TRANSLATE_ENABLE, verifies TCR readback, issues a SID16 TLB invalidation so no stale entry survives, and sets and verifies ENABLE[16].
  • On any probe error path after narrowing, apple_dart_managed_unnarrow_sid16() restores SID16 to its exact entry state: when ENABLE[16] started clear, it writes BIT(16) to DART_T8110_DISABLE_STREAMS and verifies ENABLE[16] cleared before restoring TCR (never leaving bypass enabled), then restores TCR (issuing dart->hw->tcr_bypass including the BYPASS_DAPF request bit for static bypass, or tcr_disabled) and checks exact TCR readback against sid16_init_tcr before restoring TTBR0 to its inherited value, verifies TTBR0 and ENABLE[16], flushes the SID16 TLB, and frees dart->sid16_ops only when every step succeeds (keeping the table unfreed if teardown fails). When teardown succeeds, a subsequent rebind admits cleanly instead of hitting -EBUSY.
  • After narrowing, apple_dart_managed_sid16_narrowed() (used by admission and the cold-link idle check) requires TCR, TTBR0, and ENABLE[16], so a stream that lost ENABLE[16] or went back to bypass is refused.
  • The TCR is plain TRANSLATE_ENABLE, so the existing deep-sleep snapshot/restore and the s2idle check replay and compare it exactly.
  • Without the property, behavior is unchanged.

The binding, driver (+ host selftest update), and DTS changes are separate commits, rebased onto integration/aurora (f5fae3cbb047). The property sits in t8132-jxxx.dtsi next to apple,managed-sids, so it covers every T8132 board with the radio port (J604, J623/J624, J713/J715, J773g). 0x381204000 sits 0x38000 bytes past aic's core window (0x381000000 + 0x1cc000) and below DRAM; no DT node claims it, so its owning SoC block is not identified in the DT yet. If another T8132 board's radio used a different SID16 target, the first access would fault and quarantine the radio DART, taking down Wi-Fi and BT for that boot.

Testing

  • J713 (MacBook Air 13-inch, M4, tested by @RyanTheTide — evidence for prior head 6ffeda54, before the integration/aurora rebase and rollback fixes):
    • Kernel 7.3.0-aurora-fleet81 (integration/aurora eb6d9ec1 + open heads including PR iommu: apple-dart: confine the T8132 radio's always-on SID16 bypass to the one page it needs #2502 at 6ffeda54), booted on the default command line with the J713's configured DTB.
    • Result: PASS: fdtget confirmed /soc/iommu@490000000 carries apple,sid16-page = <0x3 0x81204000>; dmesg logged apple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000 at 0.60 s; 0 DART faults across all 17 apple-dart fault handler interrupts; brcmfmac associated (VHT 2x2, 400 Mbit/s), gateway ping 5/5; Bluetooth powered and scanned 30 devices; rtcwake -d rtc1 -m freeze s2idle 1/1 pass with SID16 still narrowed and 0 DART faults; SELinux Enforcing, 0 AVC denials, 0 failed units, only the 2 pre-existing dwc3-apple ... genpd_prepare returns -11 error lines.
    • Earlier release/7.3.0-40 (9125b314) + test DT boot also carried 417 MB in / 419 MB out over Wi-Fi with 0 DART exceptions and confirmed SID16 TCR=0x1 with SID1/SID2 unchanged.
  • J715 (MacBook Air 15-inch, M4, Mac16,13, tested by @kazuhidet — evidence for prior head 6ffeda54, before the integration/aurora rebase and rollback fixes):
    • Kernel integration/aurora 0abc2f385 + apple-dart.c from 6ffeda54 and J715 DTB supplying apple,sid16-page = <0x3 0x81204000> on /soc/iommu@490000000.
    • Result: PASS (one boot, four records): apple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000, 0 DART faults, no quarantine or readback failure; wlan0 only interface up, gateway ping 5/5 in every record, 0 brcmfmac errors; Bluetooth controller powered and paired device connects; failed units and kernel errors unchanged vs baseline (not covered: s2idle/resume, BT audio, throughput).
  • Static checks & host tests (at 4744d692f905, base f5fae3cbb047):
    • make -j32 ARCH=arm64 LLVM=1 W=1 O=.tmp-build defconfig && make -j32 ARCH=arm64 LLVM=1 W=1 O=.tmp-build drivers/iommu/apple-dart.o: 0 errors, 0 warnings.
    • ./scripts/checkpatch.pl --strict --git origin/integration/aurora..HEAD: 0 errors, 0 warnings, 0 checks across all three commits.
    • python3 tools/asahi/run-host-tests.py --only apple-dart: 10/10 passed.
    • python3 tools/asahi/run-host-tests.py --only bcm4377-radio-sids: 1/1 passed (models write-one-to-clear DISABLE_STREAMS and T8132 non-retained BYPASS_DAPF request bit, verifies tcr_bypass restore command and exact TCR/TTBR0/ENABLE[16] readback across disabled and static-bypass 0x2/0x6 entry states, rejects unrestorable entry states before narrowing, verifies dropped TTBR0 write fails before enabling translation, verifies dropped ENABLE[16] write fails probe and rolls back, verifies cleared ENABLE[16] fails admission and cold-link idle check with -EBUSY, and verifies mismatched TCR readback or failed DISABLE_STREAMS/TCR/TTBR0/TLB-flush teardown keeps sid16_ops unfreed).
    • python3 tools/asahi/run-host-tests.py --only pciec-policy: 1/1 passed.
    • python3 scripts/dtc/apple-dart-pd-check-test.py: 13/13 passed.
  • DT schema & DTB checks (unchanged binding and DTS commits cherry-picked cleanly from 971399886047 and a3cf6c4ebeef):
    • make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/iommu/apple,dart.yaml and make CHECK_DTBS=y on the six T8132 DTBs (t8132-j604, t8132-j623, t8132-j624, t8132-j713, t8132-j715, t8132-j773g) passed on the identical binding and DTS commits (971399886047 and a3cf6c4ebeef).

Tested-by: @kazuhidet
Tested-by: @RyanTheTide

Still to run

Returning this PR to draft until the remaining hardware checks complete on the updated head (4744d692f905):

  • Re-verify J713 (and/or J715) on hardware at the updated head (4744d692f905) after the integration/aurora rebase and SID16 rollback updates (J713 and J715 results above are for prior head 6ffeda54).
  • One deep-sleep (suspend-to-RAM) cycle with SID16 narrowed on T8132 hardware (the sleep path snapshots and restores SID16 TCR and TTBR0 verbatim, not yet run on hardware).
  • Additional T8132 boards (J604, J623/J624, J773g) if available (J713 and J715 both confirm 0x381204000).

Assisted-by: LLM (Anthropic:Claude Opus 5.5, Google:Gemini 4 Neon, Google:Gemini 4 Hydrogen)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, closing the SID16 bypass is a real isolation win, and the register-dump evidence is great.

One placement question. Isolation policies like this are something we apply on every machine that has the hardware, never only where it was tested. apple,managed-sids on dart_apcie0 lives in t8132-jxxx.dtsi, which J604, J623/J624, J713/J715 and J773g all include, so they all keep SID16 in bypass, but the page is named only in t8132-j713.dts:280.

0x381204000 is below DRAM and is mapped IOMMU_MMIO, so it looks like an SoC address rather than a board one. If so, could the property move to t8132-jxxx.dtsi next to apple,managed-sids? If the page really differs per board or radio module, a comment saying why, plus the value on each board, would do it.

We don't have a T8132 in our lab, so a Wi-Fi/BT row from a J715 or J773g owner would close it.

@erikwb
erikwb force-pushed the j713/radio-sid16-page branch from 86026df to 6ffeda5 Compare November 20, 2026 04:23
@erikwb erikwb changed the title iommu: apple-dart: confine the J713 radio's always-on SID16 bypass to the one page it needs iommu: apple-dart: confine the T8132 radio's always-on SID16 bypass to the one page it needs Nov 20, 2026
@erikwb

erikwb commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of erikwb

Moved. apple,sid16-page now sits in t8132-jxxx.dtsi next to apple,managed-sids (6ffeda5), so all six T8132 boards get it. The commit messages and title now say T8132.

  • Agreed that it's an SoC address: 0x381204000 is below DRAM, next to the AIC range. Nothing in the radio path picks a per-board target, so I expect the same page on every board.
  • That is still inferred. It's verified only on the J713. If another board's radio used a different SID16 target, the first access would fault and quarantine the radio DART, so Wi-Fi and BT would fail for that boot. The PR description now says this.
  • All six DTBs pass CHECK_DTBS against apple,dart.yaml and carry the property. The J713 DTB decompiles identically to the one tested on hardware, so the J713 results still apply.

Agreed on a J715 or J773g Wi-Fi/BT row before merge.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for moving apple,sid16-page into t8132-jxxx.dtsi next to apple,managed-sids (6ffeda5), and for writing down in the description what happens if another board's radio uses a different page. That covers the placement question. What's left is the CI run that is still going and a Wi-Fi/BT row from a J715 or J773g owner.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train adversarial review (MERGETRAIN-LINUX2) at 6ffeda5: NO BLOCKERS.

Code read only, nothing built here. Before the merge it still needs Dj's verdict at this head; the missing rows are listed below.

Full review

#2502 iommu: apple-dart: confine the T8132 radio's always-on SID16 bypass to the one page it needs @6ffeda54

VERDICT: NO BLOCKERS in the code. Do not merge it before the J715/J604/J773g rows below are run.

Checked and found OK:

  • The table is never freed. dart is retained, so apple_dart_release() skips the kfree.
  • The TTBR is encoded the same way as apple_dart_hw_set_ttbr().
  • The deep-sleep power restore replays every SID's TCR and TTBR0 and flushes (apple-dart-sleep.c:498-507). The s2idle verify compares them exactly. The narrowed values never change, so both paths hold.
  • Quarantine only touches SID1/2 (apple-dart.c:2609). The narrowed SID16 is never reset.
  • The PTE gets NO_CACHE because IOMMU_CACHE is not passed (io-pgtable-dart.c:219), which is correct for an MMIO page.
  • 36-bit IAS with 16K pages gives 3 levels, matching the n_levels check.

Nits / risks:

  1. apple-dart.c:2534 + 6082: once SID16 is narrowed, a later probe failure leaves its TCR at TRANSLATE_ENABLE. Example: request_irq or sysfs fails, goto err_clk_disable, then a rebind. The new struct apple_dart has sid16_ops == NULL, so apple_dart_managed_admit() falls into the static-bypass branch, sees neither bypass nor disabled, and returns -EBUSY. The radio DART cannot probe again until reboot. Before this PR a rebind after quarantine was admitted. This is error path only, but worth either accepting a TCR==TRANSLATE_ENABLE whose TTBR matches a valid root, or documenting it.
  2. t8132-jxxx.dtsi:450: the address is an observation from J713 faults written into the shared T8132 include. It is not read from the ADT or the loader.
    • 0x381204000 sits just past the AIC node's "core" reg (0x381000000 + 0x1cc000), i.e. in the interrupt controller's address block.
    • The binding/comment should say what the page is, so a reviewer can judge giving a device RW on it.
    • Better: a phandle/offset into the owning node, or a loader-filled value from the ADT, instead of a raw u64 copied to all six boards.
    • The rule (safety limits come from the machine) is met only in letter: the value is in DT, but nobody derived it from this machine.
  3. The binding name apple,sid16-page hardcodes the stream number. That is acceptable only because the driver already hardcodes SID16 as the static role.
  4. PR body: ends with "Created with Claude Opus 5.5 in Claude Code" plus the Claude Code footer, not the house line "Assisted-by: LLM (Claude:Opus 5.5)". That is a body-only hygiene issue; the commits are clean.
  5. The driver was proven on pin 9125b31 with a test-only DT commit, not at this head on the integration tip (453 commits behind base). The installed Stage 2 DTB predates the property, so on lab Macs with a stale Stage 2 the feature is silently inactive (bypass kept). Check the live fdt before you count a row as proof.

Missing rows:

  • J715, J604, J773g, J623/J624 Wi-Fi + BT traffic with the property in the live DT. A different SID16 target on any of them means a SID16 fault, managed quarantine, and Wi-Fi/BT dead for that boot. That is a regression from today, on every board covered by jxxx.dtsi.
  • J713 at this head on the integration tip, with the property coming from the real Stage 2 DT (not a test commit).
  • Deep sleep (s2r) + resume with SID16 narrowed, on any T8132 machine. Not run.
  • s2idle snapshot verify with the narrowed stream.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Adversarial review against pre-pr-checklist.md at 6ffeda54eaa0.

Summary: 0 code, CI, attribution, or policy blockers. CI (dt-checks, host-tests) is green, all 3 commits carry human identity and Signed-off-by: only, and moving apple,sid16-page to t8132-jxxx.dtsi applies the narrowing uniformly across all T8132 boards with the radio port.

Checked

  • apple_dart_managed_narrow_sid16() maps a single 16 KiB IOMMU_READ | IOMMU_WRITE | IOMMU_MMIO (non-cacheable) page in a 3-level 36-bit APPLE_DART2 table, verifies iova_to_phys, writes TTBR before TCR = DART_T8110_TCR_TRANSLATE_ENABLE, and verifies readback.
  • Table lifetime is safe (apple_dart_retain_radio() sets dart->retained = true before narrowing, so apple_dart_release() never frees dart or the table), managed quarantine touches only SID1/SID2, and apple-dart-sleep.c snapshots/restores SID16 TCR and TTBR0 verbatim.
  • When apple,sid16-page is absent (older DTBs), behavior is unchanged; when present, a disabled SID16 is narrowed directly without ever entering bypass.

Non-blocking observations

  • Probe failure rebind edge case (drivers/iommu/apple-dart.c:2534, 6081): If probe fails after apple_dart_managed_narrow_sid16() succeeds (e.g., request_irq() or sysfs registration fails), hardware SID16 remains in TRANSLATE_ENABLE, while a subsequent rebind allocates a fresh struct apple_dart with sid16_ops == NULL and fails apple_dart_managed_admit() with -EBUSY until reboot.
  • Topology validation: apple,sid16-page is checked against SZ_16K and BIT_ULL(36) before DART_PARAMS are read; checking dart->pgsize == SZ_16K and dart->sid16_page < BIT_ULL(dart->oas) inside apple_dart_managed_narrow_sid16() would avoid assumptions if reused elsewhere.
  • Defensive TLB flush: Issuing a SID16 TLB invalidation after switching TCR from bypass/disabled to translate would remove the assumption that boot firmware never populated a SID16 TLB entry.
  • Page provenance (t8132-jxxx.dtsi:450): Documenting which SoC MMIO block owns 0x381204000 (just above AIC's 0x381000000+0x1cc000 window) would make the RW grant easier to audit.

Hardware/runtime evidence still owed (§5)

  • J713 on this head (6ffeda54eaa0) on integration/aurora with the real Stage 2 DTB supplying apple,sid16-page (not a cherry-pick onto 9125b314 with a test-only DT commit), including full regression counts (0 SELinux denials, 0 failed units, 0 new kernel errors).
  • Wi-Fi and Bluetooth traffic verification on at least one other T8132 board (J715, J604, J623/J624, or J773g) with apple,sid16-page active in the live FDT, confirming 0x381204000 matches across the SoC family without faulting/quarantining the radio DART.
  • s2idle snapshot verify and a deep-sleep suspend/resume cycle with narrowed SID16.

Assisted-by: LLM (Gemini 4 Neon)

@kazuhidet

Copy link
Copy Markdown

Wi-Fi/BT row from a J715 (MacBook Air 15-inch, M4, Mac16,13) at 6ffeda54, OS firmware 26.6.2, stage 1 → aura.

Build

Result: pass (one boot, four records)

Check Result
DT apple,sid16-page = <0x3 0x81204000> on /soc/iommu@490000000
DART apple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000. No quarantine or readback failure. 0 DART faults
Wi-Fi wlan0 the only interface up (Ethernet unplugged). Gateway ping 5/5 in every record. 0 brcmfmac errors
Bluetooth controller powered, the paired device connects
Failed units, kernel errors same as without this PR (two local services, avd -2, external DCP not handed over)

Not covered: s2idle/resume with the narrowed bypass, BT audio, and throughput.

@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Neon responding on behalf of erikwb

Thanks @kazuhidet for the J715 (Mac16,13, OS 26.6.2) verification row at 6ffeda54 — confirming apple,sid16-page = <0x3 0x81204000> narrows SID16 cleanly on a second T8132 board with Wi-Fi + Bluetooth active and 0 DART faults.

Updated the PR description with your J715 PASS row and credit (and replaced the old footer with a plain Assisted-by: line per @RyanTheTide's hygiene note; no commit changes on 6ffeda54eaa0). Remaining hardware rows are J713 on integration/aurora with the live Stage 2 DTB (plus regression counts), s2idle snapshot verify, and a deep-sleep cycle with narrowed SID16.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks @kazuhidet for the J715 row. It runs this head's driver with apple,sid16-page in the live DT, and it shows the page matches on a second T8132 board with Wi-Fi and Bluetooth up and no DART faults.

Two points from the earlier reviews are still open at 6ffeda54. Both are small:

  • If probe fails after apple_dart_managed_narrow_sid16() (apple-dart.c:6081-6088), SID16 stays in translate mode with the old table. A rebind then starts with sid16_ops == NULL and gets -EBUSY from apple_dart_managed_admit() (:2356) until reboot. Either admit a translating SID16 whose TTBR points at a valid root, or tear the narrowing down on the error path.
  • t8132-jxxx.dtsi:446-449 should say which block owns 0x381204000. It sits just past the AIC core range, and naming the block lets a reader judge the RW grant.

The remaining rows are the ones in "Still to run": J713 at this head with the property coming from the Stage 2 DTB, and an s2idle verify plus a deep-sleep cycle with SID16 narrowed.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

J713 row at 6ffeda5 (13-inch M4 Air, macOS 27.2 stub), for item 1 of the 11-22 review: the property comes from the J713's real Stage 2 DTB, with regression counts.

The kernel is 7.3.0-aurora-fleet81, the J713's default since 11-23. It is integration/aurora eb6d9ec plus open heads, including this PR at 6ffeda5, built with its DTBs. It booted on the default command line with the J713's configured Stage 2.

  • Live device tree: /soc/iommu@490000000 has apple,sid16-page = <0x3 0x81204000>. Read with fdtget from the booted FDT.
  • dmesg: apple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000 at 0.60 s.
  • DART faults: the 17 apple-dart fault handler interrupts on AIC2 54-63 all count 0, read after an s2idle cycle. There are no DART fault lines in dmesg.
  • Wi-Fi: brcmfmac associated (VHT 2x2, 400 Mbit/s), and the gateway answered 5/5 pings.
  • Bluetooth: the controller is powered and its scan found 30 devices.
  • s2idle: rtcwake -d rtc1 -m freeze 1/1, woke on the alarm, suspend_stats fail 0. SID16 stayed narrowed and there were no DART lines afterwards.
  • Counts: SELinux Enforcing, 0 AVC denials, 0 failed units. The 2 kernel error lines are the existing dwc3-apple ... genpd_prepare returns -11 refusals during s2idle; the previous default has them too.

Still to run: one deep-sleep cycle with SID16 narrowed. The two small code points from 11-22 17:12 (the narrowing left in place on a failed probe, and naming the block that owns 0x381204000) are also still open.

Assisted-by: LLM (Claude:Opus 5.5)

The T8132 radio DART's SID16 keeps a static bypass for the whole uptime,
but only needs to reach one page. Let the DT name that page so the OS
can translate the stream through a table that maps only it.

Signed-off-by: Erik Bourget <erik@ebourget.net>
The radio DART's SID16 keeps the static bypass role it gets at boot for
the whole uptime. A bypassed stream reaches all of physical memory, and
the RID-to-SID admission cannot see which requester could be routed to
it. At runtime the stream only writes one page: blocking it outright
makes that write fault and the radio fail.

When the DT names that page in apple,sid16-page, translate SID16 through
a 3-level table that maps only it, identity, after admission and before
any radio DMA is set up. Admission and the cold-link idle check accept
the narrowed stream; the sleep snapshot and restore already carry its
TCR and TTBR. Without the property the bypass is kept as before.

Signed-off-by: Erik Bourget <erik@ebourget.net>
On the J713 the radio DART's static SID16 stream only writes the SoC
page at 0x381204000. Name it in the shared T8132 board include, next to
apple,managed-sids, so the DART driver replaces the stream's bypass
with a one-page table on every board that has the radio port.

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

RyanTheTide commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Deep-sleep item at 6ffeda5 (J713, 13-inch M4 Air): 3 deep sleeps with SID16 narrowed.

The kernel is 7.3.0-aurora-fleet82: integration/aurora f5fae3c plus open heads, including this PR at 6ffeda5 unchanged. It booted as a one-shot on the default command line with the live Stage 2 DTB. dmesg had SID16 bypass narrowed to page 0x381204000 at boot.

  • 3 × rtcwake -d rtc1 -m mem -s 15, each a PM: suspend entry (deep). suspend_stats +3 successes, 0 failures.
  • After every wake:
    • The apple-dart fault handler interrupts summed over all CPUs stayed at 0.
    • Wi-Fi reassociated and the gateway answered 3/3 pings.
    • Bluetooth scanned 13 to 28 devices.
  • The same boot also ran 12 s2idle cycles and a WoWLAN magic-packet wake, again with no DART fault interrupts.

Assisted-by: LLM (Claude:Opus 5.5)

@erikwb
erikwb force-pushed the j713/radio-sid16-page branch from 6ffeda5 to 4744d69 Compare November 22, 2026 19:23
@erikwb
erikwb marked this pull request as draft November 22, 2026 19:25
@erikwb

erikwb commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Gemini 4 Hydrogen responding on behalf of erikwb

Updated the PR to 4744d692f905 (rebased onto integration/aurora f5fae3cbb047, driver/selftest commit f8accf4e6b8a) and keeping it in draft until the updated-head hardware run and deep-sleep cycle complete. Note that @RyanTheTide's J713 7.3.0-aurora-fleet81 row (s2idle, Wi-Fi, BT, 0 AVC denials, 0 failed units) and @kazuhidet's J715 run remain evidence for prior head 6ffeda54, not 4744d692f905.

Changes addressing the re-review points:

  • SID16 admission, narrowing, and rollback (drivers/iommu/apple-dart.c):
    • apple_dart_managed_narrow_sid16() now rejects unrestorable entry states before narrowing (dart->hw->type != DART_T8110, dart->num_streams <= 16, already-narrowed sid16_ops, tcr_disabled with a valid root, static bypass without supports_bypass/tcr_bypass, or unexpected TCR modes) and verifies TTBR0 readback before writing TCR to DART_T8110_TCR_TRANSLATE_ENABLE (so a dropped TTBR0 write never enables translation against an inherited root).
    • apple_dart_managed_unnarrow_sid16() issues dart->hw->tcr_bypass (including the DART_T8110_TCR_BYPASS_DAPF request bit, rather than re-writing a 0x2 readback) when restoring static bypass while checking exact TCR readback against sid16_init_tcr, restores TTBR0 to its inherited value, verifies TTBR0 and ENABLE[16], flushes SID16's TLB, and frees dart->sid16_ops only when every check succeeds.
  • bcm4377-radio-sids.py host test (tools/testing/selftests/drivers/apple/bcm4377-radio-sids.py): Models both write-one-to-clear DISABLE_STREAMS and T8132's non-retained DART_T8110_TCR_BYPASS_DAPF request bit on DART_TCR writes, verifies last_sid16_tcr_write == hw->tcr_bypass with exact 0x2/0x6 readback across disabled and static-bypass entry states, tests rejection of unrestorable entry states before narrowing, tests a dropped TTBR0 write during narrowing (verifying TRANSLATE_ENABLE is never written), and verifies mismatched TCR readback or failed DISABLE_STREAMS/TCR/TTBR0/TLB-flush teardown keeps sid16_ops unfreed.
  • 0x381204000 block provenance (arch/arm64/boot/dts/apple/t8132-jxxx.dtsi): Updated the &dart_apcie0 comment to note what is observed: 0x381204000 sits 0x38000 bytes past aic's core window (0x381000000 + 0x1cc000) and below DRAM, and no DT node in t8132.dtsi claims it yet.

Explicit limits and open question:

  • Owner of 0x381204000 remains unknown: the page was identified empirically by blocking SID16 on J713 (which immediately faulted writing 0x381204000) and confirmed on J715 with 0 faults, so the open question of which SoC block owns 0x381204000 remains open for DT attribution once identified.
  • Rebind behavior after failed rollback: if apple_dart_managed_unnarrow_sid16() fails, it leaves sid16_ops unfreed so hardware cannot walk a freed table, and failures that leave TCR in translation (such as failed DISABLE_STREAMS clear or failed TCR restore) or leave a valid TTBR0 with TCR disabled cause a subsequent rebind's apple_dart_managed_admit() to return -EBUSY. If TCR, TTBR0, and ENABLE[16] were all restored (for instance, if only the final TLB flush fails), apple_dart_managed_admit() inspects only live hardware registers and accepts the restored stream (while the prior sid16_ops remains unfreed). Likewise, when TCR is restored to static bypass (0x2 or 0x6), apple_dart_managed_admit() only inspects TTBR0 in the tcr_disabled branch, so it can still accept static bypass even when TTBR0 restoration fails (with the prior sid16_ops remaining unfreed).

Verified at 4744d692f905: checkpatch.pl --strict passes (0 errors, 0 warnings, 0 checks across all 3 commits), make -j32 ARCH=arm64 LLVM=1 W=1 O=.tmp-build defconfig && make -j32 ARCH=arm64 LLVM=1 W=1 O=.tmp-build drivers/iommu/apple-dart.o builds cleanly, run-host-tests.py passes apple-dart (10/10), bcm4377-radio-sids (1/1), and pciec-policy (1/1), and scripts/dtc/apple-dart-pd-check-test.py passes (13/13). Remaining before leaving draft: re-verify J713/J715 on 4744d692f905 and run one deep-sleep (suspend-to-RAM) cycle with SID16 narrowed.

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.

4 participants