It's not possible? Says who?

VGA passthrough to a Xen HVM DomU (Windows 7; Dom0: Arch Linux)

with 3 comments

I don’t like dual boot solutions to switch between Windows and Linux. I’m considering to put Windows into a virtual machine. However, the main reason to keep Windows at all is occasional gaming. Therefore I did a quick & dirty Xen installation to figure out whether this is a viable option for me.

Here are my notes:

  • basic Arch installation using archlinux-2012.12.01-dual.iso
  • as usual, the arch wiki pages were helpful: Official Arch Linux Install Guide, Unofficial Beginners’ Guide, Xen
  • installed xen-hg-unstable using packer
  • used lsusb -t to figure out which usb devices are connected to which root hub
  • used lsusb -v to get PCI-ID (iSerial) of that hub
  • to unbind a device from its driver and make it available for passthrough:
    • echo $ID > /sys/bus/pci/device/$ID/driver/unbind
    • echo $ID > /sys/bus/pci/drivers/pciback/new_slot
    • echo $ID > /sys/bus/pci/drivers/pciback/bind
  • after unbinding the VGA adapter: blank screen – therefore: ssh!
  • created a qcow2 Container for the guest system
  • config file for the VM:
  • name="windows"
    disk = [
    #       "/dev/sda,,hdb,w",
    vif=[ 'bridge=xenbr0' ]
    pci=["00:02.0", "00:1a.0", "00:1b.0"]
  • VNC just shows “serial0 console”, but delivers mouse events!
  • lspci:
  • [...]
    00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
    00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
    00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
  • 00:02.0 is Intel HD Graphics 2000 (from a Core i5-2500T)
  • 00:1a.0 has a keyboard and a mouse attached to it
  • the VM went into standby once, waking it up with ‘xl trigger windows s3resume’ resulted in a bluescreen -> disabled standby in Windows

I installed drivers from the Intel website for the graphics adapter, everything else worked fine out of the box.

To test the performance I used the “Windows Experience Index” and StarCraft II, once in the VM and once in a similar installation running directly on the same hardware:
I combined three screenshots here… left to right: running without Xen; Xen (vcpus=2); Xen (vcpus=4). The degraded hard disk performance is probably due to using a container file instead of a real partition. Apart from the memory operations the results are quite good.

StarCraft II was running at 1920×1200 “Windowed (Fullscreen)”, low settings. I chose one of my last replays, about 20 minutes long, set it to follow the camera of the other player and used Fraps to measure the performance:

[FPS]  min   max   avg
VM:     19    60    41.160
real:   21    60    45.109

For a quick and dirty proof of concept this was quite successful. Next will be an attempt to do VGA passthrough on another machine with a NVidia GeForce GTX560Ti, but I don’t know when I will find time for that, yet.

Written by johnLate

December 17th, 2012 at 1:40 am

Posted in Uncategorized

3 Responses to 'VGA passthrough to a Xen HVM DomU (Windows 7; Dom0: Arch Linux)'

Subscribe to comments with RSS or TrackBack to 'VGA passthrough to a Xen HVM DomU (Windows 7; Dom0: Arch Linux)'.

  1. Nice write up, was looking at doing the same – the low i/o is from using qcow2 should see a boost launching from a lvm container.


    17 Jan 13 at 17:28

  2. good news to read that integrated intel graphics support the VGA passthrough!

    About the disk performance and windows perf index, I’ve seen so far that 5.9 is the max for an HDD, thus 7.3 must be an SSD. Can it be that the virtualized Windows does not recognize the storage as an SSD? Did you try alternative drivers?

    The more I read about Xen, the more it seems it get superseded by KVM…


    10 Feb 14 at 18:38

  3. Wooot, many thanks for the “proof of concept” blog post.

    That’s exactly what I was searching for.
    I’m using KVM (with Ubuntu) instead of Xen, but i wanted to be sure it works before i invest much time in it.

    The games I’m planning to play need DirectX, but they are all satisfied with a “intel HD Graphics 2000” 😉
    A dedicated graphic card would raise the power consumption of my server too hard, even a HD5450.
    (25-30W idle)

    I even got the same CPU like you 😀

    Which Kernel did you use?

    Hans Wurst

    6 Jan 16 at 20:13

Leave a Reply