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. A Walkthrough Of The New 32 System Open-Source Linux Benchmarking Test Farm
  2. Habey MITX-6771: Mini-ITX Board With Quad-Core J1900 Bay Trail
  3. OCZ Vector 150 SSD On Linux
  4. Noctua i4 CPU Cooler: Great For Cooling High-End LGA-2011v3 CPUs
Latest Linux Articles
  1. AMD Kaveri: Open-Source Radeon Gallium3D vs. Catalyst 14.12 Omega Driver
  2. 12-Way AMD Catalyst 14.12 vs. NVIDIA 346 Series Linux GPU Comparison
  3. AMD Catalyst 14.12 Omega Driver Brings Mixed Results For Linux Users
  4. 6-Way Winter 2014 Linux Distribution Comparison
Latest Linux News
  1. FSF's High Priority Project List Now Has A Committee
  2. Details On Using OpenACC & GPUs With GCC
  3. Ubuntu 15.04 Alpha 1 For Its Various Flavors
  4. Git 2.2.1 Released To Fix Critical Security Issue
  5. WTFTW: A Tiling Window Manager Written In Rust
  6. Jolla's Sailfish OS Update 10 Is Now Available
  7. HP To Launch Linux++ Operating System Next Year
  8. Civilization: Beyond Earth Launches For Linux
  9. NIR Has Been Revised As A New IR For Mesa
  10. New 64-bit Linux Kernel Vulnerabilities Disclosed This Week
Latest Forum Discussions
  1. XLennart: A Game For Systemd Haters With Nothing Better To Do
  2. Debian init discussion in Phoenix Wright format
  3. Bench specific mount point
  4. Tool for measuring FPS in games
  5. Need some hand holding with upgrading xserver
  6. Ubuntu Developers Still Thinking What To Do About Adobe Flash Support
  7. Microsoft buying Mojang
  8. Updated and Optimized Ubuntu Free Graphics Drivers