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. RadeonSI Gallium3D vs. Catalyst At 4K UHD On Linux
  2. MSAA RadeonSI Gallium3D Performance Preview
  3. Intel Core i7 5960X CPU Core Scaling Under Linux
  4. AMD RadeonSI Gallium3D Performance For 4K Linux Gaming
Latest Linux News
  1. Valve Begins Publicly Tracking AMD Catalyst Linux Issues
  2. Digia Qt Spinoff Is Called "The Qt Company"
  3. GNOME 3.14 Makes More Progress In Running Natively On Wayland
  4. Minix 3.3 Released With Cortex-A8 ARM Support, NetBSD Userland Compatibility
  5. More Intel DRM Changes Queued For Linux 3.18, Including Old i830M Fixes
  6. New Code Starts Lining Up For X.Org Server 1.17
  7. Rust Developers Planning For The Rust 1.0 Language
  8. RPM 4.12 Brings New Switches, New Rpm2Archive Utility
  9. Nouveau For Linux 3.18 Gains DP Audio, More Re-Clocking
  10. SUSE Gets Bought Out Again
Latest Forum Discussions
  1. New Group Calls For Boycotting Systemd
  2. support for first generation UVD blocks (RV6xx, RS780, RS880 and RV790)
  3. Nvidia joins the ranks of Apple and Microsoft
  4. Updated and Optimized Ubuntu Free Graphics Drivers
  5. Hd 6850
  6. nv and xorg.conf under Debian PPC
  7. X.Org Is Looking For Some Female Help
  8. FSF Issues Their Rebuttal To Apple's New iPhone, Watch & Apple Pay