Repository navigation
iommu: apple-dart: confine the T8132 radio's always-on SID16 bypass to the one page it needs - #2502
Conversation
|
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. 0x381204000 is below DRAM and is mapped We don't have a T8132 in our lab, so a Wi-Fi/BT row from a J715 or J773g owner would close it. |
86026df to
6ffeda5
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of erikwb Moved.
Agreed on a J715 or J773g Wi-Fi/BT row before merge. |
|
Thanks for moving |
|
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 @6ffeda54VERDICT: NO BLOCKERS in the code. Do not merge it before the J715/J604/J773g rows below are run. Checked and found OK:
Nits / risks:
Missing rows:
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
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 KiBIOMMU_READ | IOMMU_WRITE | IOMMU_MMIO(non-cacheable) page in a 3-level 36-bitAPPLE_DART2table, verifiesiova_to_phys, writesTTBRbeforeTCR = DART_T8110_TCR_TRANSLATE_ENABLE, and verifies readback.- Table lifetime is safe (
apple_dart_retain_radio()setsdart->retained = truebefore narrowing, soapple_dart_release()never freesdartor the table), managed quarantine touches onlySID1/SID2, andapple-dart-sleep.csnapshots/restores SID16TCRandTTBR0verbatim. - When
apple,sid16-pageis 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 afterapple_dart_managed_narrow_sid16()succeeds (e.g.,request_irq()or sysfs registration fails), hardware SID16 remains inTRANSLATE_ENABLE, while a subsequent rebind allocates a freshstruct apple_dartwithsid16_ops == NULLand failsapple_dart_managed_admit()with-EBUSYuntil reboot. - Topology validation:
apple,sid16-pageis checked againstSZ_16KandBIT_ULL(36)beforeDART_PARAMSare read; checkingdart->pgsize == SZ_16Kanddart->sid16_page < BIT_ULL(dart->oas)insideapple_dart_managed_narrow_sid16()would avoid assumptions if reused elsewhere. - Defensive TLB flush: Issuing a SID16 TLB invalidation after switching
TCRfrom 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 owns0x381204000(just above AIC's0x381000000+0x1cc000window) would make the RW grant easier to audit.
Hardware/runtime evidence still owed (§5)
- J713 on this head (
6ffeda54eaa0) onintegration/aurorawith the real Stage 2 DTB supplyingapple,sid16-page(not a cherry-pick onto9125b314with 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, orJ773g) withapple,sid16-pageactive in the live FDT, confirming0x381204000matches 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)
|
Wi-Fi/BT row from a J715 (MacBook Air 15-inch, M4, Mac16,13) at Build
Result: pass (one boot, four records)
Not covered: s2idle/resume with the narrowed bypass, BT audio, and throughput. |
|
Note 🤖 Gemini 4 Neon responding on behalf of erikwb Thanks @kazuhidet for the J715 ( Updated the PR description with your J715 PASS row and credit (and replaced the old footer with a plain |
|
Thanks @kazuhidet for the J715 row. It runs this head's driver with Two points from the earlier reviews are still open at
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) |
|
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.
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>
|
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
Assisted-by: LLM (Claude:Opus 5.5) |
6ffeda5 to
4744d69
Compare
|
Note 🤖 Gemini 4 Hydrogen responding on behalf of erikwb Updated the PR to Changes addressing the re-review points:
Explicit limits and open question:
Verified at |
|
Thanks for the rework. Both points from the earlier review are addressed at
I went through the new admission and rollback code and found no gaps:
The J713 and J715 rows are all at Assisted-by: LLM (Claude:Opus 5.5) |
|
Note 🤖 Gemini 4 Neon responding on behalf of erikwb Live J713 (M4 MacBook Air, T8132) hardware verification at head
Keeping the PR in draft until both default-command-line deep sleep on J713 (after #2189 lands) and a J715 rerun at |
|
Thanks, that's the J713 row at 4744d69 I asked for. SID16 is narrowed at boot, Wi-Fi and BT work, s2idle and deep sleep resume with Wi-Fi/BT back, the radio fault state is clean, and there are 0 DART faults and 0 new kernel errors. Approved from my side. As you say, the deep-sleep leg used the J713 display flags until #2189 lands, so a default-command-line deep sleep after that is the last check. Assisted-by: LLM (Claude:Opus 5.5) |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 re-review at 4744d692f905.
All §1–§6 criteria and prior review observations are cleanly satisfied, CI is 2/2 green (host-tests, dt-checks), and the branch is MERGEABLE CLEAN:
- §1 No model gating:
apple,sid16-pageis DT-driven (Documentation/devicetree/bindings/iommu/apple,dart.yaml) and placed in sharedarch/arm64/boot/dts/apple/t8132-jxxx.dtsinext toapple,managed-sids, covering all six T8132 boards uniformly with zero chip/board gates indrivers/iommu/apple-dart.cand preserving existing bypass behavior when the property is absent. - §2 Production-ready: Works on the default kernel command line with no new cmdline/module parameters;
t8132-jxxx.dtsidocuments what is currently known about0x381204000. - §3 Safety:
apple_dart_managed_narrow_sid16()validates DART type/geometry (DART_T8110,num_streams > 16,ttbr_count == 1,SZ_16K,oas >= 36,sid16_page < BIT_ULL(oas)) and rejects unrestorable entry states before allocating the table or touching registers, verifiesTTBR0readback before writingTCR = TRANSLATE_ENABLE, flushes SID16's TLB, and verifiesENABLE[16]in narrowing, admission, and the cold-link idle check. On any post-narrowing probe failure (afterapple_dart_free_irq()),apple_dart_managed_unnarrow_sid16()disablesENABLE[16]before restoringTCRwhen initially disabled, restorestcr_bypass/tcr_disabledandTTBR0with exact readback and TLB flush checks, and keepssid16_opsunfreed on any teardown failure. - §4 Attribution: All 3 commits (
971399886047,f8accf4e6b8a,4744d692f905) carry human author/committer (Erik Bourget) and humanSigned-off-by:only, with zero agent trailers; PR body ends withAssisted-by:. - §5 Evidence: Live J713 hardware verification at current head
4744d692f905onintegration/aurora(f5fae3cbb047): default-cmdline cold boot + Wi-Fi + BT +s2idlePASS (0 failed units, 0 DART faults, 0 new kernel errors) and deep sleep (rtcwake -m mem -s 15) PASS with cleanj713_radio_fault_state, Wi-Fi/BT recovery, and 0 DART faults — complemented by Ryan's J713fleet81(SELinux Enforcing, 0 AVC) /fleet82(3× default-cmdline deep sleep + 12× s2idle + WoWLAN) andkazuhidet's J715 (Mac16,13) row confirming0x381204000on a second T8132 board, plus expandedbcm4377-radio-sids.py,checkpatch --strict(0/0/0), andW=1LLVM arm64 compile.
Ready for MERGETRAIN-LINUX4. Non-blocking follow-ups: default-cmdline J713 deep-sleep recheck once #2189 lands, J715 rerun on 4744d692f905, and DT block attribution for 0x381204000 once identified.
Assisted-by: LLM (Gemini 4 Neon)
180f1e3
into
aurora-silicon:integration/aurora
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
0x381204000fault 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: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_disabledwithout a valid root, or static bypass with bypass support) before allocating the table.TTBR0orTCR,apple_dart_managed_narrow_sid16()snapshots the inherited SID16TCR,TTBR0, andENABLE[16]state; it writes and verifiesTTBR0readback before switchingTCRtoTRANSLATE_ENABLE, verifiesTCRreadback, issues a SID16 TLB invalidation so no stale entry survives, and sets and verifiesENABLE[16].apple_dart_managed_unnarrow_sid16()restores SID16 to its exact entry state: whenENABLE[16]started clear, it writesBIT(16)toDART_T8110_DISABLE_STREAMSand verifiesENABLE[16]cleared before restoringTCR(never leaving bypass enabled), then restoresTCR(issuingdart->hw->tcr_bypassincluding theBYPASS_DAPFrequest bit for static bypass, ortcr_disabled) and checks exactTCRreadback againstsid16_init_tcrbefore restoringTTBR0to its inherited value, verifiesTTBR0andENABLE[16], flushes the SID16 TLB, and freesdart->sid16_opsonly when every step succeeds (keeping the table unfreed if teardown fails). When teardown succeeds, a subsequent rebind admits cleanly instead of hitting-EBUSY.apple_dart_managed_sid16_narrowed()(used by admission and the cold-link idle check) requiresTCR,TTBR0, andENABLE[16], so a stream that lostENABLE[16]or went back to bypass is refused.TRANSLATE_ENABLE, so the existing deep-sleep snapshot/restore and the s2idle check replay and compare it exactly.The binding, driver (+ host selftest update), and DTS changes are separate commits, rebased onto
integration/aurora(f5fae3cbb047). The property sits int8132-jxxx.dtsinext toapple,managed-sids, so it covers every T8132 board with the radio port (J604,J623/J624,J713/J715,J773g).0x381204000sits0x38000bytes pastaic'scorewindow (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
4744d692f905, basef5fae3cbb047):7.3.0-sid16-4744+built from J713's running config withapple/t8132-j713.dtb, booted via one-shot Stage 2 (aura-try), confirming/proc/device-tree/soc/iommu@490000000/apple,sid16-page=00000003 81204000.s2idle(default command lineroot=UUID=... user4k=on loglevel=4 console=tty0): PASS:dmesgloggedapple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000.wlan0, BCM4388/6) associated,iw dev wlan0 scansucceeded, and gateway ping passed 3/3 (0% loss,3.55–4.49 ms).hci0,hci_bcm4377)bluetoothctl --timeout 10 scan ondiscovered active LE devices.rtcwake -d rtc1 -m freeze -s 10(s2idle) exited0(PM: suspend entry (s2idle)->PM: suspend exit); post-resume gateway ping passed 3/3 andiw dev wlan0 scansucceeded.systemctl --failed: 0 failed units; SELinux: N/A (Arch ARM without SELinux); 0 DART translation faults, 0 TLB errors, 0brcmfcrashes, 0 new kernel errors.integration/aurora(f5fae3cbb047), deep sleep (mem) on the default command line is refused byapple-sleepbecause J713 internal DCP (30ae00000.dcp) andaurora-g16do not bind withoutapple_dart.j713_dcp=1 apple_dart.j713_display=1(pending iommu: apple-dart: adopt T8132 internal display DARTs by default on 26.6.2 firmware #2189).apple_dart.j713_dcp=1 apple_dart.j713_display=1): PASS:dmesgloggedapple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000; internal DCP (30ae00000.dcp) andaurora-g16bound (/dev/dri/renderD128active).rtcwake -d rtc1 -m mem -s 15(deep sleep) exited0:pcie-apple 1cb0000000.pcie: native radio DMA fenced, DART off,apple-sleep 380700000.sleep-controller: back from sleep, boot object resumes 0 -> 1(PMU RTC alarm),pcie-apple 1cb0000000.pcie: native radio power-loss recovery complete,pcie-apple 1cb0000000.pcie: native radio transaction complete.wlan0passed 5/5 (0% loss,2.72–4.35 ms),iw dev wlan0 scansucceeded, andbluetoothctl --timeout 10 scan ondiscovered active LE devices./sys/devices/platform/soc/490000000.iommu/j713_radio_fault_state:version=0x202 managed=0x6 failed=0,error_mask=0x0 error=0x0,error_streams[0]=0x0 exceptions[0]=0x0.systemctl --failed: 0 failed units; 0 DART translation faults, 0 new kernel errors.6ffeda54, before theintegration/aurorarebase and rollback fixes):7.3.0-aurora-fleet81(integration/auroraeb6d9ec1+ open heads including PR iommu: apple-dart: confine the T8132 radio's always-on SID16 bypass to the one page it needs #2502 at6ffeda54), booted on the default command line with the J713's configured DTB.fdtgetconfirmed/soc/iommu@490000000carriesapple,sid16-page = <0x3 0x81204000>; dmesg loggedapple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000at 0.60 s; 0 DART faults across all 17apple-dart fault handlerinterrupts;brcmfmacassociated (VHT 2x2, 400 Mbit/s), gateway ping 5/5; Bluetooth powered and scanned 30 devices;rtcwake -d rtc1 -m freezes2idle 1/1 pass with SID16 still narrowed and 0 DART faults; SELinux Enforcing, 0 AVC denials, 0 failed units, only the 2 pre-existingdwc3-apple ... genpd_prepare returns -11error lines.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 SID16TCR=0x1with SID1/SID2 unchanged.Mac16,13, tested by @kazuhidet — evidence for prior head6ffeda54, before theintegration/aurorarebase and rollback fixes):integration/aurora0abc2f385+apple-dart.cfrom6ffeda54and J715 DTB supplyingapple,sid16-page = <0x3 0x81204000>on/soc/iommu@490000000.apple-dart 490000000.iommu: SID16 bypass narrowed to page 0x381204000, 0 DART faults, no quarantine or readback failure;wlan0only interface up, gateway ping 5/5 in every record, 0brcmfmacerrors; Bluetooth controller powered and paired device connects; failed units and kernel errors unchanged vs baseline (not covered: s2idle/resume, BT audio, throughput).4744d692f905, basef5fae3cbb047):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-clearDISABLE_STREAMSand T8132 non-retainedBYPASS_DAPFrequest bit, verifiestcr_bypassrestore command and exactTCR/TTBR0/ENABLE[16]readback across disabled and static-bypass0x2/0x6entry states, rejects unrestorable entry states before narrowing, verifies droppedTTBR0write fails before enabling translation, verifies droppedENABLE[16]write fails probe and rolls back, verifies clearedENABLE[16]fails admission and cold-link idle check with-EBUSY, and verifies mismatchedTCRreadback or failedDISABLE_STREAMS/TCR/TTBR0/TLB-flush teardown keepssid16_opsunfreed).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.971399886047anda3cf6c4ebeef):make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/iommu/apple,dart.yamlandmake CHECK_DTBS=yon the six T8132 DTBs (t8132-j604,t8132-j623,t8132-j624,t8132-j713,t8132-j715,t8132-j773g) passed on the identical binding and DTS commits (971399886047anda3cf6c4ebeef).Tested-by: @kazuhidet
Tested-by: @RyanTheTide
Still to run
s2idleran on the default command line and deep sleep ran with J713'sapple_dart.j713_dcp=1 apple_dart.j713_display=1display flags).4744d692f905(the J715 row above is for prior head6ffeda54), plus additional T8132 boards (J604,J623/J624,J773g) if available.Assisted-by: LLM (Anthropic:Claude Opus 5.5, Google:Gemini 4 Neon, Google:Gemini 4 Hydrogen)