What you should know about VFIO

6.18 LPAR mode KVM guest

Depending on the device type, Linux® handles devices with specific device drivers.

Figure 1. Device drivers on Linux

This graphic shows PCI function as associated with a PCI device driver, a DASD with the DASD device driver, and a crypto adapter with the zcrypt device driver.

For Linux on KVM, QEMU provides virtual VFIO pass-through devices that preserve the host-device attributes. Therefore, Linux on KVM accesses a pass-through device with the same device driver that the host would use to access the corresponding host resource. For example, Linux in LPAR mode uses the DASD device driver to access DASDs. Correspondingly, Linux on KVM uses the DASD device driver to access VFIO pass-through DASDs.

Figure 2. Device drivers for VFIO pass-through devices

This graphic shows virtual PCI function as associated with a PCI device driver, a virtual DASD with the DASD device driver, and a virtual crypto adapter with the zcrypt device driver.

To avoid contention, a KVM host must relinquish direct control of the host resource that backs a VFIO pass-through device. For these host resources, the VFIO framework substitutes the default device drivers on the KVM host with device-specific VFIO device drivers. These substitute device drivers reserve host resources for guest use and provide access to these resources on behalf of the guest.

On IBM® Z, the KVM hypervisor supports the following types of pass-through devices:
  • PCIe
  • CCW (DASD)
  • Cryptographic adapter resources (AP queues)
Figure 3. VFIO virtualization

This graphic is described in the surrounding text.

On the host, you must define the resources that back a VFIO pass-through device and associate these resources with the applicable VFIO device driver. The necessary configuration steps depend on the device type. For pass-through DASD and pass-through cryptographic adapter resources, you must create specific VFIO mediated devices. The KVM hypervisor then uses VFIO mediated devices as a source for pass-through devices.