VFIO
Preliminary Notes
This project aims to be an introductory piece on setting up a successful VFIO (Virtual Function I/O) system. Although this is a relatively safe process, important data should still be backed up in case of a system failure.
Background
VFIO is a device driver that lets host operating systems (systems installed on bare metal) “pass through” devices to the guest operating system (virtual machines). Technologies such as KVM, QEMU, and others treat virtual machines like another program, so if a demanding program inside the VM such as Unreal Engine, Unity, Photoshop, Autodesk Maya, Solidworks, or another GPU/CPU intensive program is launched, the host machine would attempt to run the demanding programs with multiple layers of compatibility.
VFIO allows the VM to have direct access to PCIE devices such as a GPU, which results to minimal to no difference in performance compared to running the programs on an OS that was installed on bare metal. In other words, VFIO allows a VM (Virtual Machine) to get direct access to PCIE devices such as GPU’s, which enable guests OS’ to run demanding programs, with the limitation of isolating the passed device to the guest OS using it.
Requirements
The machine in question has to have the following components:
- Intel/AMD CPU that supports hardware virtualization
- Motherboard that supports IOMMU (Intel VT-* or AMD-Vi)
- Guest PCIE-Device must support UEFI
- Host GPU, or ability to SSH into the host machine
If the above requirements are met, ensure the Guest GPU is non-primary (booting screen should be shown on a monitor connected to the host GPU, not the guest GPU).
Setup
Before any further steps, enable SVM IOMMU VD-d VT-x.
ARCH Linux
Setting Kernel Parameters
PopOS (Debian)
Download all the dependencies needed
apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager ovmf