Repository navigation
sptm_virt: boot a stock-SPTM guest on J613 - #298
Conversation
|
Thanks for the stock-SPTM guest on the J613; the hardware table is very clear. One structural point. The AMCC shadow gains a second per-chip implementation:
We can run guest rows on our M1 Pro, M2, M4 Pro and A18 Pro with the shared reader. |
|
Following up on the AMCC point with a few more items, mainly so the merge is clean:
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Thanks for the stock-SPTM guest on the J613. The run table is clear, and it's good to see all 8 cores in XNU under stock SPTM.
Ryan's two rounds cover what holds it, and I agree with all of them:
-
DCO. None of the 11 commits has a Signed-off-by (docs/licensing.md).
git rebase --signoff mainadds them in one go. -
smp_prepare_rvbar()now writes RVBAR on every A7 to M3 boot (src/smp.c:267-271), not only under the stock-SPTM guest, and it returns -1 when the readback differs. Please move the write to the guest-entry path. If it stays general, say so, and we'll run normal-boot rows on the M1 Pro and M2. -
Chip and address gates.
sptm_virt_amcc_contract_t8122()compares the ADT with transcribed apertures (exact_apertures = {0x220000000, 0x222000000}insrc/sptm_virt_s2.c).sptm_virt_amcc_watch()branches onchip_id == T8122.j613_capture_setup()(src/sptm_virt_gpu.c) hard-codes the ANE, DART and AIC windows, plus 0x292468000 and 0x2a5468000.
/chosen/lock-regs/amccalready carriesaperture-phys-addr,plane-strideand the*-reg-offsetvalues. Reading those on every chip, and refusing a malformed node so it stays fail-closed, would replace the T8122 numbers, and the T8142 branch could move onto the same reader. -
The profile and the admit check pin 25G83. A property-driven reader would also make the 27.2 (26B123) target work.
The red format-check is base drift in src/sptm_virt_s2r.c. main is clean now, so your next push will pick that up.
eb9dfa7 to
1a7a1dd
Compare
|
Claude Opus 5.5 on @satchlj's behalf Thanks @RyanTheTide and @DjDeveloperr. I've addressed every point in a code-only pass. New head: None of this rework has run on hardware. The J613 wasn't available, so the run table in the description is from the old head only.
Validation on the new head (host only):
Still untested on hardware:
@RyanTheTide, we'd gladly take your offer of guest rows on M1 Pro, M2, M4 Pro and A18 Pro with the shared reader. The useful signal per machine is the |
|
Claude Opus 5.5 on @satchlj's behalf: pushed 92989ea, "sptm_virt_gpu: trace the ANE DART's DAPF slices from the ADT".
The host test This is untested on hardware. The J613 guest boot already queued on rubra will cover it. |
|
Thanks for the rework. One reader of As offered, we will run the guest on our M1 Pro, M2, M4 Pro and A18 Pro at 1a7a1dd and post the |
|
Claude Opus 5.5 on @satchlj's behalf. J613 guest boots at Setup. J613 (MacBook Air M3), macOS 26.6.2 (25G83) stock SPTM/TXM. Built with What happened, in both runs:
Suggested fix: restore the guard the earlier head had: if sp["ctrr_stash_off"] is not None:
p.write32(sym["sptm_virt_ctrr_stash_off"], sp["ctrr_stash_off"])
print(f"SPTM: CTRR stash +0x{sp['ctrr_stash_off']:x}")DAPF slices: not observed. The Recovery and disk: after each run the installed Linux came back cleanly. Btrfs superblock generations moved only forward: 87754 → 87759 for run 70, and 87760 → 87764 for run 71, on all three superblocks. I'll rerun both on the next head with the guard. 🤖 Generated with Claude Code |
|
Thanks for the J613 runs and the clear write-up. Bringing the two word windows back as the ANE DART's The We will run our M1 Pro, M2, M4 Pro and A18 Pro guest rows on the head that carries that guard rather than on 1a7a1dd, and post the |
|
Blockers: 3.
The HW row: J613, 25G83 stock SPTM, on the head with the fixes above: Assisted-by: LLM (Claude:Opus 5.5) |
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
Signed-off-by: Satya Benson <satya@benson.earth>
The macOS CI runners have no gmake on PATH. Signed-off-by: Satya Benson <satya@benson.earth>
smp_prepare_rvbar() runs on every normal boot. Restore its main behaviour (A7 to M3 leave the write to smp_start_cpu()) and the two harnesses that modeled the extra write, and move the publish into smp_prepare_guest_rvbar(), called only from smp_prepare_guest_resets(). It writes an unlocked RVBAR on A7 to M3, reads it back, and never writes a locked one. Signed-off-by: Satya Benson <satya@benson.earth>
Replace sptm_virt_amcc_contract_t8122()'s transcribed apertures and offsets, and the chip_id == T8122 branch in sptm_virt_amcc_watch(), with one reader of /chosen/lock-regs/amcc used on every chip: the apertures (aperture-phys-addr, -count, -size), the plane geometry (plane-count, plane-stride), the optional cache status (cache-status-reg-*), and one bank per child from its *-reg-offset properties. The geometry must also match the MCC driver's planes. A missing or malformed node is refused at admission (sptm_virt_s2_admit) and panics before any hook at guest setup, so the path stays fail-closed. Under the lock-regs shadow, only the described bank registers are shadowed; the T8142 plane-offset locks no longer apply there. T8142 keeps its plane-offset path (amcc_is_lock, AURA_AMCC_NOLOCK): whether its lock-regs banks name +0xacc/+0xadc/+0xaec has not been checked on an M5, so moving it now would change that path untested. Signed-off-by: Satya Benson <satya@benson.earth>
j613_capture_setup() compared transcribed J613 values and hooked a fixed window list, including two addresses (0x292468000, 0x2a5468000) no ADT node backed. Replace it with ane_trace_setup(): it hooks every reg window of /arm-io/ane and /arm-io/dart-ane and /arm-io/aic reg[0], traces a window that lies inside another through the larger one, and refuses a missing node, an empty window or too many windows before any hook. The chip_id check goes; the mode is SPTM_VIRT_ANE_TRACE, named by what it traces. On the J613 ADT this hooks the same ANE and AIC windows as before. The two word windows are no longer traced: their ADT node is not named in this PR or aura's source, so they come back once one is. Signed-off-by: Satya Benson <satya@benson.earth>
The J613 profile and admit check were pinned to 25G83 and to chip == 0x8122, with exact ADT register values. Replace them: - aura/sptm_export.py loads every aura/sptm_exports/*.json and picks the one whose image_sha256 matches the SPTM image given. No SoC, board or OS build is matched. The existing 25G83 export moves there unchanged; an export for another SPTM build (27.2, 26B123) is one more file, once one is reviewed. - An image with an export is patched only from it, and only with AURA_SPTM_EXPORT=1 (was AURA_J613_RUN) or AURA_ANE_TRACE=1 (was AURA_J613_TRACE). An incomplete or unreviewed export, or one with rows the loader does not apply, is refused on the host before anything is placed on the target. Any other image goes to sptm_patch.plan(), which refuses images it cannot fully plan. - The exact ADT resource and window lists go: the ANE trace reads its windows from the ADT, and the AMCC shadow reads lock-regs. Signed-off-by: Satya Benson <satya@benson.earth>
ane_trace_setup() dropped the two four-byte windows j613_capture_setup() hooked by address. They are slices of the ANE DART's filter: the dapf-instance-N entries of /arm-io/dart-ane. Read every such property with dapf_t8110_ranges() and hook each slice at the filter's word granularity; a slice inside a reg window is traced through it, as before. A dapf-instance-N that is present but malformed, empty, or holds a slice that is not whole words refuses the trace before any hook. A DART with no such property traces its reg windows only. On the J613 ADT this restores the two word windows; the other three slices lie in /arm-io/ane reg[3]. Signed-off-by: Satya Benson <satya@benson.earth>
Conflict: src/sptm_virt.h, flag bit 11. main took it for SPTM_VIRT_SEP (AURA_SEP_TRACE); this branch used it for SPTM_VIRT_ANE_TRACE. ANE_TRACE moves to bit 12, and AURA_ANE_TRACE in run_guest_sptm.py moves with it. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
|
The 24 h window on Dj's 11-26 merge-main request passed, so as maintainers we merged main ( The one conflict was a flag-bit collision in Local checks at the new head: clang build ( Because the conflict was in a file this PR touches, the J613 row at |
|
Checked the
All |
|
Status at
|
There was a problem hiding this comment.
Verdict: FINISH, then merge at 7a0bc989
Blockers:
- Missing exact-head J613 stock-SPTM guest boot row at
7a0bc989(needed because the forward-merge resolved asrc/sptm_virt.hflag-bit collision relative to the previously tested4903a22bhead), plus a second-Mac regression check.
Checked:
- Code & IP audit: prior Apple-binary pattern export is gone (
_find_apsts_polls()uses semantic instruction matching with zero copied binary bytes);src/sptm_virt.hmerge resolution at7a0bc989is clean. - Stage 1 size CI (
gcc,fedora,nix): verified byte-identical tomain(26c1a85b), adding0 Bto Stage 1; all other 27 CI jobs pass (MERGEABLEonmain). - Checked for Apple material, tool attribution, private serials, and board gating: clean; human
Signed-off-bypresent.
Evidence
- Head:
7a0bc989(base: main,mergeable: MERGEABLE,+1161/-41across 15 files).
|
About the App's "second-Mac regression check": a normal-boot row on another Mac wouldn't run any of the changed C:
The rest is proxyclient tooling and host tests, and all 27 non-size CI jobs pass. So the J613 stock-SPTM guest boot at |
There was a problem hiding this comment.
Verdict: HOLD at 29883b3a — code and clean main forward-merge remain sound; awaiting queued CI (17 jobs) and the exact-head J613 stock-SPTM guest boot row.
Blockers:
- Queued CI at
29883b3a(17jobs, including Stage 1 size check post-#551) must complete green. - Exact-head J613 stock-SPTM guest boot row at
29883b3a(previously requested after thesrc/sptm_virt.hflag-bit collision resolution at7a0bc989; note the non-SPTM_VIRTpath is dead-stripped so a second-Mac normal-boot row is not needed per the 11-28 maintainer note).
Checked: Clean main forward-merge commit 29883b3a (overlap only in Makefile), MERGEABLE status, and prior code audit at 7a0bc989.
Evidence
29883b3amergesmaincleanly (MERGEABLE), preserving the semantic_find_apsts_polls()matcher andsrc/sptm_virt.hreconciliation unchanged.- Note: merge commit
29883b3ahas noSigned-off-by:trailer; confirmpolicyCI passes on the merge commit.
|
@satchlj #551 (the Stage 1 size fix) has landed, and I merged current main into this branch. The head is now I checked the forward-merge's One row is still owed, and only a J613 can run it (our lab has none): a stock-SPTM guest boot on your J613 at If there's no row by 2026-11-30 14:00 AEDT, I'll merge once CI is green and the App verdict is FINISH, file the J613 row as a |
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
|
Maintainer disposition at I merged current main ( Main's new layout vs. this PR: I checked #609 (RELR packing) and #611 (SMP shared state moved to
Local checks at
The J613 row: the changed C runs only in
The 11-30 14:00 deadline has passed with no new row, so as maintainers we accept the J613 stock-SPTM guest boot as a known gap under our merge-then-fix rule. This PR merges once CI is green and the review App approves at the exact head. It will be a squash merge, as you asked, so the early commits that carried the removed export table stay out of main's history. When it merges we'll open a @DjDeveloperr, could you re-review at |
There was a problem hiding this comment.
Superseded 12-01: not a hold under the merge bar (no shown failure). Provenance-only check, runtime not reviewed; follow-ups: verify squash tree vs e8eb54da, runtime disposition
Verdict: Provenance check passed at 7d91d3f.
Checked: The revised squash message now matches the PR description and includes human sign-offs. The PR diff omits the removed artifact, and 17 hosted checks passed. Verify the final squash tree against reviewed tree e8eb54da. Runtime behavior still needs a separate disposition.
|
Landing plan (closeout): squash merge at |
|
Corrected squash message: the guest's SPTM is a stock image patched at runtime by the structural matcher, not unmodified. Exact message: |
|
Consolidated review at Blockers
Follow-ups (minor) Nits: limit the APSTS scan to the executable segment and drop the unused Checked and fine: no Apple-derived data in the final diff; nothing reachable without SPTM_VIRT; the ADT bounds and the 640/8 limits are enforced before any write; partial banks are refused; the Python tooling can't mispatch. If there's no update by 2026-12-02 12:00 AEDT, we'll fix the two blockers ourselves on this branch, with your authorship kept. The J613 row stays a known gap as posted; the fix needs a T6050 (K114s) and a J616s admission row, which our lab will run. |
Two fixes from the aurora-silicon#298 closeout review. A chip with no MCC driver (T6050) has no planes to check /chosen/lock-regs/amcc against, so the lock-regs path refused every guest load and panicked in setup. Such a chip is admitted again and its AMCC left unhooked, as before the lock-regs shadow. The shadow and the cache-status fake only model 32-bit accesses. A byte, halfword, 64-bit or pair access that overlaps a shadowed register went to the real AMCC lock, limit, enable or write-disable registers. Such an access is now refused, so the guest takes the fault.
|
Fixed forward as announced, since the 12:00 deadline passed without an update. One commit on top of
Tests: Follow-ups 3-7 and the nits stay follow-ups, as in the review. Still open before the squash: one approval at this head, plus the T6050 and J616s admission rows. |
|
T6050 admission verification at exact head
|
There was a problem hiding this comment.
Verdict: MERGE at 00d7e7f
This is one round on the fix-forward delta 7d91d3f7..00d7e7f0. It is checked against the two blockers in the consolidated review.
- T6050 admission works.
amcc_undriven()(mcc_plane_info(0)< 0) admits a chip that has no MCC driver, andsptm_virt_amcc_watch()returns before the lock-regs panic. AMCC stays unhooked, as onmain. Chips with an MCC driver keep the lock-regs requirement. Satya's J775c (T6050) row at this exact head shows admit=1, load=0 and a cleansptm_virt_s2_setup()with "AMCC left unhooked". - Accesses that are not 32-bit are refused.
amcc_wide_touches_shadow()runs before any shadow or pass-through path. The HV decoder reports a W-register LDP/STP as width 3 and an X-register pair as width 4, so1 << widthcovers the full 8 or 16 bytes. A byte, halfword, 64-bit or pair access that overlaps a lock-regs bank register, the cache-status word, or a T8142 nolock offset now returns false (the guest faults). A 32-bit access that does not overlap passes through unchanged.
Checked: I traced the width encoding in src/hv/hv_vm.c (the pair decode and the SPTE_HOOK call). tests/python/test_sptm_amcc_lockregs.py at the head passes 5/5. The same tests against the pre-fix src/sptm_virt_s2.c (7d91d3f) fail 3/5, including test_wide_access_over_shadow_refused and test_chip_without_mcc_driver_stays_unhooked, so the new tests do detect both bugs. CI is green at the head.
Follow-ups (not blocking):
amcc_undriven()cannot tell "no driver for this chip" from "a driver whose init failed", so the second case would also be admitted unhooked. A chip_id allowlist would make that case explicit.- T6040/T8140 still depend on the lock-regs aperture order matching
mcc_regs[]. A mismatch refuses admission; it does not corrupt anything. Matching by address would remove that dependency. - Follow-ups 3-7 and the nits from the consolidated review are still open.
|
Merging by squash at |
What: Bring up stock SPTM under FEAT_NV2 (
SPTM_VIRT) with generic, ADT-driven host support and bounded ANE tracing:proxyclient/aura/sptm_patch.py: replace the single-register APSTS match with a structural 5-instruction AArch64 readiness-poll matcher (_find_apsts_polls(), admitting 1–2 sites and failing closed on 0 or >2), covering builds with distinct primary/secondary register pairs without per-image export tables.src/sptm_virt_s2.c: parse/chosen/lock-regs/amccfor every non-T8142 chip (validating againstmcc_plane_info(), skipping empty unpopulated bank children while rejecting partial banks, supporting up to 8 apertures and 640 shadow entries), keeping the host's real AMCC locks untouched.src/smp.c,src/sptm_virt.c,src/sptm_virt_gpu.c,Makefile: guest secondary RVBAR publishing (including powered-off A7–M3 secondaries withRVBAR_LOCKset from iBoot, while refusing to write any running locked core), boundedAURA_ANE_TRACEring, and optionalNO_DISPLAY=1headless Stage 1 build flag.proxyclient/tools/run_guest_sptm.py: Darwin KIS re-enumeration console tail, USB serial post-entry drain avoidance, andctrr_stash_off is Noneguard.Tested:
4903a22bcb3f: PASS — both untraced boot andAURA_ANE_TRACE=1boot reachloginwindowon all 8 cores with 0 panics:0x1000f1980c4,0x1000f1a77c0).SPTM-virt[amcc]: lock-regs bank shadowed: 1 bank(s) on 2 aperture(s) x 2 plane(s); host protection unchanged.cpu0..3, 5..7unlocked and pointed at the active image (core state 0x0), runningcpu4untouched (locked -> aura, core state 0x2); all 8 cores enter SPTM and XNU (0xfffffe00340a8000) within 0.9 s.AURA_ANE_TRACE=1: hooks all 6 ADT-derived windows including both DAPF slices (ANE trace: hooked ane-dapf 0x2a5468000+0x4,ANE trace: hooked ane-dapf 0x292468000+0x4) and reachesloginwindowcleanly with 0 panics.cd7a9b13b03a+4903a22bcb3f):clang-format --dry-run --Werror, RVBAR unit test suites (test_smp_guest_rvbar.py,test_smp_legacy_rvbar.py,test_smp_load_base_rvbar.py,test_smp_locked_boot_rvbar.py), andSPTM_VIRT=1 CHAINLOADING=1 DEBUGUSB_PROXY=1 NO_DISPLAY=1 EXTRA_CFLAGS=-Ozbuild all pass.Risk: two-way ·
SPTM_VIRT=1development/trace builds and host launcher only; default Stage 1 boot path is unchanged aside from the opt-inNO_DISPLAY=1flag and guest secondary RVBAR helper.Not yet: An additional post-merge hardware row on another SoC (M2 or M4 Pro) showing the
/chosen/lock-regs/amccadmission line.Merge note: Squash-merge this PR (or land via a fresh squashed branch if a merge commit is ever required) so intermediate branch commits prior to
cd7a9b13b03athat previously contained the removed25G83.jsonfile do not entermainhistory.