< QEMU‎ | Devices

VirtIO is a platform for IO virtualization, common to several hypervisors (and QEMU).

The guest operating system needs specialized drivers to handle these devices.

Supported devices listEdit

Function Bus Type Device Usage example
Networking PCI 10Gb/s virtio-net-pci -net nic,model=virtio ...
Storage PCI SCSI virtio-scsi-pci -device virtio-scsi-pci -drive file=disk.img,if=none,id=hd0 -device scsi-hd,drive=hd0 ...
Storage PCI Custom virtio-blk -drive file=disk.img,if=virtio ...
Memory PCI RAM virtio-balloon-pci
Serial PCI Serial virtio-serial-pci
Random Number Generator PCI RNG virtio-rng-pci virtio-rng-pci


Entropy sourcesEdit

To set up a VirtIO RNG, you first need to provide a source of entropy for it.

For devices exported by the kernel on UNIX-like systems, you can do so like this:
-object rng-random,filename=/dev/random,id=rng0

It is obviously not limited to the kernel RNG, you can choose a hardware RNG too in the very same way.

It also supports EGD, though it is not recommended because of its poor performance.
Example: -chardev socket,host=,port=9000,id=chr0 -object rng-egd,chardev=chr0,id=rng0

Adding the actual deviceEdit

Then you can add the actual device, like this: -device virtio-rng-pci,rng=rng0

There's also an option to limit the amount of data the guest received, to avoid starving the host.
Example: max-bytes=512,period=1000 for 512 bytes/s.

Supported Guest SystemsEdit

OS Drivers
Microsoft Windows http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers
Linux-based 2.6.x, 3.x, 4.x
FreeBSD 9.x (available), 10.x (in GENERIC kernel) https://www.freebsd.org/cgi/man.cgi?query=virtio&sektion=4
NetBSD 6.0+
OpenBSD 5.9+