roadmap NOT-STARTED

926. Linux runs as a guest, with nife as the hypervisor

Raised on 2026-10-12 (UTC) by the lane maintainer/proposal-linux-guests. calef asked that day, "What would it take to be able to host Linux on nife?", and chose the hypervisor answer: an unmodified Linux kernel boots as a guest virtual machine, and nife owns the hardware underneath it.

The other answer is milestone 621 (a Linux persona server), which runs Linux programs by translating their system calls onto nife capabilities. It is not this proposal. How the two relate is below.

Reuse: the mechanism is written here, because it is kernel code at EL2, and §46 (thin primitives or whole subsystems; we write everything in between) asks the kernel to be ours. The shapes are borrowed. seL4's Arm hypervisor mode is the model for the objects and the exit path, and KVM's arm64 port is the model for the EL2 register handling. Both are from memory and were not re-read for this proposal. The guest is stock upstream Linux, unmodified.

What the tree already has

Each of these was read on 2026-10-12, not taken from the brief.

Milestone 449's refusal was stale when it was written

Milestone 449 (the EL2 to EL1 drop) is REFUSED. It was backfilled on 2026-09-20 from a 2026-09-03 bullet in milestone 2 (exception vectors, and a fault that tells you what it was), which said QEMU's virt enters at EL1 and so the drop would have no caller. The drop had been built and rehearsed on 2026-09-02, by milestone 127, with QEMU's virtualization=on as the caller. Its revisit condition ("an aarch64 machine whose firmware hands this kernel EL2") was met on QEMU before 449 existed. So the refused work exists and is on main. The record wants correcting to say so; this proposal does not edit 449.

The drop is also the thing a hypervisor undoes. A host kernel stays at EL2, so rung 1 turns the drop into a choice: drop when there is no reason to stay, stay when the machine will host guests.

HVF offers EL2 on an M3, which the tree says it cannot

The runner refuses NIFE_EL2 under HVF, saying HVF "has no nested virtualization to offer". design/driver-domains.md says the same. On 2026-10-12 a 36-byte probe was run on an Apple M3, macOS 26.6.2, QEMU 11.1.2. It reads CurrentEL, writes the level as a digit to the PL011, and waits. The result:

machine printed
accel=tcg,virtualization=on, -cpu max 2
accel=hvf, -cpu host 1
accel=hvf,virtualization=on, -cpu host 2

So QEMU 11.1.2 on this host enters a guest at EL2 under HVF. Apple documents the API (hv_vm_config_set_el2_enabled). A third-party report says Apple enables it on M3 and later only (LWN comment, 2025-09-20), which was not checked against an older chip. What was not measured: whether stage-2 translation, the virtual timer and the GIC's virtualization interface work for a hypervisor running inside it. A QEMU commit from June 2025 still described HVF as unable to offer EL2 (commit), so the change is recent and its edges are unknown.

The shape

Two new kernel objects

Names are provisional, and an architect names them.

"Virtual CPU" is the spoken phrase, and CPU stays whole under §154 (the acronym test is whether the phrase is spoken, applied recursively), hence VirtualCpu rather than Vcpu. seL4 reuses its VSpace object for stage-2; a separate type here keeps a stage-1 capability from ever being mapped as a guest's physical memory.

The exit path is the fault path

A guest exit the kernel does not handle itself suspends the thread. The kernel then sends one message on the thread's existing fault endpoint (the reserved slot CAPABILITY_TABLE_SLOTS - 1). The message carries the syndrome, the faulting guest-physical address and the access size. Those exits are a stage-2 abort on an unmapped address, an hvc, an smc and a trapped system register. The VMM replies with register writes and a resume.

The kernel handles wfi (block the thread until a virtual interrupt is pending) and the virtual timer, because sending those to userspace costs an IPC round trip per guest tick.

The system call surface

No new system call number. Everything is SYSTEM_CALL_INVOKE on the two new objects. The method list is provisional: GuestAddressSpace::MAP and UNMAP; VirtualCpu::BIND, READ_REGISTERS, WRITE_REGISTERS and INJECT. The exit message layout is a wire format. Two new object types are the deliberate growth kernel/src/cap.rs says each Object variant is, so they need a section in design/decisions/. That is why decision_dependencies is unwritten.

The VMM is an ordinary process

A virtual machine monitor (VMM) is a nife program like any other, spawned and confined by its grants. It holds the GuestAddressSpace, one VirtualCpu per guest CPU, the guest's memory as PageFrames, and endpoints to the servers it fronts. It maps the guest's memory into its own address space as well, which is how it reads a virtqueue. That is the model of §10 (process model: capability-based, microkernel), where IPC carries control and shared memory carries data, with the guest as one of the parties.

Every device the guest sees is emulated in the VMM, never in the kernel. The kernel learns that virtual machines exist; it never learns that Linux exists.

