1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Memory
  5. Motherboards
  6. Processors
  7. Software
  8. Storage
  9. Operating Systems


Facebook RSS Twitter Twitter Google Plus


Phoronix Test Suite

OpenBenchmarking.org

QEMU: Support For Passing GPUs To Virtual Machines

Linux Kernel

Published on 08 January 2013 01:52 PM EST
Written by Michael Larabel in Linux Kernel
12 Comments

There's ongoing work so that graphics cards can be assigned for use by virtual machines with QEMU.

While VMware and Oracle VM VirtualBox have guest 3D drivers for exposing OpenGL acceleration to guest virtual machines by passing the drawing calls onto the host for processing by the host's drivers and graphics card, KVM/QEMU hasn't advanced in this area although with SPICE they hope to eventually have a Gallium3D solution. Nothing in this area is unfortunately imminent for better guest graphics support with QEMU/KVM.

Another alternative to sharing the host's GPU/driver with a specially-crafted guest 3D driver is for the virtualization platform to support assigning an entire VGA/GPU device for use by the virtual machine. With the virtual machine having direct and exclusive control over the PCI-based device, the virtualized operating system's actual GPU driver could be loaded. Xen virtualization can already do interesting things along these lines with a demo of Xen VGA pass-through support. Unfortunately, it's not too quick and easy setting up VGA/GPU pass-through with Xen.

For those using KVM/QEMU, there's now progress in supporting VGA pass-through / VGA device assignment to VMs. Merged into the Linux 3.6 kernel was the VFIO Linux kernel driver. Linux VFIO is a long-developed kernel component that provides a secure interface for device driver access using IOMMU protection. VFIO can be used to assign physical PCI devices to a Linux virtual machine. From the get-go, one of the early users being planned was for assigning PCI devices to QEMU guests under Linux using VFIO. Previously there was x86-specific KVM assignment code.

While the merged VFIO support has supported PCI devices, it hasn't dealt properly with VGA devices. There's now a new patch to better support assigning VGA devices to virtual machines. The new VFIO-PCI patch adds in device access ranges for legacy MMIO and the I/O port for devices with a PCI class code of VGA. The Linux kernel's VGA arbiter can then change the chipset routing for each access to the VGA ranges per the PCI specification.

Related QEMU patches are also needed for supporting passed graphics adapters to virtual machines. While there's patches floating out there now, it's not all tidied up yet and some additional work is still needed.
"There's also a qemu userspace companion series to this which learns how to look for this new feature flag and setup ranges. Together they get a step closer to supporting vfio-based VGA assignment, but it doesn't yet work. I'm posting in this broken state both for archival purposes as well as the hope that someone has ideas of what might be missing or be able to pick up and run with this code.

Some cards are able to get through execution of their VGA BIOS with these patches, but none that I've seen sync the monitor to VGA text mode from seabios. With a hack in qemu for a card specific backdoor on a Radeon HD5450 I've been able to get syslinux graphics mode to work and Windows will use it during normal bootup. I have no idea what might be missing for VGA text mode."
The new "towards VGA support" patch for the VFIO-PCI Linux kernel component is sitting on the kernel mailing list. Hopefully this work plus other graphics improvements will be ready in the coming months for merging into the Linux 3.9 kernel.

The QEMU user-space patches for working towards VGA device assignment with VFIO can be found on the qemu-devel list. The three patches there are currently marked as not for committing.

About The Author
Michael Larabel is the principal author of Phoronix.com and founded the web-site in 2004 with a focus on enriching the Linux hardware experience and being the largest web-site devoted to Linux hardware reviews, particularly for products relevant to Linux gamers and enthusiasts but also commonly reviewing servers/workstations and embedded Linux devices. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics hardware drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated testing software. He can be followed via and or contacted via .
Latest Linux Hardware Reviews
  1. Intel Xeon E5-1680 v3 & E5-2687W v3 Compared To The Core i7 5960X On Linux
  2. Intel 120GB 530 Series SSD Linux Performance
  3. Btrfs/EXT4/XFS/F2FS RAID 0/1/5/6/10 Linux Benchmarks On Four SSDs
  4. AMD's Windows Catalyst Driver Remains Largely Faster Than Linux Drivers
Latest Linux Articles
  1. NVIDIA vs. Nouveau Drivers With Linux 3.18 + Mesa 10.4-devel
  2. Is The Open-Source NVIDIA Driver Fast Enough For Steam On Linux Gaming?
  3. Linux 3.18 File-System Performance Minimally Changed But Possible Regressions
  4. AMD Radeon Gallium3D Is Catching Up & Sometimes Beating Catalyst On Linux
Latest Linux News
  1. Linux 3.18 Kernel: Not Much Change With Intel Haswell Performance
  2. More File-System Tests Of The Linux 3.18 Kernel
  3. Using NVIDIA's NVENC On Linux With FFmpeg
  4. There's Talk Again About An "Open To The Core" Ubuntu Laptop
  5. PowerVR SGX Driver Code Gets Leaked
  6. V2 Of KDBUS Published For Linux Kernel Review
  7. VirtualBox 4.3.20 Arrives, Still No Sign Of VirtualBox 4.4
  8. Scientific Linux 6.6 vs. Scientific Linux 7.0 Benchmarks
  9. Qualcomm Looks To Get Into The ARM Server Business
  10. HHVM 3.4 Adds New Features, Support
Latest Forum Discussions
  1. Roadmap to Catalyst 14.10 ?
  2. Updated and Optimized Ubuntu Free Graphics Drivers
  3. Cant get working Kaveri APU - A10-7850k
  4. Debian Developer Resigns From The Systemd Maintainership Team
  5. Script for Fan Speed Control
  6. Debian Init System Coupling Vote Results
  7. The Slides Announcing The New "AMDGPU" Kernel Driver
  8. Ubuntu Developers Still Thinking What To Do About Adobe Flash Support