VIRTIO_MMIO(4)

NAME
virtio_mmio - VirtIO memory-mapped I/O transport driver

SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file:

device virtio
device virtio_mmio

Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5):

    virtio_mmio_load="YES"

DESCRIPTION
The virtio_mmio driver provides the memory-mapped I/O (MMIO) transport for virtio(4), as an alternative to the PCI transport used on emulated PCI buses. Instead of being discovered on a bus, each transport instance occupies a fixed window of physical address space and a single interrupt, on top of which the usual front-end drivers such as vtnet(4), virtio_blk(4) and virtio_scsi(4) attach.

The driver implements the legacy (version 1) virtio-mmio register layout. It does not use FDT or ACPI for enumeration. Instead, the address, interrupt and optional unit number of each device are described by the kernel environment (kenv(1)) variables documented below, and the corresponding virtio_mmio children are attached to the nexus pseudo-bus. This makes the driver suitable for lightweight virtual machine monitors, such as QEMU -M microvm and Firecracker, that present virtio devices over MMIO rather than PCI.

LOADER TUNABLES
The following tunables describe the virtio-mmio devices to attach. They can be set at the loader(8) prompt before booting the kernel or stored in loader.conf(5).

hw.virtio.mmio.device
    Describes the first virtio-mmio device.

hw.virtio.mmio.device_N
    Describes an additional virtio-mmio device, where N is a decimal number starting at 1. The variables are consulted in order and enumeration stops at the first value of N that is not set, so the numbers must be contiguous.

Each variable holds a device description of the form:

size@baseaddr:irq[:unit]

The fields are:

size
    Size of the device's MMIO register window in bytes. A single-letter binary suffix (K, M, G, T, P or E, case-insensitive) may be appended, each multiplying the value by 1024.

baseaddr
    Physical base address of the register window.

irq Interrupt number (GSI) delivered by the device.

unit
    Optional device unit number. If omitted, the next available unit is assigned automatically.

The size, baseaddr, irq and unit fields accept a leading ‘0x’ for hexadecimal or ‘0’ for octal, as in strtoul(3). This is the same syntax used by the Linux virtio_mmio.device kernel command-line parameter that many virtual machine monitors emit.

EXAMPLES
Attach a single virtio-mmio device with a 512-byte register window at physical address 0xd0000000 on interrupt 5, by adding to loader.conf(5):

    hw.virtio.mmio.device="0x200@0xd0000000:5"

Attach two devices:

    hw.virtio.mmio.device="512@0xd0000000:5"
    hw.virtio.mmio.device_1="512@0xd0000200:6"

SEE ALSO
kenv(1), virtio(4), virtio_blk(4), virtio_scsi(4), vtnet(4), loader.conf(5), loader(8)

HISTORY
The virtio_mmio driver first appeared in DragonFly 6.5.

AUTHORS
The virtio_mmio driver was adapted for DragonFly from the FreeBSD virtio-mmio transport by Antonio Huete Jimenez <tuxillo@quantumachine.net>. The FreeBSD command-line and kenv device-discovery support it is based on was written by Colin Percival <cperciva@FreeBSD.org>.