[ovirt-devel] hostdev (VFIO) passthrough

Martin Polednik mpolednik at redhat.com
Mon Nov 10 14:03:29 UTC 2014


Hello everyone,

I've been working on hostdev passthrough for some time, and since
the last mail is buried deep in the mailing list graveyard, here is small
update on what's happening and how is the feature progressing.

QEMU supports passthrough of devices via device driver called VFIO
(Virtual Function I/O). This driver allows users and system administrators
to assign physical device to a virtual machine, bypassing virtualization
overhead. In order to execute this safely, IOMMU (I/O memory management unit)
needs to be present on the host. IOMMU acts as a bridge between access to bus
and device DMAs on it, allowing for a safe IRQs to be sent to the devices from
VMs without memory corruption from the host.

VFIO uses IOMMU group as atomic unit for passthrough, meaning every device on
the bus needs to be attached to the VM in order to keep the safety (possible
to override in an unsafe way, not recommended outside of testing).

Special kind of PCI devices exist that support SR-IOV (Single Root I/O Virtualization).
These devices act as multiple devices, where PF (Physical Function) is the physical
device itself and VFs (Virtual Functions) are endpoints for virtual machines. PF itself
will most likely share IOMMU group with it's bus and possibly more devices while VFs
should, if bus has enough bandwidth) be in the group alone.

VDSM currently supports reporting the whole device tree (incl. normal devices, PVs and VFs)
and soon enough basic support for any kind of passthrough will be ready.

SR-IOV introduces few complications when it comes to assignment and migration -
since VF is bound to PF, and specific PF might be bound to some hardware, we encounter
3 kinds of SR-IOV device assignment

* port and PF matters -> we need to decide which PF VF belongs to (possibly networks)
* PF doesn't matter -> we only need to find *some* suitable VF (possibly GPUs)
* device is not SR-IOV at all 
    -> we need to find *some* suitable device  (everything else...) *OR*
    -> we need the same port (e.g mapping host1 pci address to host2 pci address)

As hostdev passthrough feature is progressing, I would like you
to look at updated http://www.ovirt.org/Features/hostdev_passthrough.
Any questions/comments are more then welcome!

Martin Polednik



More information about the Devel mailing list