GPU Passthrough on KVM: A Production-Focused VFIO Guide
A GPU passthrough KVM setup assigns a physical PCIe graphics device directly to one virtual machine through VFIO. The guest uses the vendor driver and accesses the card with much less virtualization overhead than an emulated or paravirtualized display. This is useful for CUDA workloads, rendering, remote workstations, machine learning, and applications that require native driver capabilities. The difficult part is not adding a PCI address to a VM definition. Reliable passthrough depends on firmware settings, IOMMU topology, early driver binding, guest firmware, reset behavior, and a rollback path. A configuration can boot successfully and still be operationally weak if the host occasionally claims the GPU, if another device shares its isolation group, or if the VM cannot recover after a guest reboot. This guide targets Debian and Ubuntu hosts running KVM, QEMU, and libvirt. The same principles apply to other distributions, but bootloader, initramfs, and package commands may diffe...