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. Even With Re-Clocking, Nouveau Remains Behind NVIDIA's Proprietary Linux Driver
  2. The Power Consumption & Efficiency Of Open-Source GPU Drivers
  3. AMD R600g/RadeonSI Performance On Linux 3.16 With Mesa 10.3-devel
  4. Intel Pentium G3258 On Linux
Latest Linux Articles
  1. Updated Source Engine Benchmarks On The Latest AMD/NVIDIA Linux Drivers
  2. Nouveau vs. Radeon vs. Intel Tests On Linux 3.16, Mesa 10.3-devel
  3. KVM Benchmarks On Ubuntu 14.10
  4. X.Org Server 1.16 Officially Released With Terrific Features
Latest Linux News
  1. GNOME/GTK On Wayland Gains Focus At GUADEC
  2. GNOME Stakeholders Take Issue With Groupon Over their Gnome
  3. GStreamer VA-API Plug-In Update Adds New Features
  4. Qt 5.4 Going Into Feature Freeze Next Week With Exciting Changes
  5. OpenSUSE Factory Turns Into Rolling Release Distribution
  6. "The World's Most Highly-Assured OS" Kernel Open-Sourced
  7. NVIDIA Is Working Towards VDPAU H.265/HEVC Support
  8. Hawaii Bug-Fixes Start Hitting Mainline RadeonSI Gallium3D
  9. The FFmpeg vs. Libav War Continues In Debian Land
  10. Grand Theft Auto Running On Direct3D Natively On Linux Shows Gallium3D Potential
Latest Forum Discussions
  1. Linus Torvalds On GCC 4.9: Pure & Utter Crap
  2. AMD Athlon 5350 APU On Linux
  3. Updated and Optimized Ubuntu Free Graphics Drivers
  4. Debian + radeonsi
  5. Open-source drivers on ATI R7 260X
  6. List of Linux friendly Kickstarter projects
  7. Porting Mesa to the Playstation 2
  8. ASRock AM1H-ITX: One Of The Best AM1 Mini-ITX Motherboards