I haven’t had much time in recent months to follow up on what’s happening in the KVM or virtualization world. That much bigger was my surprise to find that things are moving on quickly. When I started out 6 years ago to virtualize Windows and run it on Xen using VGA passthrough, I thought I would be forever marked as a geek.
Today I’m looking at dozens if not hundreds of tutorials and websites dealing with VGA passthrough (VFIO), and an ever increasing number of followers. It seems to me this technology or concept is gaining momentum, at least among Linux users.
For those uninitiated in VGA passthrough or VFIO, VGA passthrough allows a Virtual Machine to have direct access to the graphics hardware. In simple terms, it enables you to use Linux as your desktop of choice, and gives you access to a powerful Windows virtual machine for Windows-only games and applications. The performance difference between that Windows VM and a native Windows installation on the same hardware is negligible.
A few years ago this concept required special hardware – most CPUs and graphics cards would not support that technology. But a number of things happened over the last 5-6 years, or to be more precise, people made them happen. For one thing, Intel and AMD executives decided to have the majority of new CPUs support the features needed for VGA passthrough. Today it’s relatively easy to find a suitable and affordable CPU and motherboard.
KVM and Xen developers have pushed this technology forward, adding better support to what had been problematic hardware. UEFI support in newer graphics cards has also helped mitigate issues with VGA arbitration.
Intel went further with its Graphics Virtualization Technology: Intel’s integrated GPUs can be either dedicatedly assigned to a virtual machine (GVT-d); shared between multiple virtual machines on a time-sharing basis while using a native graphics driver (GVT-s); or shared between multiple virtual machines by using a virtual graphics driver (GVT-g). A setup guide for the latter can be found here.
A while ago Nvidia Optimus technology (found in some laptops) presented a insurmountable obstacle to VGA passthrough heaven. Not so today – see GUIDE to Optimus laptop dGPU passthrough.
Lately AMD introduced its powerful Ryzen CPU line, and as VGA passthrough aficionados reported IOMMU grouping issues, the vendor quickly responded with the AGESA 184.108.40.206 firmware update to address this and other issues. A VGA passthrough tutorial for this platform can be found at Level1techs (update: as well as mine here).
One obstacle to the mainstream adoption of running Windows in a VM needs to be overcome, though: The current solution requires two dedicated GPUs, one for the Linux host, and one for Windows. For desktop users this may not be an issue at all, since one can use the IGD (Intel HD or Iris graphics) inside the CPU for the Linux host, and a dedicated graphics card for the Windows VM where performance matters. But many users who run dedicated CPUs and GPUs as well as an even greater number of laptop users with a single integrated graphics processor do not have this choice.
EDIT Jan 9, 2019: Fortunately there is light in sight. Some users have written scripts and instructions on how to reset the (host) GPU, bind it to vfio-pci and run the VM, and vice versa when the VM shuts down. This is also referred to as “single GPU passthrough“. You can find more on that under Single GPU passthrough with QEMU and VFIO and Single GPU Passthrough on Linux.
Looking Glass allows you to display a Windows 10 VM on the Linux host display or any other VM, either full screen or windowed. This requires still 2 dedicated GPUs, but makes a second screen unnecessary. Looking Glass copies the frame buffer of the Windows GPU to a shared memory location from where it is taken by the Linux host and displayed, with next to no latency. It’s still in an experimental stage.
EDIT Jun 6, 2019: One major issue that has plagued passthrough users is crackling audio. Several remedies have been published, but the patch by Reddit user spheenik seems to be the best option for pre-qemu-4.0 versions. Starting with Qemu 4, the patch has been merged and you can enjoy a better audio experience (note the setup in the link!). (Just for reference, my setup using a vanilla Qemu 2.11 does not display the crackling audio issue.)
Intel and AMD are actively contributing to the open source community and making their virtualization technology accessible.
In contrast, Nvidia disables certain features that improve VGA passthrough in its consumer-class products, forcing the user to get the expensive professional products. I’m not sure they are doing themselves a favor with it.
Soon virtualization technology on the desktop computer will come to a level where even novice users are able to install Linux and run their Windows OS in a VM. Some Linux distributions such as Arch Linux, Fedora, and Lime Technology (commercial) make it easy to set up virtualization. Others, I’m sure, will follow.