We have given each virtual machine a virtual CPU (via
There is a spectrum of three approaches, trading compatibility against speed: full emulation, paravirtualized devices, and direct hardware passthrough.
The most compatible trick is to have the VMM pretend to be a real device — usually an old, well-understood one like the Intel e1000 network card or an IDE disk. The guest loads its ordinary driver, writes to what it thinks are the card's registers, and every one of those accesses traps into the VMM, which emulates the effect in software (QEMU is the classic emulator).
This works with an unmodified guest — even a decades-old OS that has never heard of virtualization
— which is its great virtue. But it is slow: a single network packet can cause many
The insight of virtio is to stop pretending. Instead of emulating real silicon, define a
virtual device designed for virtualization, and give the guest a driver that knows it is a guest.
Guest and host then communicate through a shared-memory virtqueue: the guest places many
requests into a ring buffer and rings a doorbell once; the host processes the batch and posts
completions back. It is the same batching idea as
Because one notification moves a whole batch, virtio slashes the number of VM-exits and gets close to native throughput. The price is a small loss of transparency: the guest needs virtio drivers (universal in modern Linux/Windows). This is the default for almost every cloud VM today.
For the very fastest I/O, hand the guest a real device to drive directly, with no VMM in the data path at all. The danger is DMA: a device programmed by the guest could be told to read or write any physical memory, escaping its VM. The IOMMU (Intel VT-d, AMD-Vi) solves this — it is an MMU for devices, translating and bounding the physical addresses a device may touch to the guest's own memory, so passthrough is safe.
But one card can only be handed to one VM. SR-IOV (Single-Root I/O Virtualization) fixes
that: a single physical NIC advertises many lightweight virtual functions, each
assignable to a different VM, each appearing as its own device. Guests get near-native network speed. The
cost is flexibility: the VM is now bound to that specific hardware, complicating
This is the whole game, and the answer is the IOMMU. Without it, a device does DMA using
raw physical addresses — so a malicious or buggy guest that owns a real NIC could program it to scribble
over the hypervisor or a neighbouring VM, and hardware isolation would be a lie. The IOMMU sits between
devices and memory exactly as the
It is tempting to reach for SR-IOV everywhere because it is fastest — but each step toward the metal
trades away the very flexibility that made virtualization attractive. An emulated device can be