From Wikibooks, open books for an open world
< QEMU‎ | Devices
Jump to: navigation, search

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 list[edit]

Function Bus Type Device Usage example
Networking PCI 10Gb/s virtio-net-pci -net nic,model=virtio ...
Storage PCI SCSI virtio-scsi-pci -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 sources[edit]

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's 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's not recommended because of it's poor performance.
Example: -chardev socket,host=,port=9000,id=chr0 -object rng-egd,chardev=chr0,id=rng0

Adding the actual device[edit]

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 Systems[edit]

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