Repository navigation
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 |
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
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
Returning this PR to draft until the remaining hardware checks complete on the updated head (
4744d692f905):4744d692f905) after theintegration/aurorarebase and SID16 rollback updates (J713 and J715 results above are for prior head6ffeda54).TCRandTTBR0verbatim, not yet run on hardware).J604,J623/J624,J773g) if available (J713 and J715 both confirm0x381204000).Assisted-by: LLM (Anthropic:Claude Opus 5.5, Google:Gemini 4 Neon, Google:Gemini 4 Hydrogen)