It's not possible? Says who?

Archive for December, 2012

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