Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] VGA Passthrough to Windows Guest Crashes Guest
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
R0b0t1
Apprentice
Apprentice


Joined: 05 Jun 2008
Posts: 264

PostPosted: Tue Jan 03, 2017 10:16 pm    Post subject: [SOLVED] VGA Passthrough to Windows Guest Crashes Guest Reply with quote

Hello,

I have been referring to the following:

https://wiki.gentoo.org/wiki/QEMU
https://wiki.debian.org/VGAPassthrough
https://fedoraproject.org/wiki/Windows_Virtio_Drivers

And am starting qemu as follows:

Code:
qemu-system-x86_64 \
    -M q35 \
    -machine accel=kvm \
    -smp 4 \
    -m 4096 \
    -usb \
    -usbdevice tablet \
    -vga qxl \
    -spice port=5924,disable-ticketing \
    -net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtio \
    -drive file=/dev/vg1/win10,cache=none,format=raw,if=virtio \
    -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1 \
    -device vfio-pci,host=06:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
    -device vfio-pci,host=06:00.1,bus=pcie.0 \
    -drive file=win10-amd64.iso,media=cdrom \
    -drive file=virtio-win-0.1.126.iso,media=cdrom \
    -monitor unix:~/vm/win10.mon,server,nowait \
    $@


From what I can tell my auxiliary graphics card (AMD W7100) is passed to the host properly. Two graphics devices are listed. One will start the self-installation of drivers if prompted to do so. Once the drivers are installed the machine appears to fail to boot if the card is passed to the VM. As an aside, the options for vfio-pci don't seem to behave as expected - if I change the addr of the card (the top device) it will not appear at all, even though this should just change its position on the bus. I attempted to do this to make sure that there was no "primary" VGA device. Connecting a screen directly to the card per the Debian page's instructions detects no output.

The very first time I started the virtual machine (no virtio devices) Windows installed the drivers properly, during this time the screen blinked a few times (something observed when installing graphics drivers on a bare metal machine) and the spice viewer's screen continued to update properly. I accidentally force-closed this installation, possibly corrupting it, but it may have failed to boot for whatever reason later attempts also failed to boot. The card identified properly to the operating system as seen from "Device Manager."

My present attempts using virtio drivers end in this fashion: as graphics drivers are installed (after completing system installation) the screen will turn black. Attempts to use the qemu monitor to power off the system fail, even after waiting a reasonable amount of time for the installation to finish. More recently I've been able to launch the VM and have windows boot properly, but the log-in screen will be grayscale or may not render properly and won't update. Sometimes boot will freeze and the spinner stops spinning. If the card is removed, either by deleting the device line or changing it's PCIe address, the machine will start properly.

Any help is appreciated. In the interim I will try leaving out virtio drivers, though that makes it hard or impossible to route traffic to the guest. Knowing how to properly configure the PCIe options so that the video card is enumerated after the QXL card might solve the issue (the AMD card is above the virtual one in "Device Manager"). Suggestions of places better suited to this question are welcome.


Last edited by R0b0t1 on Wed Jan 04, 2017 5:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
R0b0t1
Apprentice
Apprentice


Joined: 05 Jun 2008
Posts: 264

PostPosted: Wed Jan 04, 2017 5:19 pm    Post subject: Reply with quote

The solution is to use the OVMF UEFI 2 compliant firmware. This may be necessary for all cards made within a few years of the release of that standard. Output froze after the display flickered while installing the driver, but the W7100 was in Device Manager after starting it up again.

Unfortunately, compiling the EDK2 project is nearly impossible, so I recommend this link: https://www.kraxel.org/repos/jenkins/edk2/. You want edk2.git-ovmf-x64-#-YYYYMMDD-HHHHHHHH.noarch.rpm and rpm2targz. Copy out OVMF_CODE-pure-efi.fd and OVMF_VARS-pure-efi.fd.

Code:
qemu-system-x86_64 \
    -machine accel=kvm \
    -cpu host,kvm=off \
    -smp 4 \
    -m 4096 \
    -drive if=pflash,format=raw,readonly,file=OVMF_CODE.fd \
    -drive if=pflash,format=raw,file=OVMF_VARS.fd \
    -usb \
    -usbdevice tablet \
    -vga qxl \
    -spice port=5924,disable-ticketing \
    -net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtio \
    -device vfio-pci,host=06:00.0,multifunction=on \
    -device vfio-pci,host=06:00.1 \
    -drive file=win10-amd64.iso,media=cdrom \
    -drive file=virtio-win-0.1.126.iso,media=cdrom \
    -monitor unix:~/vm/win10.mon,server,nowait \
    $@


The presence of "-machine accel=kvm" and "-cpu host,kvm=off" is to trick the guest into thinking it isn't emulated. It may or may not be necessary depending on your hardware.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum