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. Scythe Mugen MAX
  2. Intel Core i7 5960X Haswell-E On Linux
  3. Intel 80GB 530 Series M.2 SSD On Linux
  4. With A New Motherboard, The Core i7 5960X Haswell-E Lights Up
Latest Linux Articles
  1. Intel P-State vs. CPUFreq Benchmarks On The i7-5960X
  2. RadeonSI GLAMOR Benchmarks With X.Org Server 1.16
  3. RadeonSI Gallium3D vs. Catalyst At 4K UHD On Linux
  4. MSAA RadeonSI Gallium3D Performance Preview
Latest Linux News
  1. X.Org Server Shatter Project Fails
  2. X.Org Women Outreach Program Only Turns Up Two Applicants So Far
  3. Fedora 21 Alpha Finally Coming Next Week
  4. Ubuntu Touch/Phone Reaches Its First RTM Image
  5. The KMS Mode-Setting Driver Was Imported For X.Org Server 1.17
  6. SNA & UXA Intel Benchmarks With X.Org Server 1.16
  7. Graphics Driver Changes Coming In The Linux 3.18 Kernel
  8. Tropico 5 Being Released For Linux Gamers This Week
  9. Eclipse IDE Starts Firing Up On Wayland's Weston
  10. OpenSUSE Announcement On SUSE's Recent Merger
Latest Forum Discussions
  1. Stop grabbing my keyboard :(
  2. New Group Calls For Boycotting Systemd
  3. Updated and Optimized Ubuntu Free Graphics Drivers
  4. Best Radeon for a Power Mac G5?
  5. New stress testing utility for GPU's
  6. Hd 6850
  7. support for first generation UVD blocks (RV6xx, RS780, RS880 and RV790)
  8. Nvidia joins the ranks of Apple and Microsoft