The rungs

Rung 1: one guest CPU boots Linux to its root-filesystem panic

nife stays at EL2 when asked to host. The two new objects exist. Exits reach a VMM. The VMM emulates a PL011 and a GICv3 distributor through stage-2 aborts, and answers PSCI over hvc. The kernel injects the virtual timer's interrupt through one list register.

Linux needs some interrupt controller even to reach its panic: arm64 panics with "No interrupt controller found" without one. So rung 1 carries the smallest virtual GIC that delivers one private interrupt to one CPU.

Rung 2: a real virtual GIC, and guests with several CPUs

List-register save and restore on every switch, the maintenance interrupt, more pending interrupts than list registers, virtual SGIs between guest CPUs, and a VirtualCpu that migrates between physical cores with its thread.

Rung 3: virtio devices served by the VMM against nife's servers

The VMM offers virtio-mmio devices to the guest and serves each from a server nife already runs. virtio-console goes to the console server, virtio-blk to a file on nifefs through the filesystem server, and virtio-net to the network stack as one more interface.

Rung 4: device passthrough behind SMMU stage-2

A guest drives a real device itself, and the SMMU confines that device's DMA to the guest's memory. This rung and rung 1 are the whole of driver domains.

The brief named milestone 143 as this rung's dependency, and that is wrong. Milestone 143 (silicon IOMMU) is the RISC-V IOMMU on a RISC-V board, and it says outright that SMMUv3 on aarch64 silicon is not in it. The real dependency is milestone 16's SMMUv3 driver, which needs stage-2 stream table entries pointing at a GuestAddressSpace. QEMU's SMMUv3 only fronts the PCIe bus, so the passed-through device is a virtio-pci or e1000e function on the bus §18 (the PCIe transport) already enumerates. QEMU 11.1.2's arm-smmuv3 lists a stage property; which values it accepts was not checked.

Rung 5: x86_64 guests

VT-x with EPT, a VMCS per VirtualCpu, and the same exit path. xenon's Core i5-7500T has VT-x and EPT, from Intel's published specification as recalled, not re-checked. The test leg is the open problem. To recollection, QEMU's TCG emulates AMD's SVM and not Intel's VMX, so an emulated leg would exercise a different extension from the one xenon has.

The §19 scope note

A host capability on aarch64 alone is the gap §19 (architectural parity is a tenet) says must be recorded with a plan. riscv64's answer is the hypervisor extension. QEMU's TCG implements it; radon's JH7110 does not have it, so there is no silicon to carry it to. The plan is rung 5's shape again, with the objects unchanged: a second architecture after the first works, not three at once.

How the tree would test it

NIFE_CPU=max is required because cortex-a72, the TCG default, is Armv8.0 and has no VHE.

Cost and risk

The size is driver-domains.md's: about the whole EL0 story again. Rung 1 is the largest, because it is where the kernel first runs as a host. Rung 3 is mostly VMM code outside the kernel. No line count is offered because none was measured.

The risks, plainly:

How this relates to milestone 621

Milestone 621 runs Linux programs on nife with no Linux kernel; the persona translates. This runs the Linux kernel itself, and nife knows only that a virtual machine exists.

The persona is cheaper per guest and keeps a program inside nife's capability model. It covers only the system calls somebody writes, and 621 refuses the subsystems podman needs (namespaces, cgroups, overlayfs). A virtual machine runs all of Linux, podman included, at the price of a whole guest kernel and its memory. The two do not compete for mechanism: 621 needs no EL2, and this needs no system call translation. They answer different customers. One wants a Linux binary to run on nife; the other wants a Linux machine next to nife's own programs.

Rulings

calef answered the four questions on 2026-10-12 (UTC), relayed on #2004.

  1. VHE only, no split design: "Only VHE. We want to target nife to newer hardware." argon does not host guests.
  2. Exits arrive on the thread's existing fault endpoint: "Fault endpoint."
  3. The test Image is the arm64 kernel from Ubuntu's most recent LTS release, pinned by checksum: "Use Ubuntu's kernel from their most recent long term release." The pin moves when a newer LTS ships.
  4. Rung 1 waits behind the customer path and milestone 621: "Wait".

Found while writing this

All three are bookkeeping or a test leg, and rung 1's lane is their home if no earlier lane takes them.

Index row

nife as a hypervisor at EL2, running an unmodified Linux kernel as a guest. Two new objects (a stage-2 address space and a virtual CPU), exits delivered on the existing fault path to an ordinary VMM process, and every device emulated outside the kernel. Five rungs: one CPU to the root-fs panic, a real virtual GIC and SMP, virtio served by nife's own servers, passthrough behind SMMU stage-2, then x86_64. It shares all of its mechanism with driver domains and none with milestone 621's persona.