Repository navigation
Conversation
…3-ias T8152 Gen3 DARTs are invalidated through a command slot in the SoC's shared TLBI aperture rather than the T8110 TLB command register, and the loader may leave a stream with a narrower table walk than the VA width the DART reports. Describe both, for apple,t8152-dart only: - apple,tlbi-aperture: physical address of the DART's command slot - apple,gen3-ias: the walk width in bits, which requires the aperture Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Gen3 DARTs of T8152 do not act on the T8110 TLB_CMD register: a stream flush written there completes, but the DART keeps translating with the old entries. A Gen3 stream is invalidated through the SoC's shared TLBI aperture instead. A 16-byte command (bit 60, the DART's TLBI route from register 0x4604, the stream) is stored to the aperture, followed by a broadcast TLBI that the DART observes; the final DSB completes only once the broadcast has. This is the sequence the aura loader uses for its own Gen3 mappings (dart_gen3_tlb_invalidate()). A DART opts in with "apple,t8152-dart" and the physical address of its command slot in "apple,tlbi-aperture". "apple,t8152-dart" gets its own hardware ops, the T8110 ones with an invalidate_tlb that takes the aperture when there is one; without the property nothing changes, so the existing T8152 nodes, which have no aperture, keep the T8110 path. The ranged invalidations of firmware-held and locked DARTs still use TLB_CMD, as no Gen3 DART takes them yet. Like the T8110 command path, an invalidation is refused with -EHOSTDOWN while the DART's commands are gated. The aperture is shared by all Gen3 DARTs, so commands are serialised by one lock. Tested with an earlier version of this change on an earlier base (integration/aurora f5fa539), on a MacBook Pro (M6, J804) with the USB device controller's two DART instances under SMP: without the aperture invalidate, 8 of 20 256 KiB bulk transfers carried stale data from earlier mappings; with it, 220 transfers of 256-512 KiB (100 MiB) were byte-exact and the DARTs raised no exceptions. Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The T8152 Gen3 DARTs report a 42-bit VA in PARAMS3, so the driver builds four-level tables for them. The loader (and the firmware it hands over to) runs these streams with a three-level walk indexed by the low 36 bits of the DVA, while the device itself issues DVAs in a high window such as 0x100_0000_4000. The tables Linux builds must match the walk the DART is configured for. Add an optional "apple,gen3-ias" property to Gen3 DART nodes (those with an apple,tlbi-aperture) that sets the walk width. The domain already masks every DVA with the walk width before it touches the tables, so the device keeps its high window while the tables use the low bits. The property is ignored outside 32 bits to PARAMS3's width, and without it nothing changes. Tested on an earlier base (integration/aurora f5fa539), on a MacBook Pro (M6, J804), on the SEP's Gen3 DART, whose stream 0 the loader leaves with a three-level walk: with apple,gen3-ias = <36> the SEP runs on Linux's tables (Touch ID enrolment and verification); without it the four-level tables do not match the stream's walk. Signed-off-by: LiamRay11 <228416644+LiamRay11@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sithglan
left a comment
There was a problem hiding this comment.
Test report, 2026-11-17: Apple Mac mini M6 (J873g/T8152, board 0x24). PR revision tested: 0ffca47a6103dbe9f8f87282ddcb9a2c165229e4.
Host validation used the combined #2105–2108/#2110–2112 series (54742c617db4 on 677be395b9d2) with Clang 22. All changed driver objects built with W=1 and no new warnings; two pre-existing DART unused-helper warnings were unchanged.
apple-dart.o built with Clang 22 and W=1 with no new warnings. The 15 DART host regression cases passed, including negative controls; the related MTP/DART check passed 1/1. All 137 Apple DTBs built at base and combined head with no new warning lines, and all ten changed bindings passed.
Hardware coverage is limited: the current mini DT contains neither apple,tlbi-aperture nor apple,gen3-ias. Its custom display DART uses apple,t8152-dart-gen3. The new opt-in invalidation/walk-width path was therefore not exercised on hardware. The patch also did not apply cleanly to the older private M6 DART branch, and no forced backport was used. These results do not qualify the new Gen3 path for deployment.
|
Blockers: 4. The aperture path itself looks right: the command is built from the route read at probe, commands are serialised across all Gen3 DARTs by one raw lock taken inside
HW row: J804 on the rebased head with the aperture on the PCIe port 0 and USB0 DARTs: the 20x256 KiB bulk stale-data test (0 stale), the 200 MB Wi-Fi SHA-256 push, the SEP with Assisted-by: LLM (Claude:Opus 5.5) |
|
@LiamRay11, a tidy-up pass over the open PRs here. These of yours need something:
If any of these are no longer needed, closing them helps; otherwise a merge or rebase onto integration/aurora is usually all they need. Thanks! |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: HOLD at 0ffca47
Blockers:
drivers/iommu/apple-dart.c&Documentation/devicetree/bindings/iommu/apple,dart.yaml— PR isCONFLICTING/DIRTYagainst livemain(a9cd131e8207), which already landed T8152 Gen3 DART support in #1800 and #2139 (2ac0620b4639,762549f5a30a,01d47a3ae576,90d575a1a46e,36b6071305bb,aa6db0c74edd) viaapple,t8152-dart-gen3/apple,t8152-avd-dart,reg-names = "dart", "tlbi", andapple_dart_hw_gen3. Rebase ontomainand unify with that binding andhw->gen3path rather than introducing a second, divergent Gen3 interface (apple,tlbi-apertureonapple,t8152-dart+apple_dart_hw_t8152).drivers/iommu/apple-dart.c:5622-5645&Documentation/devicetree/bindings/iommu/apple,dart.yaml:415—apple_dart_probe()readsdart->regs + DART_GEN3_TLBI_ROUTE_REG(0x4604) while only validatingresource_size(res) < 0x4000(and the binding example itself uses a0x4000-bytereg), causing an out-of-bounds MMIO read past the ioremapped region, and reads the register beforeclk_bulk_prepare_enable()(:5727). Checkresource_size(res) >= DART_GEN3_TLBI_ROUTE_REG + 4, fix the binding example size, and move the route read after clocks are enabled.drivers/iommu/apple-dart.c:2807-2814&:2229-2245—apple_dart_domain_flush_tlb_range()dispatchesfw_mirror/fw_handoffanddart->locked && version >= 0x0202toTLB_CMDbefore callinghw->invalidate_tlb(), andapple_dart_t8110_v2_unlock()unconditionally writesDART_T8110_TLB_CMD_OP_FLUSH_UNLOCK. Becausedart->lockedis probed from hardware (:5960), a locked Gen3 DART would silently issueTLB_CMD. Route Gen3 before the rangedTLB_CMDbranches (or fail closed at probe) and guardapple_dart_t8110_v2_unlock()on Gen3, matchingmain.drivers/iommu/apple-dart.c:5820-5835— A malformed or out-of-rangeapple,gen3-ias(< 32or> dart->ias) is silently ignored, leaving the DART on the 4-levelPARAMS3walk width that mismatches the stream. Fail probe closed withdev_err_probe(dev, -EINVAL, ...)when the property is present but invalid, and confirm whether the walk width can be read from hardware TCR instead of a DT override (§1).- §4 (Attribution hygiene) — Commits
6cf161e5fa3a,94afe8291283, and0ffca47a6103carry a non-human co-author trailer, and the PR body ends with a tool-generated footer. Strip all non-human trailers and footers completely (keep only the human author and humanSigned-off-by:; do not add any replacement attribution line). - §5 (PR structure & exact-head evidence) — PR body is missing the required top-level
What:,Tested:,Risk:, andNot yet:lines and lacks an exact-head hardware test row on the rebased head exercising both Gen3 TLBI invalidation and walk-width handling with the regression line (0 SELinux denials, 0 failed units, 0 new kernel errors), plus a non-regression row on another DART Mac (e.g., J873g).
Checked: Diff against main (a9cd131e8207), pre-PR checklist §1–§6, commit trailers, CI runs (dt-checks and host-tests, green only on stale base 677be395b), and J804/J873g test reports.
Evidence
- §1 (No model gating):
apple,tlbi-apertureandapple,gen3-iasare restricted toapple,t8152-dartin the binding and probe, with non-T8152 DARTs (t8103,t6000,t6020,t8112,t8122,t603x,t8132,t604x,t6050) staying on their existing ops tables. Onmain, Gen3 DARTs already useapple,t8152-dart-gen3/apple,t8152-avd-dartwithreg-names = "dart", "tlbi". Forapple,gen3-ias, check whether hardware TCR already exposes 3-level vs 4-level configuration before adding a new DT override. - §2 (Production-ready, no hacks): No new kernel cmdline or module parameters, no magic sleeps/retries. However,
apple_dart_probe()performs an unchecked out-of-bounds pre-clock read of0x4604, silently ignores invalidapple,gen3-ias, and leaves locked/ranged/unlockTLB_CMDpaths unguarded. - §3 (Safety): Failing to invalidate a locked Gen3 stream or silently falling back to a mismatched 4-level table risks stale DMA / fault corruption; fail closed on invalid configuration and unsupported modes.
- §4 (IP & attribution): No copyrighted Apple material found. Hard-rule failure on non-human co-author trailers in all 3 commits (
6cf161e5fa3a,94afe8291283,0ffca47a6103) and the footer in the PR body. - §5 (Evidence & PR structure): PR body lacks
What:,Tested:,Risk:,Not yet:. J804 test data was collected on an older integration base (bf423bf0ewith 9 merged PRs and unsubmitted DT nodes;apple,gen3-iasonly onf5fa539), with no regression check line;sithglan's J873g report at0ffca47confirmed the opt-in Gen3 paths were not exercised. - §6 (Naming): Pass — uses
auraproperly;tools/asahi/references existing repository paths. - Commits & CI: 3 commits (
6cf161e5fa3a,94afe8291283,0ffca47a6103) on stale base677be395b.dt-checksandhost-testspassed on 2026-11-17 against677be395b, not against livemain(a9cd131e8207,CONFLICTING/DIRTY). - Non-blocking notes for unification with
main:- Several details in this PR are worth folding into
main'sapple_dart_gen3_hw_invalidate_tlb(): the sharedraw_spinlock_tserializing access to the SoC-wide TLBI aperture across Gen3 DART instances, thedart->commands_gated-EHOSTDOWNcheck,ioremap_np()for the aperture slot, and the#ifdef CONFIG_ARM64compile-test guard. - Reconcile VHE
HCR_EL2.TGEclearing aroundTLBI VALE1OSwithmain(762549f5a30a) when unifying the invalidation helper. dma_wmb()inside thefor_each_set_bit()loop (:1865) only needs to execute once before the loop.
- Several details in this PR are worth folding into
Summary
The Gen3 DARTs of T8152 (M6) ignore the T8110
TLB_CMDregister, so Linux-owned mappings that change after boot are not seen by the device. This adds the Gen3 invalidation path through the SoC's shared TLBI aperture, and an optional walk width for streams the loader left with a three-level walk. Both are opt-in per DART node and change nothing for existing device trees, including J873's T8152 nodes, which have neither property.Changes
dt-bindings: iommu: apple,dart:apple,tlbi-aperture(u64, the DART's 16-byte command slot) andapple,gen3-ias(u32, 32-42, requires the aperture). Both are allowed only forapple,t8152-dart.iommu/apple-dart:apple,t8152-dartgets its own hardware ops: the T8110 ones, with aninvalidate_tlbthat goes through the aperture when the node hasapple,tlbi-apertureand is the T8110 path otherwise. A Gen3 invalidation is a 16-byte command (bit 60, the route from register 0x4604, the stream) stored with onestp, thendsb(ish),__tlbi(vale1os, 0)anddsb(osh). Commands are serialised by one raw spinlock, because all Gen3 DARTs share the aperture. Like the T8110 command path, an invalidation returns -EHOSTDOWN while the DART's commands are gated for sleep. This is the same sequence the aura loader uses (dart_gen3_tlb_invalidate()).apple_dart_t8110_hw_tlb_command_range(), because the host tests (tools/asahi/apple-dart-*-tests.py) compile that function and its callers verbatim against their own model ofstruct apple_dart.apple_dart_fw_invalidate(), the locked range path) still useTLB_CMD. No Gen3 DART takes those paths in this PR.iommu/apple-dart:apple,gen3-iassets the walk width of a Gen3 DART. DVAs are already masked to the walk width before the tables are touched, so a device can keep its high DVA window.Testing
On hardware: MacBook Pro 14-inch (M6, J804), 2026-11-16, tested by LiamRay11.
bf423bf0ewith all nine J804 linux PRs merged (t8152-mailboxes, dart-gen3, dt-board, centauri, g18-fast-retire, cfg80211-stale-scan, smc, cs42l84-jack, and an NVMe PR that is not sent yet), plus retest-only device-tree changes that are not part of these PRs: SSD nodes (ANS mailbox, SART, NVMe), PCIe port 0 with the N1 Wi-Fi, the USB0 gadget console, and aread-onlyNVRAM partition. Those nodes were needed to reach the root filesystem and SSH.systemctl rebootfrom this kernel (watchdog restart) returned to the installed system.Results for this PR (the retest-only nodes give the PCIe port 0 and USB0 DARTs
apple,tlbi-aperture):Earlier, with the same changes on an older base (integration/aurora f5fa539):
apple,gen3-ias = <36>: Touch ID enrolment and verification work.apple,gen3-iaswas not exercised in this retest (no SEP node in that tree).Checks on this base:
drivers/iommu/apple-dart.owithW=1builds without warnings (clang, LLVM=1, arm64).host-tests.ymlruns them): everytools/asahitest that readsdrivers/iommu/apple-dart*.cpasses, at both base and head: apple-dart-range, apple-dart-fw, apple-dart-fw-harness, apple-dart-tlb-stall (with--dtc; theevery-handoffmutation is still killed), apple-dart-dapf, dart-sleep-power, dart-sleep-writer, dart-sleep-snapshot, dart-cio-owner, dart-cio-power and j613-mtp-s2idle. The--refnegative controls, which need git history, were not run.scripts/dtc/apple-dt-check.sh(basebf423bf0e, head = this series together with j804/dt-board, j804/t8152-mailboxes and the J804 NVMe change): 137 Apple DTBs built at both, 0 new CHECK_DTBS warnings (8 removed: the J873gapple,t8152-pmgr/-pmgr-pwrstateones), anddt_binding_checkpasses for every changed binding.integration/aurora has since moved to
677be395b; this branch still merges into it without conflicts.Known limitations
apple,tlbi-apertureis a physical address in a vendor property. A namedregentry would be more usual, but the aperture is one SoC block shared by every Gen3 DART, and the existing T8152 DART nodes already use their secondregfor a second DART instance. A phandle to a shared aperture node plus an offset is the other option, if reviewers prefer it.Gen3 exception reporting is not handled. The T8110 IRQ path reads registers that are zero on Gen3. That is left for a separate change, once the Gen3 exception registers are documented.
Keeping the firmware roots of locked T8152 display DARTs (
fw_mirror) is not part of this PR. On the locked real-time display streams a whole-stream TLBI under a running scanout faults the DCP, so that change belongs with the display support.No DT user is added here. The J804 nodes that use these properties come with their consumers.
Dependencies
None.
🤖 Generated with Claude Code