Differences between revisions 15 and 16
Revision 15 as of 2013-02-09 03:11:02
Size: 4844
Editor: ?GregValcourt
Comment:
Revision 16 as of 2013-02-09 09:48:48
Size: 4804
Editor: GeoffSimmons
Comment: InterWiki.
Deletions are marked like this. Additions are marked like this.
Line 80: Line 80:
[[http://wiki.debian.org/KVM|KVM]]
[[http://en.wikipedia.org/wiki/IOMMU_hardware_list|IOMMU Hardware List]]
 * [[KVM]]
 * [[WikiPedia:IOMMU_hardware_list|IOMMU Hardware List]]

Translation(s): none


Introduction

Here's a How To on creating a VGA passthrough for a Windows 7 guest. I spent a lot of time trying to get it to work. First with Xen: I couldn't get a straightforward HVM going even without a passthrough, and starting a guest would sometimes reboot my host machine! Then I tried KVM on Debian Squeeze: at least I could install Windows 7 and access it with a VNC session. I could not get the passthrough to work.

Eventually I tried Wheezy: and it almost works out of the box. I'll give you the steps to point you in the right direction, so you don't have to repeat my mistakes. I can't guarantee that this will work for your particular setup, but I hope that if it doesn't, you'll be far enough along that it won't take too much more effort to get it going.

My understanding is that some graphics cards will not work. Drivers may be written, and hardware designed, with assumptions in mind that aren't the case under virtualization and passthrough. You must also have support for hardware virtualization on your CPU and your motherboard.

VGA passthrough is in it's infancy. There isn't a lot of support available. It can be tricky to find useful resources and help online. With that in mind, I thought I'd write this.

My Hardware

You do not need to have my exact hardware, but it may be helpful to know that this worked if you have similar hardware or decide to run out and buy new hardware.

  • CPU: AMD FX-6200
  • Motherboard: Gigabyte 970A-UD3
  • Host video card: ATI Radeon HD 6670
  • Guest video card: ATI Radeon HD 5770

Hardware Setup

Restart your machine and enter the BIOS. Make sure virtualization support is enabled (this is for the CPU). Also, make sure that VT-d (Intel) or IOMMU (AMD) is enabled (for the motherboard).

If you can, verify that your CPU supports virtualization. If you already have Linux installed or a Live CD, check support as follows.

egrep -q '^flags.*(svm|vmx)' /proc/cpuinfo && echo virtualization extensions available

Host OS Installation

Install Debian Wheezy. Make sure the desktop environment is installed. After the installation is complete and you've rebooted, install KVM, libvirt and virt-manager (a user interface for creating, starting and managing virtual machines).

aptitude install qemu-kvm libvirt-bin virt-manager

Here's an important part: Make a file in /etc/modprobe.d (call it kvm_iommu.conf, call it whatever you want) with the following in it.

options kvm allow_unsafe_assigned_interrupts=1

Do not install the fglrx driver on the host. After I had the Windows 7 video passthrough working, I installed AMD's proprietary driver on the host to get a higher resolution on the host's console. It broke video passthrough. After testing it, I've concluded that just having the driver loaded causes a problem (even if I've assigned pci-stub to my passthrough card). The driver is causing my card to go into a busy state.

Simply issuing the following from a virtual console:

pkill gdm3    # after logging out, of course
rmmod fglrx
gdm3

fixed my problem. So take my advice: do not install the fglrx driver on the host.

Guest OS Installation

I know your tempted to passthrough the video card right away. DON'T.

Start Virtual Machine Manager. Create a new virtual machine. Follow the wizard. DO NOT check off Customize configuration before install and assign the video card. Don't do it.

Install the OS (Windows 7). Once it is properly installed (the Windows installer will reboot a few times), shut it down. Go to the details screen for the guest OS in virtual manager. Use the "Add Hardware" button to add your video device. If you are using HDMI, don't forget to add the HDMI sound device. Do not remove the Video or Display VNC items.

Start your Windows 7 guest OS and verify that your device is present in the Device Manager. Then install the Windows driver for the graphics card you are passing through to your guest OS.

Reboot. Bob's your uncle. Or not. In my case I got the BSOD when booting the first 2 or 3 times. After rebooting the guest 3 or 4 times, it's worked consistently.

Your machine will start up displaying using VNC. Then the VNC image will freeze at the Windows logo and graphics will continue on the passthrough video card. This works well if you've also passed through a keyboard and mouse. Remember that you can't passthrough USB hubs and host controllers and expect their children to passthrough. Just passthrough the actual devices.

Related Resources