Thursday, 16 February 2017

Virtualization VGA Passthrough Concepts

VGA Passthrough Concepts and Terminology

I want to run Windows CAD on my Linux box without dual-booting.  Realistically, that means running a VM with GPU passthrough.  Under the current state of things, that means a separate VGA monitor.  That in turn means passing my USB keyboard and mouse back and forth between the VM and the host.  That's complicated.

**Update 2018:** The Looking-Glass project provides low-latency screen transfer.  Think of it as no-lag VNC.  Alterate UI no longer necessary, although mouse integration is still sketchy.

**Update 2017**: Used a modern PCI-E Nvidia adapter, and it mostly just works with LibVirt and OVMF/UEFI.  There are a few hoops to jump through to fix the Code 43.

Here's the (editorialized) terminology list I wish I'd had before setting off on this journey.

Hypervisor - The VM software.  Think of type 2 as emulation software that runs in your OS, perhaps using hardware acceleration (EG, VirtualBox).  Type 1 is like an OS container that runs on the bare metal (eg Xen and KVM).  Qemu-KVM is essentially type 2, but uses the KVM kernel modules to get many of the advantages of a type 1.

VirtualBox - Oracle's type 2 hypervisor.  Runs on Windows, OSX, and Linux.  I could not get VGA passthrough working on it.

Qemu - an open-source hypervisor.  Most of the VGA passthrough guides for it walk you through constructing a very hairy Qemu commandline.  That's unfortunate, because it precludes using the Libvirt management gui (below).

Passthrough - providing the VM with direct access to hardware.  In our case, this is a PCI, PCIe, or USB device.

VGA Passthrough - Providing the VM with hardware access to a display device.

GPU Passthrough - Mostly (incorrectly) used synonymously with VGA passthrough.  However, it also includes the concept of passthrough of a GPU that is *not* the display device, something that isn't possible on any of the Linux Hypervisors AFAIK.

Composing - This is the best word I have seen for the concept of passing through a rendering GPU which is something other than the display device.  In theory, you might passthrough a PCIe GPU for rendering your CAD model, and compose the display to your virtual display device.  None of the Linux hypervisors I've looked at can handle this.

Libvirt - a virtualization API, providing a consistent management interface for pretty much every linux hypervisor out there except VirtualBox.

USB passthrough - super easy on VirtualBox.  Super easy on Qemu, if you define it in the commandline. 

USB passthrough hotplug - This is built into the gui in Virtualbox.  Impossible in Qemu, without libvirt.  If you want to hotplug a usb device to a running libvirt VM, you need to use virsh, basically a commandline front end for libvirt.  I never found a way to do it without libvirt  (meaning if you ran your qemu VM from the commandline, you're out of luck).

http://rolandtapken.de/blog/2011-04/how-auto-hotplug-usb-devices-libvirt-vms-update-1


No comments:

Post a Comment