notes

The HVF leg: the aarch64 suite on the physical core

(Milestone 81. script/ci-build, cargo xtask test --hvf, helpers/qemu-runner-aarch64.sh. The leg rode script/gates from 2026-08-04 until milestone 286 retired that script into script/ci-build's table on 2026-09-13; every measurement below was taken under the old name.)

Every test this project had ever run ran under TCG, where QEMU translates each aarch64 instruction into host code. That is the right default (deterministic, identical on any host), but it is not a real machine: no real caches, no real store buffer, and four "cores" that QEMU round-robins between rather than four cores running at once. Apple's Hypervisor.framework runs the same kernel at guest EL1 on the physical Apple Silicon core, four vCPUs on four host threads, and until the RISC-V board arrives it is the only real silicon this project can test on at all.

The leg runs again on a GICv3 (milestone 227)

Read this before the rest of the page: everything below it describes runs from QEMU 11.0.2 on a GICv2, and that machine no longer starts here.

qemu-system-aarch64: HVF does not support GICv2 emulation

That is QEMU 11.1.1 refusing virt,gic-version=2,accel=hvf, reproduced on 2026-09-02 with no nife kernel involved. From then until milestone 227 the leg had no machine to run on, because the kernel drove GICv2 only; script/ci-build skipped it out loud (milestone 222) and this machine had no accelerated coverage at all.

Since milestone 227 (2026-09-19) the kernel drives GICv3 too, and the runner asks HVF for one (gic-version=3; TCG keeps 2). interrupts.md has the driver. Measured on the first runs, an Apple M-series core, QEMU 11.1.1:

result
boot, four cores over PSCI yes; interrupts : GICv3 ..., ticks on every core
the kernel suite, full run 322 passed, 3 skipped on the final run, exit 0; one test hung in two earlier runs
the scanout and inbound checks pass (compositor, terminal text, test pattern; both listeners)
script/bench --real runs to completion

Two things failed on the way there, and neither is the GIC:

What still happens when the machine will not start (milestone 222's machinery, unchanged): script/ci-build skips the leg and says so; script/test --hvf fails with a paragraph saying the breakage is not yours; cargo xtask test --hvf asks before standing up its referees. All of it comes from one probe in helpers/qemu-runner-aarch64.sh that starts the runner's own machine string paused and quits it, so nothing tests a QEMU version number.

How to run it

script/ci-build         # every local check, cheapest first, with this leg last
script/ci-build hvf     # just this leg, through the table
script/test --hvf       # just this leg, with no probe and no loud skip

--hvf is aarch64 only and says so if you ask for anything else: Hypervisor.framework runs the host's own ISA, so --arch riscv64 --hvf is refused, and so is --cpu, because the guest runs the physical core and -cpu host is the only answer.

It skips the host-logic crates, the vendored RedoxFS round trip and the redoxfs_server core, and prints one line saying so. Those are host code on the host; no accelerator exists on that path, so re-running them costs about 30 seconds and proves nothing the TCG leg has not. What the leg does re-run is everything an accelerator can change: the 234 kernel tests under QEMU, the host-side scanout referee, and the post-run image checks.

What it costs (measured 2026-08-04, M-series, warm build)

command what ran wall clock
script/test --arch aarch64 host crates + the 234-test aarch64 kernel suite under TCG + image checks 58 s, 52 s
script/test --hvf the same 234-test suite on the physical core + image checks 16 s, 12 s
cargo test --workspace --exclude kernel --exclude user --exclude user_mode_runtime the host crates alone 14 s

The counts here read 232 when the timings were taken, and are 234 in the merged tree: milestone 86's time brought two kernel tests with it. The number is a fact about the whole suite rather than about this leg, so it is taken at the merge (CLAUDE.md), and the wall clocks are left as measured because two tests do not move a twelve-second figure.

Two samples each, on a machine that was not otherwise idle (another lane was building). Subtract the 14 seconds of host crates that only the TCG row contains. The comparison is then about 40 s against about 14 s for the same fixtures, the same 234 tests, and the same post-run image checks. That is roughly a 3x win on the leg, and more on the booted suite alone, since a fixed few seconds of both numbers is cargo and image building.

So the leg adds 12 to 16 seconds to the local run. Timing it before adopting it was the condition milestone 81 (an HVF leg: the test suite on the physical core) set. The --full flag the block named as the fallback is not needed, because native execution beat TCG by the margin the block hoped for.

Why the local tier and not a workflow

GitHub's hosted macOS arm64 runners are themselves virtual machines and do not expose nested virtualization, so HVF does not exist there. A self-hosted runner on the dev machine would close that gap and is deliberately not part of this: it couples CI to a laptop that sleeps.

script/ci-build with no arguments is the one command a person or an agent runs before pushing, which makes it the place where every lane on this machine picks the leg up for free. The leg is a local row in its table, and there is no CI job for it at all. When the host cannot supply HVF the leg skips loudly. It names the reason (not macOS, not Apple Silicon, kern.hv_support off, or a QEMU built without the accelerator), and it says in plain words that nothing in the run executed on a physical core. A silent omission would let a Linux CI transcript read exactly like one from this laptop, and the whole point of the leg is that those are not the same evidence.

Semihosting is not answered under HVF, and this is what that looks like

The test harness reports its verdict by asking the host to exit through semihosting. QEMU 11.0.2 does not intercept ARM semihosting on the HVF path. The hlt trap is not swallowed: it raises an Unknown-reason exception in the guest, the panic handler tries to exit the same way, and four cores write interleaved garbage forever. So the host ends the run. hvf_kernel_leg reads the transcript for three markers printed before the exit (test result: ok. N passed, [PANIC] , WATCHDOG:), relays 200 more lines after a failure, and stops. The probe, the exception and why the relay is bounded are in hvf-leg/semihosting.md.

The SMMU correction

helpers/qemu-runner-aarch64.sh attaches iommu=smmuv3 on the HVF path as well as TCG. smmuv3 emulation alongside HVF acceleration is not a fragile combination: the suite on the physical core runs green with the SMMU attached, including a_backing_outside_the_grant_is_refused_by_the_iommu, the test that asserts the hardware faults a DMA leaving its domain.

Without the SMMU under HVF the compositor test fails outright ("a virtio-gpu is present but the IOMMU is not active"), and the DMA-confinement tests would have no hardware to assert about. Both paths are where the flag belongs on principle too. The accelerator chooses how CPU instructions execute, while the SMMU sits in front of the PCIe root complex and translates device traffic that QEMU emulates in the host process either way. This is a correction to the record, in the sense CLAUDE.md means: the machine overruled the comment.

What the physical core found: five assertions about "has it happened yet"

Every failure belonged to the milestone-78 family (notes/load-sensitive-assertions.md), found from the opposite direction. A slow machine produces a deficit, and HVF is a fast machine that produces the same deficit for the mirror-image reason. A yield count is not a duration in either direction. They arrived one per run, over five runs, so the leg is a sampler of this defect, not a detector.

The five were the revoked waiter, the worker that made no progress, the corpse that never parked, a supervision reclaim with no assertion, and the spinner that never ran. Each yield count became a wait_for on the state it was waiting for, and the spinner's vacuity guard now waits for the spinner to have spun. None of these was a timer-behavior failure, which is the finding worth stating plainly. Each test, its failure and its fix are in hvf-leg/five-assertions.md.

Timer behavior: what did NOT differ, and why

Under HVF guest time is host time (CNTVCT_EL0 is passed through at the host's 24 MHz) and there is no icount instrument, so the milestone expected the wall-clock assertions to be the casualties. None of them failed. The reason is milestone 78 (the load-sensitive assertions). The timer-drift twins are aimed at the re-arm law: over a window in which MISSED_TICKS did not move, the deadline advanced by exactly one interval per delivered tick. That law is a statement about state the kernel owns, not about how fast the clock runs. A test that measures the right thing does not care which accelerator it is on.

The only wall-clock timer exposure this leg inherits is ticks_arrive_at_the_configured_rate's retry budget, which reports UNMEASURED instead of failing (milestone 62 (tests that assert on time: make a red run mean something)). HVF makes it no worse in principle: a deschedule of a host thread running a vCPU produces the same missed tick either way. The local tier runs script/icount before script/test, so this leg is preceded by an instrument the accelerator cannot influence at all.

The settle windows the leg makes weaker, not flakier

Three sites spend 400 yields to "let it settle" and then assert that nothing more happened. A shorter real settle window makes that negative assertion easier to pass, so the leg proves less there rather than going red. They are left alone deliberately, because turning a settle window into a duration is a design question. The three sites are named in hvf-leg/five-assertions.md.

BUGS

See also