Repository navigation
aura: remove the EL2 monitor and run Linux at EL2 in the CTXR window - #77
Conversation
a4df466 to
412c0e7
Compare
PV-KVM ran only beside the EL2 monitor, which this series removes. It was a bounded discovery and RUN prototype, not a /dev/kvm backend, and the kernel has no client for it. Remove the sources, the aura-pv option, the chosen.aura,pv ESP line, the /hypervisor node and its contract test. Signed-off-by: Diljit Singh <hey@djdev.me>
With a kcbz-0 boot object iBoot leaves the CTXR windows armed and locked on the secondary CPUs, and at EL2 they can execute only inside them. Move the probe that detects this out of the monitor into src/ctxr_exec.c, renamed ctxr_exec_confined(), and run the OS inside the window on a confined machine. kboot moves the kernel there, keeps spin-table, and publishes /chosen/aurora,ctxr-exec-window for CONFIG_ARM64_CTXR_EXECMEM and U-Boot. A machine that is not confined never reads a CTXR register and sees the tree it always saw. With no usable window there is no fallback: kboot_prepare_dt() and kboot_boot() refuse, print the reason on the console and the panel, and name the installer's Recovery step. The boot then follows the existing failure path into the proxy. The window is 128 MiB wherever the object armed more. The rest of CTXR_D stays reserved, because EL0 cannot execute there on a confined core and the OS only pools its window. There is no chip gate, since each check goes by the registers: - memory_fw_ro_range() answers only on T8140, so other chips check the window against CTXR A to C and the CTRR ranges kboot reserves. - Other chips reserve windows A to C themselves. T8140's firmware RO range covers them. - The J713 high-water interval and a described bootloader handoff reach past the window, so they go around it. Reserving them would leave the kernel no pool. - The T8152 handoff moves the kernel too. Only T8140 has run this path. This leaves the monitor as dead code, removed next. Signed-off-by: Diljit Singh <hey@djdev.me>
Linux now runs at EL2 on a confined machine, inside the CTXR window, and a confined machine with no window does not start the OS. So aura no longer stays resident under the OS. Remove src/monitor.c, monitor_eret, monitor_active and next_stage.monitor, and the console gating that went with them. Remove src/psci.c, the SMC handling and the /psci node, so the kernel always gets spin-table. Remove the park loop's re-entry helpers, which only CPU_OFF used. NV2 ran only under the monitor: nv2_active was set only with next_stage.monitor and nv2_enter_os() was only called from monitor_enter_os(). Remove src/nv2.c, src/nv2.h, src/nv2_asm.S, the aura-nv2 option, the chosen.aura,nv2 ESP line, the NV2_BOOT and NV2_TRACE build switches, the ERET gate in _v_lower_sync and the exception hooks. The lower-EL sync vector goes back to _v_sp0_sync. el1_call, el1_ret, gl2_call and gl_call_wrapper stay for the proxy and GXF, and src/hv is untouched. Unused architectural register definitions in arm_cpu_regs.h stay too. Signed-off-by: Diljit Singh <hey@djdev.me>
Replace the monitor's description with what aura does now, and say why an old Stage 1 keeps its old Stage 2. tools/fill_stage1_config.py and the Stage 1 parsers already take m1n1/boot-ctxr.bin, so aura needs no change for that path; pin it with a test. Signed-off-by: Diljit Singh <hey@djdev.me>
2c5be1d to
febf859
Compare
ctxr_exec_confined() counted any probe that did not return 1 as confined, including one that was never delivered (smp_call1() failed) or never finished (smp_wait() timed out). On main that only put the OS at EL1 under the monitor. Without the monitor it is a refusal to boot: an M1 to M3 Mac whose probed secondary is still busy would read an empty CTXR_D and tell the user to enroll Stage 1 again. When the probe does not run, say so and treat the secondaries as not confined: on a Mac that really is confined, the worst case is that its secondaries stay offline. Leave the probe page allocated in that case, since the secondary may still run it. Assisted-by: LLM Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
|
Adversarial review and regression run (CTXR lane, 06/11). Leaving this open: it can't boot on our lab Neo yet, see the last section. Pushed: Checked and fine
Should fix
Regression run: CI is green. Host build of this branch on macOS needs GNU make 4 ( Why it can't boot on our Neo tonight. Both Linux installs on the lab Neo have the unpadded Mach-O Stage 1 enrolled ( |
With no secondary running, ctxr_exec_confined() answered "not confined" and cached that for the boot. On T6040 in Mach-O mode, or wherever smp_start_secondaries() fails, the OS then started outside the window with nothing in the log, and a secondary started later was never asked. Warn once, and keep the question open for a later call. Read CTXR_D under an exception guard, at EL2 only, and say so if it is armed. The OS still starts on the boot CPU alone, because dt_set_cpus() drops the CPUs that aren't running. A probe that was sent and didn't finish stays cached: asking again could wait out the same timeout and lose another page. Signed-off-by: Diljit Singh <hey@djdev.me>
The window checks cover boot_args and the heap, but not everything that stays in place when the kernel moves. Refuse if the initrd or the device tree overlaps the window, and check the arm64 magic before trusting image_size. A described bootloader handoff may cover the running kernel and initramfs, and going around it left whatever lives there for the kernel's pool to overwrite. It now fails kboot_prepare_dt() if it overlaps the window, and is reserved whole otherwise. Signed-off-by: Diljit Singh <hey@djdev.me>
List what is gone compared with the monitor: CPU hotplug, PSCI SYSTEM_OFF and SYSTEM_RESET, kexec and kdump, cpuidle-psci, NV2 and PV-KVM. cpuidle-psci never had states to use on these trees, and cpuidle-apple binds on T8140. Idle power hasn't been measured. Record what the kernel's trees give each chip for cpu-release-addr, which all but T6040's boot CPU have, and that T605x has no tree yet. U-Boot's head relocates its image and runtime code into the window, so say that in the kboot.c comment and the docs. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Thanks for
Not addressed: T6040's RVBAR at the load base, which PR 66 carries. A T6040 in Mach-O mode still runs on one CPU, now with a warning. Your lab Neo also still needs a padded Stage 1 through Recovery before this Stage 2 will boot there. Build note: both targets link with macOS make 3.81, but only from |
Bring in main up to 671c0ce. Main adds no new monitor, PSCI, NV2 or PV-KVM users, so the removal stands as it was. Signed-off-by: Diljit Singh <hey@djdev.me>
A Mach-O boot object puts the raw image 64 KiB after its load base. An iBoot that does not take the vector address from the object may lock the secondaries' RVBAR at the load base, which holds the Mach-O header, and smp_prepare_rvbar() then refused every secondary on T6040. When the locked address is exactly 64 KiB below the vectors and still holds the Mach-O magic, replace that word with a branch to the vectors, and accept the branch on the next secondary. Any other content or distance is refused as before. tests/python/test_smp_t6040_load_base.py runs the production function against modeled MMIO: one write and an RW/RX remap on the first core, none on the next, refusal of foreign content, another distance or chip. The existing RVBAR harnesses define T6040 and SZ_16K. Signed-off-by: František Balázsy <frantisekbalazsy@gmail.com> Signed-off-by: Diljit Singh <hey@djdev.me>
apple_sysregs_unlocked was false on M4 and later, and it gated several unrelated things there. At EL2 on these chips HACR_EL2, the Apple ACTLR bits and the per-core deep sleep enable can all be set. CYC_OVRD is the register that is missing, and it is undefined from M4 on. Each use now goes by what it needs: - cyc_ovrd (A7 to M3): the CYC_OVRD writes in init_cpu(), deep_wfi(), cpu_sleep() and the hypervisor. The WFI bootargs go by its absence too, because without it aura can't turn WFI retention on. Their chip list, which says which kernels save state themselves, is unchanged. - secondary_ctrr (M4 and later): the CTRR_C and CTRR_D reservations in kboot, and the CTRR check on the CTXR window. - legacy_impl_regs (A7 to M3): the old flag's slot in the proxy ABI, for what M4 and later lock or have not been shown to have: setting RVBAR, the L2C, LSU, FED and MMU error status registers, and the hypervisor's AMX_CTL_EL2, VM keys and SPRR/GXF. The proxyclient's uses move to it too. - apple_sysregs_unlocked now means what it says, at EL2, and is true on M4 and later as well. Nothing gates on it. aura's hypervisor already writes HACR_EL2 and ACTLR_EL2 on every chip, and Linux finds the ACTLR features itself, so the device tree says nothing about them. Nothing writes the deep sleep enable. A secondary in deep WFI with it set stopped a Neo within 2 seconds. The truth table of every old use is unchanged on every chip, except that an unknown CPU part no longer reads the M4 CTRR registers. The record grows from 20 to 24 bytes. The proxy refuses a client of another size, and a test now checks the Python layout against the C struct. Signed-off-by: Diljit Singh <hey@djdev.me>
The CTXR path at EL2 had T8140-only branches. Make it the same on every chip, so that T6040 and T6041 boot the way the Neo does. - smp_prepare_rvbar() forwards a locked RVBAR on any chip. It writes a branch where RVBAR points when that is the boot object's Mach-O header 64K below the raw image, which is where iBoot locks it on T6040 (the previous commit, from aura#66, did this for T6040 only), or the vector table of an earlier aura image. Anything else is refused, as before. A later stage at the same base accepts the header branch an earlier one wrote. The earlier-image check takes the inherited top as its bound when there is no firmware RO range. - Every confined chip reserves CTXR_A to CTXR_C. One that lies inside the T8140 firmware RO range is left to that range's reservation, so the Neo's tree is unchanged. - The CTRR reservations are one function. Where memory_fw_ro_range() knows the range (T8140) it is reserved and kept out of the linear map as before, and elsewhere CTRR_C is read. CTRR_D is reserved when it is armed, on every chip. CTRR_C now ends at UPR + 4K, like CTRR_D, CTXR_D and the T8140 range, and is skipped when it reads as empty. - The window check on every chip takes the firmware RO range when one is known, CTXR_A to CTXR_C, and CTRR_C and CTRR_D. - chainload refuses an invalid firmware RO range by its status, not by chip. memory_fw_ro_range() itself stays T8140-only. Its fixed 48 KiB range at a measured place is what the MMU and chainload placement depend on there, and no other chip has been measured. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Pushed
Still untested on hardware:
The Neo boot is next. 🤖 Generated with Claude Code |
|
J813/T8142 (M5 MacBook Air) boot result: the monitor-free chain works on hardware. Tested this PR's head (1d9e9f1) together with the aurora-silicon/linux#985 kernel (feat/ctxr-execmem merged into the J813 stack as 6e2897803fd1) and the padded Stage 1 from aurora-silicon/aurora-installer#104. Object and enrollment
dmesg (7.3.0-aurora-j813-ctxr+ #13) The Stage 2 move worked as intended: the pool reports the 17 MiB image already reserved and the verifier finds all 576 EL1-executable mappings inside the window. NVMe root, Wi-Fi, GPU (aurora 1.0.0, M5 GPU firmware 25G76), AOP/audio and systemd all come up; no failed units. Testing note: |
apple_sysregs_unlocked comes from upstream m1n1, where 29073cc renamed cyc_ovrd to it: false on M4 and later, and gating CYC_OVRD, RVBAR, the L2C error status and SPRR/GXF. 89f2ff7 gave the name a new meaning, true on M4 and later, with no readers. A later upstream merge that adds a use of it would then run on M4 and UNDEF there, and the proxyclient's emulate_sprr default would flip on M4. Go back to upstream's flag. Every use has main's truth table again, cyc_ovrd, secondary_ctrr and legacy_impl_regs are gone, and the CPU features record is 20 bytes again, the size every enrolled Stage 1 and current proxyclient expects. The comment on the flag says what M4 and later can still set at EL2. A test checks the proxyclient's layout against the C struct. The CTXR changes keep their keys: RVBAR forwarding goes by the lock bit, and the window's CTRR check runs where kboot reads CTRR, on parts without apple_sysregs_unlocked. Signed-off-by: Diljit Singh <hey@djdev.me>
1d9e9f1 added reads of CTXR_A to CTXR_C, CTRR_C and CTRR_D on T8140, in the window check and the reservations. Nothing has read them on a Neo since, and an unexpected UNDEF there would kill the boot. ctxr_range() now reads one range under an exception guard, the way ctxr_exec_warn_unprobed() already read CTXR_D, and every new read goes through it. A range whose read faults, or whose LWR is 0, or whose UPR is below its LWR, counts as not armed in the window check as well as in both reservation functions. T8140's firmware RO range is reserved at either EL again, as main did. The HV guest at EL1 doesn't need otherwise: only the CTRR reads are left to the host there. The J700 fixture now has CTXR_A to CTXR_C and CTRR_C inside the firmware RO range, where the monitor's 2026-10-31 Neo boots relied on them being. It gets no new reservation, which the low-window test now checks. Signed-off-by: Diljit Singh <hey@djdev.me>
ctxr_exec_confined() waited for the probe with smp_wait(), up to 300 s, with GUARD_RETURN | GUARD_SILENT set for every CPU the whole time. On a timeout it called the machine not confined, but the call stayed in the CPU's slot, so kboot_boot() refused the handoff anyway, after kboot_prepare_dt() had handed devices over. Wait 500 ms with smp_wait_timed(), far more than two instructions or a fault take. The guard comes off on every path, as before. When the call is still pending, whether its acknowledgement or its completion timed out, ctxr_exec_os_may_start() says which CPU holds it and refuses at once, before kboot_prepare_dt() touches any device. A probe that couldn't be sent still counts as not confined. Neither is sent again. The stuck-probe test now models a completion timeout and an unacknowledged call. It checks the wait is between 100 and 1000 ms, that the guard is off after, and that the boot stops with no Recovery advice. The docs say what happens. Signed-off-by: Diljit Singh <hey@djdev.me>
…-off - Aura does read a CTXR register on M1 to M3: CTXR_D, under an exception guard, when it has no secondary to probe. - Power-off never worked under the monitor. main's psci.c answered both SYSTEM_OFF and SYSTEM_RESET with reboot(). - Aura can't tell whether a kernel was built with CONFIG_ARM64_CTXR_EXECMEM and moves one without it all the same. - On T8140, T6041, T8152 and the J713 the heap copy of a moved kernel stays reserved with the retained heap. That is about 1 MiB for U-Boot and about 40 MiB for a kernel booted with boot=. Releasing it would mean editing the memreserve entries after fdt_pack(), so it is only written down here and next to kboot_move_to_exec_window(). - Windows A to C on T8140 are left to the firmware RO range's reservation, which is what the monitor's 2026-10-31 Neo boots relied on. The text now says where that comes from instead of claiming the tree can't change. Signed-off-by: Diljit Singh <hey@djdev.me>
Stage 1 built with Homebrew clang 23 and the documented flags stopped linking
("Code and data reach the DCP log buffer after stage 1!"). aura-raw.ld aligns
each section to 64 KiB, and 1d9e9f1's .text ended 216 bytes short of a
boundary. This round's 308 bytes moved .text past it, and with it everything
after, to 0x12aa90 against the 0x120000 limit. CI and release build with gcc,
so they never saw it.
Take back enough to end below the boundary again:
- one loop over the five ranges in the window check
- one loop for CTRR_C and CTRR_D in kboot, without main's warning for a
CTRR_C larger than 48 KiB, which only logged
- the stuck-probe message printed once where the probe fails, instead of in
a second block in ctxr_exec_os_may_start()
.text now ends 16 bytes short of the boundary, so the next few dozen bytes
of code on this toolchain will move it again.
Signed-off-by: Diljit Singh <hey@djdev.me>
A probe stops the boot in two ways. smp_call4() gives the secondary 1000 ms to take the call, and then smp_wait_timed() gives it 500 ms to answer. The panel only named the 500 ms. Say that the CPU didn't take or didn't answer the probe, and put both times in the docs and next to the timeout. Signed-off-by: Diljit Singh <hey@djdev.me>
The window check and kboot's CTXR_D reservation still read CTXR_D directly. A confined machine has the register, but read it under the same guard as the others anyway. A fault there now reads as nothing armed, so the window is refused, instead of ending the boot. ctxr_range() is declared noinline. clang folded the constant CTXR_D calls into inline copies of the guarded read, which cost Stage 1 the room it has left under the DCP log buffer. The window harness faults one chosen register now, so a CTRR fault and a CTXR_D fault can be told apart. Signed-off-by: Diljit Singh <hey@djdev.me>
dt_reserve_secondary_ro() now holds T8140's firmware RO range, the EL1 case and the CTRR loop that kboot_prepare_dt() used to chain, so one harness can drive all of it. At EL1 it now says what it leaves to the host: CTRR_D on T8140, whose firmware RO range it has reserved by then, and CTRR_C and CTRR_D elsewhere. Before, it said the whole SMP-RO range right after reserving part of it. tests/python/test_secondary_ro_reservations.py runs it with the production ctxr_range() for T8140, another M4-or-later chip and M1 to M3, at EL1 and EL2. Against main the reservations differ in three ways, all since 1d9e9f1, which the test spells out: - T8140 at EL2 also reserves CTRR_D when it is armed. It read 0 on the Neo on 2026-10-31. - Other M4-and-later chips reserve CTRR_C to UPR + 4K, like every other range, where main stopped at UPR: 0xc000 bytes instead of 0xb000 for a 48 KiB range. - A CTRR_C that reads as empty or wrapped gets no entry. Main added a zero-size or wrapped one. Signed-off-by: Diljit Singh <hey@djdev.me>
aura-raw.ld puts each section on a 64 KiB boundary, and Stage 1 has to end below the panel DCP's log buffer. Built with Homebrew clang 23.1.1 and Rust 1.98.1, Stage 1's .text now ends 68 bytes short of its next boundary. Past it, the link fails. Releases build with gcc, so only someone building on a Mac found out. There is no clean way to win back real room here. The C has no dead code left to cut, and building the Rust with opt-level "s" would change code on every chip without a hardware test. So link both stages with clang on a macos-26 runner, with GNU make 4 from Homebrew, which runs the grouped config rule once under -j, and let CI fail first. Signed-off-by: Diljit Singh <hey@djdev.me>
- The window check skips CTRR_C and CTRR_D on a chip with unlocked Apple system registers (M1 to M3), as kboot does, so "every chip is checked against all of them" now says so. - The apple_sysregs_unlocked comment said SPRR/GXF is A7 to M3 only, against the boot object notes, which say GXF is writable with a kcbz-0 object on M4. The flag covers aura's own use of SPRR/GXF, in the hypervisor. The comment now says GXF is writable there too, and that aura doesn't use it. Signed-off-by: Diljit Singh <hey@djdev.me>
A kernel outside the window now logs why and boots on the boot CPU instead of panicking, U-Boot warns and starts a zboot kernel instead of refusing it, and kexec is refused whenever a window is active. Signed-off-by: Diljit Singh <hey@djdev.me>
|
Neo (J700) boot with this head: the padded 🤖 Generated with Claude Code |
|
Thanks for the Neo run on From an independent review (
From the re-review (
CI 10/10. 🤖 Generated with Claude Code |
HACR_EL2, the ACTLR bits and the per-core deep-sleep enable are writable at EL2 there; the flag stays false only because it gates CYC_OVRD. Signed-off-by: Diljit Singh <hey@djdev.me>
Signed-off-by: Diljit Singh <hey@djdev.me>
Take aura#77, which removes the resident EL2 monitor, PSCI, NV2 and PV-KVM from the Linux boot and runs Linux at EL2 in the CTXR window. Resolutions: - monitor.c, pv_kvm.c: deleted, as in #77. This branch's NV2 already has its own EL2 setup and entry (nv2_el2_setup, nv2_enter_el1h) and used neither the monitor nor PV-KVM. - nv2.c, nv2.h, nv2_asm.S: kept from this branch. They are built only with SPTM_VIRT=1. - exception.c: #77, plus this branch's SPTM_VIRT hooks. The UNDEF reflection on the monitor's path goes, with monitor_active. The proxy's hvc #1 case is SPTM_VIRT-only as a whole. - exception_asm.S: #77's, with no lower-EL ERET gate. Until a later commit puts the gate back for SPTM_VIRT, the guest's ERETs take nv2_eret's C path, which handles all of them. - Makefile: #77's object list plus SPTM_VIRT. NV2_TRACE and NV2_TRACE_PRINT only mean something inside SPTM_VIRT. - boot_options, payload.c, main.c, kboot.c, docs/boot-options.md and their tests: #77's. This branch only removed NV2 host mode from them, and #77 removes it along with PV-KVM. Signed-off-by: Diljit Singh <hey@djdev.me>
Takes main's 19 commits since #77 (1.0.0b6 to 1.0.0b9 and the M4 firmware gates). Only the linker scripts conflicted: main moved hv_vm and hv_sprr into the .init slot as this branch did, which also puts sptm_virt*.o there. Signed-off-by: Diljit Singh <hey@djdev.me>
This removes aura's resident EL2 monitor, PSCI, NV2 and PV-KVM, and runs Linux at EL2 inside the CTXR window on confined Macs. It is the owner's decision for the M4-generation release. Non-confined Macs (M1 to M3, raw boot objects) boot as before.
The monitor-free build has not booted on any hardware. The next step is one Neo boot of the full set, and this should not merge before that.
Why
Every M4-and-later chip boots a Mach-O object with kcbz 0, which skips SPTM. iBoot then leaves the CTXR windows armed and locked on the secondaries, and at EL2 they can only execute inside them. The monitor worked around that by running the OS at EL1 under aura. A kernel built with
CONFIG_ARM64_CTXR_EXECMEM(aurora-silicon/linux#985) keeps all its code in one physical window, so it runs at EL2 with nothing of aura under it.Linux never runs at EL1 on any boot path in this tree, raw or Mach-O. aura enters the kernel directly at EL2, as it always did on M1 to M3, and on a confined Mac it only adds the window to the device tree.
What's gone
The monitor, PSCI, NV2 and PV-KVM are removed completely. The code is kept in a private Aurora Silicon repository, so nothing here depends on it.
Removed:
src/monitor.c,src/psci.c,src/nv2.c,src/nv2_asm.S,src/pv_kvm.cand their headers,monitor_eret, the ERET gate in_v_lower_sync,monitor_active,next_stage.monitor, the SMC handling, the exception hooks, the/psciand/hypervisornodes,aura-nv2,aura-pv,chosen.aura,nv2,chosen.aura,pv, theNV2_BOOTandNV2_TRACEbuild switches,docs/j700-nv2-pmu.mdand their tests.The branch now has main up to 671c0ce merged in. The merge was clean, and main added no new users of any of it. A grep of the whole tree finds none left in code, the Makefile, tests, docs or config. What remains is the architectural
HCR_NV*definitions from upstream,el1_call,el1_ret,gl2_callandgl_call_wrapper(the proxy and GXF), and aura's own hypervisor insrc/hvandproxyclient, which runs its guests at EL1 by design. kboot still has one EL1 branch, for aura booted as a guest under that hypervisor (the J616s HV test indocs/j616s-bringup.md).M4 and later take one path
There is no chip list on the CTXR path. Each check reads that chip's registers.
src/ctxr_exec.casks a secondary to run code from the heap. The machine is confined if that faults. A secondary that doesn't take the probe within 1 second (smp_call4()), or takes it and doesn't answer within 500 ms, stops the boot before any device is handed over, because kboot never hands off with a call pending. The panel says the CPU didn't take or didn't answer the probe. The guard is off on every path. A probe that couldn't be sent counts as not confined.smp_prepare_rvbar()forwards it with a branch on any chip, when it points at the boot object's Mach-O header 64 KiB below the raw image, or at an earlier aura image's vectors. iBoot locks it at the header on T6040, which doesn't take the vector fromkcev. This is fbalazsy's fix from J616s: boot Linux from a Mach-O boot object, with a fixed layout for hibernation #66, cherry-picked with his authorship and then made chip-independent. Without it no T6040 secondary started in Mach-O mode, so the probe had nobody to ask. Anything else is refused as before.CTXR_Doutside the window andCTXR_AtoCTXR_C. A window inside T8140's firmware RO range is left to that range. The monitor's 2026-10-31 Neo boots relied on all three being there, so the J700 tree gains no entry, and the test fixture now has them there. T8140's firmware RO range is reserved at either EL, as on main.CTRR_CandCTRR_Dare reserved on M4 and later at EL2. At EL1, under aura's hypervisor, kboot says what it leaves to the host:CTRR_Don T8140, both elsewhere. All of it is indt_reserve_secondary_ro().CTXR_AtoCTXR_C, andCTRR_CandCTRR_D, on every chip.CTXRandCTRRread,CTXR_Dincluded, goes throughctxr_range(), under an exception guard, so an unexpected UNDEF on a chip nobody has probed counts as not armed instead of ending the boot. A range whose LWR is 0 isn't armed, in the window check and in kboot alike. A chip with unlocked Apple system registers (M1 to M3) skips CTRR in the window check, as kboot does.The SMP-RO reservations differ from main in three ways.
tests/python/test_secondary_ro_reservations.pyrunsdt_reserve_secondary_ro()for T8140, another M4-or-later chip and M1 to M3, at EL1 and at EL2, and spells each one out:CTRR_Dwhen it is armed. Main never did. It read 0 on the Neo on 2026-10-31, so the J700 tree shouldn't change.CTRR_Cto UPR + 4K, like every other range. Main stopped at UPR, so a 48 KiB range was 0xb000 bytes instead of 0xc000.CTRR_Cthat reads as empty or wrapped gets no entry. Main added a zero-size or wrapped one.One T8140-only piece is left on purpose.
memory_fw_ro_range()answers only on T8140, because its fixed 48 KiB range at a measured place is what the MMU and the chainload placement use there. No other chip has been measured, and the generic path doesn't need it.Things outside the CTXR mechanism keep their chip lists. T8140 refuses a handoff with missing CPUs where other chips boot on fewer. The idle bootargs keep the list of kernels that save WFI state themselves. T8140 adds
arm64.nowfxt, which the linux#985 kernel already forces on Apple parts from M4 on.System registers
apple_sysregs_unlockedkeeps upstream's meaning, and every use has main's truth table. Upstream m1n1 29073cc renamedcyc_ovrdto it: it is false on M4 and later, and gatesCYC_OVRD, RVBAR, the L2C error status and SPRR/GXF. The CPU features record is the same 20 bytes as on main, so every enrolled Stage 1 and current proxyclient keeps working.At EL2 on M4 and later
HACR_EL2, the AppleACTLRbits and the per-core deep sleep enable can be set.CYC_OVRDis undefined there, and with a kcbz-0 object the GXF registers are writable, though aura doesn't use them. The flag's comment says so, but nothing gates on it. aura's hypervisor already writesHACR_EL2andACTLR_EL2on every chip, and Linux finds theACTLRfeatures by AIDR and readback at EL2, so the device tree says nothing about them. The kernel reads no property about this, and I added none. Nothing writes the deep sleep enable for the OS, because a secondary in deep WFI with it set stopped a Neo within 2 seconds.What a confined Mac loses compared with main
cpu_diefor it, so offlining a CPU fails withEOPNOTSUPP. Suspend to RAM and hibernation take secondaries offline the same way.SYSTEM_RESET. Restart needsmacsmc-rebootor the Apple watchdog. The monitor answeredSYSTEM_OFFwith a reset too, so power-off never worked through it, and it needsmacsmc-rebootnow as before.Two costs that stay, and are written down in the docs. aura can't tell whether the kernel was built with
CONFIG_ARM64_CTXR_EXECMEM, and moves one without it all the same. On T8140, T6041, T8152 and the J713 the heap copy of a moved kernel stays reserved with the retained heap: about 1 MiB for U-Boot, about 40 MiB for a kernel booted withboot=. Freeing it would mean editing memreserve entries afterfdt_pack().Measured
booti, on one boot.RELEASE=1 CHAINLOADING=1 BUILTIN_LOGO=aurora) and the ESP Stage 2 (the same withESP_STAGE2=1) build frommake cleanwith no new warnings. pytest overtests/pythonand the two T8122 files gives 597 passed and 47 skipped.format-check(clang-format 20.1.8) andrustfmt-checkpass.aura-raw.ldaligns each section to 64 KiB, so Stage 1 built with Homebrew clang fits under the DCP log buffer only while.textends below its next boundary. With clang 23.1.1 and Rust 1.98.1 it ends 68 bytes short. Nothing could be cut cleanly to win back real room: the C has no dead code left, and building the Rust with opt-levelswould change code on every chip without a hardware test. So a newstage1-clangjob inbuild.ymllinks both stages with Homebrew clang on macos-26, and fails CI before it fails on a Mac. Releases build with gcc. The runner's LLVM and Rust may not match these versions byte for byte, so the job may tell us the margin is gone before this Mac does.Not measured
Conflicts with open PRs
feat/sptm-hv) editssrc/nv2.c,src/pv_kvm.candsrc/monitor.c, which this deletes, so it will conflict.🤖 Generated with Claude Code