Play games in Windows on Linux! PCI passthrough quick guide

What changes is the version of the packages, specially with rolling distros, maybe that was a bug fixed on a qemu version ( or some of it's dependencies ) that your distro still hasn't officially updated yet, but if you were using windows 7 that's probably the problem, you could try 8.1 too if you don't want to try 10, I haven't had any problems with 8.1.

It's debian stretch, that's what I wrote the guide with and I say to use.

Stretch is on virtmanager 1.4.0, libvirt 2.4.0, and qemu 1.2.7. What are your versions?

for PCI pass-through is it better to set the VM to use 3 cores and have 1 dedicated to linux or can I set the VM to share all 4 cores between linux and windows?

Depends. If you are going to be doing stuff on the host at the same time allowing it to have a free core is not a bad idea.

However Linux is very good at scheduling so giving the VM 4 cores will have almost no difference in performance.

I'm using just plain qemu, without virt-manager, it's on version 2.7.0-2

So I'll just jump in here and ask for help. My VM broke after doing an update yesterday morning, and I haven't been able to figure out what happened. For reference here is my thead: my thread

Quick backstory: Started doing hardware passthrough almost a year ago. Been using it the entire time to play games on and off. System is an Asus Z170-A, i7-6700k, 32GB RAM. Host OS is Fedora 23. VM storage is a 128GB img file and a ~200GB img file for more (game) storage, both on a separate 1TB hard drive. Performance and stability have both been excellent.

After doing some troubleshooting (thanks to @The_Cable and @Deathright82 for the help) I am leaning towards the OVMF UEFI getting borked somehow. I know it updated, and both VMs that use it can't boot now.

Not really sure where to go next. Any help would be greatly appreciated.

edit: Oh, and the guide I used to set my passthrough up is here: link It is very similar to your @GrayBoltWolf guide.

So what are the symptoms? When you try to boot the VM what happens?

I did use that guide for some input. if you followed that guide exactly I am going to assume that the startup script that redirects the GPU to vfio is broken. Make sure that it is still loaded with vfio in the output of lspci -k.

Symptoms are three of four cores assigned to the VM are maxed a few seconds after starting the VM and the monitor attached to the video card goes to sleep or does not wake. If I remove the video card from the VM and set up video all I get is a black screen in the window.

I have checked to see what driver is attached to the video card, and it is indeed VFIO.

So my recommendation is to get it working without the GPU passed through first.

Can you attach your libvirt config? Should be in /etc/libvirt/qemu/

That's basically where I am now. Trying to get it working without the passthrough.

Here's a pastebin: link redacted

Everything looks good. Do you need the ACS patch and what kernel version are you on?

Kernel 4.7.0 broke VFIO. 4.7.5 works. If you try VFIO on 4.7.0 it gives you a black screen.

My kernel is 4.9 rc5. I had been on 4.9 rc3 for a week or two, and it worked fine. It worked fine all through the 4.7 rc and 4.8 rc kernels too. I tried booting into rc3 again, but it still won't work.

And just to make sure the kernel driver in use is vfio-pci, not just the kernel module?

Subsystem: eVga.com. Corp. GM204 [GeForce GTX 980]
Kernel driver in use: vfio-pci
Kernel modules: nouveau

Yup. Both components of the GTX 970 are using vfio-pci.

I checked the iommu groups, and the video card is in group 1 along with one other thing, a skylake pcie controller. That wouldn't be a problem, right?

The GPU and it's audio device have to be the only ones in that IOMMU group or you need the ACS patch.

Search the original post for find /sys/kernel/iommu_groups/ -type l to read more info.

Here's another pastebin with some lspci commands as well as the iommu groups: link redacted

I wonder if somehow the iommu group changed somehow, because like I said it has been working fine for a long time until the update yesterday.

You are going to need the ACS patch. Looks like they updated some kernel modules with more Skylake support would be my guess why that changed.

Well, I am going to have to adapt the instructions and commands to do the ACS patch for my distro and kernel.

Definitely gives me a starting point, though. Thanks.

Although... Does that explain why the VM doesn't run? The IOMMU groups changing explains why the passthrough isn't working, but I removed the video card from the VM (via the GUI) and it still wouldn't boot. Does that also remove the video card from the xml file too? I don't think I see it in the config.

No it doesn't explain that. I would guess that the update also possible broke OVMF since it looks like you had to extract your own nvram. That isn't part of that guide so you have that to enable UEFI for the 970?