You are not logged in.

#1 2015-09-22 01:56:29

Arkaid
Member
Registered: 2015-09-20
Posts: 5

KVM + QEMU + GPU passthrough (Windows7 Guest) [SOLVED]

I'm having a bit of an odd issue and would greatly appreciate it if someone has any clue as of what might be happening.

What I've done:

* Added "iommu_intel=on" to the kernel boot command line
* Blacklisted the nouveau driver (GPU is NVidia GTX 980)
* Added the vfio-pci driver and assigned the necessary ids (GPU + attached HDMI sound)
* Confirmed IOMMU groups ( /sys/kernel/iommu_groups/ -type l output is OK)
* Confirmed vfio-pci capture with dmesg

What happens:

After booting windows, I get the GPU displaying the "Starting Windows" splash screen, with animation and everything. Thus far, I think the GPU passthrough is successful. However, after that, the screen gets stuck there while the system keeps booting. I even hear the windows chime as it starts, but the screen is still showing "Starting Windows"

If I use emulated VGA, the NVidia card shows "Code 12", but I hear this is expected if the emulated VGA is turned on.

The above is also reproducible with the windows installer ( The GPU output displays: "Windows is loading files" -> "Starting windows" -> no more screen updates )

QEMU commandline:

qemu-system-x86_64		\
	-name windows7 		\
	-cpu host,kvm=off 	\
	-smp 8,sockets=1,cores=4,threads=2 \
	-enable-kvm 		\
	-machine type=pc,accel=kvm,iommu=on \
	-m 16G -mem-prealloc -balloon none \
	-rtc clock=host,base=utc \
	-soundhw hda 		\
	-device ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
	-device vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
	-device vfio-pci,host=01:00.1,bus=root.1,addr=00.1 \
	-drive if=pflash,format=raw,readonly,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd \
	-drive if=pflash,format=raw,file=/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd \
	-drive file=win7.img,if=ide,format=raw,media=disk \
	-monitor stdio \
	-device piix3-usb-uhci -device usb-tablet \
	-vga none -serial null -parallel null -nodefaults -nodefconfig

Let me know if you need any other information about the setup.
Thank you in advance

Last edited by Arkaid (2015-09-23 07:36:07)

Offline

#2 2015-09-22 13:32:13

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: KVM + QEMU + GPU passthrough (Windows7 Guest) [SOLVED]

Are you aware of vfio-users mailing list? It was created primarily for KVM + GPU passthru support.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2015-09-22 14:04:14

Arkaid
Member
Registered: 2015-09-20
Posts: 5

Re: KVM + QEMU + GPU passthrough (Windows7 Guest) [SOLVED]

alphaniner wrote:

Are you aware of vfio-users mailing list? It was created primarily for KVM + GPU passthru support.

I did not know that. Thanks!. I'll look into that too and update this thread if I find a solution.

Also welcoming other answers too until then.

Offline

#4 2015-09-23 07:34:59

Arkaid
Member
Registered: 2015-09-20
Posts: 5

Re: KVM + QEMU + GPU passthrough (Windows7 Guest) [SOLVED]

After posting the problem in vfio-users, I got some good advice and managed to make it work.

Basically, there were two big issues. One, since I was using Intel Graphics for the host, I needed to apply the VGA arbitration patch, which you can get from the AUR. Takes a while to recompile the kernel, then added a boot entry in GRUB to select the patched kernel, along the command line option

i915.enable_hd_vgaarb=1

Second issue was using OVMF. Plain Seabios and removing the ioh3420 line made it work like a charm.

Here's the final command line:

qemu-system-x86_64		\
	-name windows7 		\
	-cpu host,kvm=off 	\
	-smp 8,sockets=1,cores=4,threads=2 	\
	-enable-kvm 		\
	-machine type=pc,accel=kvm,iommu=on \
	-m 16G -mem-prealloc -balloon none  \
	-rtc clock=host,base=utc 			\
	-soundhw hda 						\
	-device vfio-pci,host=01:00.0,multifunction=on,x-vga=on \
	-device vfio-pci,host=01:00.1 		\
	-drive file=win7.img,if=ide,format=raw,media=disk \
	-monitor stdio 						\
	-vga none -device secondary-vga		\
	-serial null -parallel null 

Offline

Board footer

Powered by FluxBB