VMM(4)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1, nixpkgs unstable

πŸ’… VMM(4) β€” the Kernel Interfaces Manual page, but make it cute ✨

okay bestie, so this is the vmm.ko page from the Kernel Interfaces Manual, and it's literally the manual for the bhyve virtual machine monitor. no cap, it's giving "kernel module that runs your whole virtual machine situation" energy. let's get into it 🫢


✨ NAME ✨

vmm.ko β€” the bhyve virtual machine monitor, periodt. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

okay so to load the driver as a module at boot, you literally just add this line to loader.conf(5):

vmm_load="YES"

and you can also load it manually with kldload(8) like this:

kldload vmm

slay, that's it. easy. 🌸


πŸ¦‹ DESCRIPTION πŸ¦‹

so vmm.ko provides the kernel portion of the bhyve(4) hypervisor. it's the main character energy behind your VMs, fr fr. the following platforms are supported:

  • amd64: you need an Intel CPU with VT-x/EPT or an AMD CPU with SVM support. no exceptions, bestie. πŸ’»
  • arm64: the boot CPU must start in EL2 and the system must have a GICv3 interrupt controller. VHE support will be used if available, which is lowkey iconic. πŸ“
  • riscv: the CPUs must implement the H (hypervisor) RISC-V ISA extension. like, they gotta have the hypervisor vibes built in. 🌈

PCI device passthrough to a virtual machine requires hardware with VT-d support and is available only on amd64. so if you're on arm64 or riscv and you wanted passthrough, that's a no from the universe, sorry bestie 😭


πŸ’œ PCI PASSTHROUGH πŸ’œ

on amd64 where the hardware supports VT-d, PCI devices can be reserved for use by the hypervisor. here's the tea: entries consisting of the PCI bus/slot/function are added to the pptdevs loader.conf(5) variable. additional entries are separated by spaces. host PCI devices that match an entry will be assigned to the hypervisor and will not be probed by FreeBSD device drivers. so like, they're claimed by vmm and the host drivers are like "not me, not today." πŸ’…

see the EXAMPLES section below for sample usage, iykyk.

⚠️ okay so this is important: vmm must be given first the right of refusal to all pci(4) devices it may need to claim. as a result, the vmm kernel module almost certainly needs to be loaded from loader.conf(5) rather than by adding it to kld_list in rc.conf(5). that's the vibe check, don't fight it. πŸ™ˆ

a large number of PCI device entries may require a string longer than the 128-character limit of loader.conf(5) variables. when that happens, the pptdevs2 and pptdevs3 variables can be used for additional entries. so you're not stuck, bestie. ✨


🌟 LOADER TUNABLES 🌟

tunables can be set at the loader(8) prompt before booting the kernel or stored in loader.conf(5). here's the one tunable on this page:

  • hw.vmm.maxcpu β€” maximum number of virtual CPUs. the default is the number of physical CPUs in the system. so like, if you have 8 physical CPUs, you get 8 as the default. math is mathing. πŸ”₯

🧚 EXAMPLES 🧚

reserve three PCI devices for use by the hypervisor: bus 10 slot 0 function 0, bus 6 slot 5 function 0, and bus 6 slot 5 function 1. you literally just write this:

pptdevs="10/0/0 6/5/0 6/5/1"

it is possible to detach ppt from a PCI device without rebooting the host machine and then attach a host driver, using the devctl(8) utility. like, living your best life, no reboot needed. πŸ’–

suppose ppt is currently attached to pci0:0:1:0 and we want the host's xhci(4) driver to be attached instead:

# devctl set driver -f pci0:0:1:0 xhci

the same can be applied to attach ppt back:

# devctl set driver -f pci0:0:1:0 ppt

see? iconic. you can switch drivers like changing outfits. πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

go read those if you want the full lore. you're welcome. 🫢


🌸 HISTORY 🌸

vmm.ko first appeared in FreeBSD 10.0. arm64 and riscv support first appeared in FreeBSD 15.0. so like, it's been around for a minute, and the new platforms are the fresh era. periodt. πŸ’œ


πŸŽ€ AUTHORS πŸŽ€

  • Neel Natu <neel@freebsd.org>
  • Peter Grehan <grehan@freebsd.org>

these two literally built this. show some respect. πŸ‘‘


and that's the vibe check! this page is from Debian, dated December 30, 2024, and it's VMM(4) in the Kernel Interfaces Manual. if you made it this far, you're a real one. now go load vmm and run some VMs, bestie. slay. πŸ’…βœ¨

πŸ“¦ where this page comes from