Play games in Windows on Linux! PCI passthrough quick guide

So does anyone have any experience with two Nvidia cards which were different model? Did it just work or did you do any spells to load vfio before Nvidia drivers?

EDIT:
Made quick'n' dirty hack. Blacklisted Nvidia drivers and loaded them through /etc/rc.local after loading vfio.

I have a 970 and a 1080. I had to set my BIOS to output to the host card. If I had the bios set to a card, VFIO wouldn't grab it.

Well. I'm running kernel 4.10 so I thought I don't need acs patch. But still got error about iommu groups?

vfio error: 0000:29:00.0: group 2 is not viable'

Have you tried applying the ACS patch yet? I needed it for my hardware. I'm on kernel 4.9.30, and I'm compiling 4.9.38 right now. I'm running Debian, and I got the patch from this git repository: https://aur.archlinux.org/pkgbase/linux-vfio/

Do i need to use ACS patch if the gpu is paired with pci-e bridge on the same iommu group? If not do i passthrue all of the 3 or just the gpu & audio.

Edit: Gpu (1080ti) is the only pcie card on the system.

I'm at a state that "works" but there are a couple things I'd like to do and can't quite figure out. I'm a student living on campus, so any over the network mouse and keyboard integration gets blocked. To get around this, I bought a physical USB switch and connected it to a four port hub with the intent of passing one of the usb ports through to the VM so I can just physically swap my keyboard and mouse between the two environments. However, Virt Manager only detects the end devices so the switch doesn't really do anything.
For now I've just been using my spare mouse and keyboard for my host whenever I have the VM on.
I also haven't been able to get the audio to pass through properly, although I got around that by just passing through my USB headset. It works, but sometimes the audio goes out and I feel like it might stop if I was actually passing the audio through the host properly.

I just got mine working a few days ago, so I might be wrong with this but this is what I did with audio.

Don't try to pass thru the audio from windows into linux, just splice together with an Y adapter the outputs to headset or whatever your using and just use hdmi audio. Mine works perfectly fine atleast.

Another option would be setting up an loopback for audio from hdmi audio to another input port on motherboard but that'll use some system resources.

@GrayBoltWolf Thanks dude for this guide, its flawless. I'm at the point where my biggest concern is having the 2 systems syncronize screen timeouts :slight_smile:

How is everyone switching inputs and outputs between the host and guest?

Two inputs to a single monitor and switching between? Second dedicated monitor?

Two sets of keyboard/mouse or a switch or software?

Anyone tried Steam In Home Streaming between host and guest?

I'm brainstorming ideas to keep my experience within the Linux desktop and not having to use some goofy setup that/s basically two separate computers.

Try using Synergy. Best 30€ I have ever spent for software.

Doesn't Synergy require you to connect to your VM over the network? Or did I misunderstand something?

Yes, that's how it works

Some programs still won’t run for me because the virtual machine is being detected as a virtual machine. Are there more ways to hide the hypervisor for example because when I look into the task manager it says virtual machine: yes. Also I get errors like this: https://i.gyazo.com/b7688c4747bf59b4a81b23fe95715089.png.

I’ve been having the problem that some other users have too, and it’s that I get thrown into the UEFI shell without any possible input. I’ve double-checked and redone every step at least 20+ times and tinkered with the configuration myself without any solution. I’m not using Debian as recommended, but I’ve got Linux Mint installed with virt-manager on 1.4.1, so it’s up to date. What am I doing wrong? I’m going crazy.

And yes, I’m using two pairs of USB-connected mice and keyboards, have compatible hardware and have double-checked every single step.

A comprehensive and step by step guide can also be found in the Arch Linux Wiki.
There are also some hints for tuning the KVM as well as troubleshooting tips.
One important step for my setup for example was to allocate the memory for the KVM via hugepages.

I’d recommend synergy to everyone.
For anyone who wants to keep the costs down or just wants to try the program before buying:
The program can be compiled from github sources. If you don’t know what that means just buy the program.

I usually start my vm with a script that allocates the 10gb of hugepages, sets the cpu governor to performance and deactivates the screen in linux that will be used for the vm.
This way the vm starts and the passed through gpu delivers its input to that monitor.

I have Synergy keybindings to switch from host to client and vice versa as well as a keybinding to lock screen border so that the mouse doesn’t go over to the other screen when I move it to the side.

1 Like

Got everything working on a deluxe II motherboard with the exception of the mouse. The keyboard comes over but now I have two mice working on Debian and zero on windows. Windows is working on the second GPU though. Just did the network drivers and windows is auto doing the video drivers and such. I have this running on a hard drive that works through an ssd card. And the extra keyboard and mouse running on a pci card as well. Both have their own groupings under Debian but they dont seem to want to come over the same way as the gpu did. Even though I put their device ids under grub I assume this is because the video cards are UEFI and the keyboard/mouse are not. Adding them to usb hardware got me the keyboard but not the mouse. Anyone recommend a way for me to get those pci cards over? Managed to install windows on the separate hard derive but it isnt through a pass-through.

Well I was playing with options and the mouse started working. Dont know if was me trying to passthrough the controller or the driver installing itself in windows but mouse is working.

There is

I enjoyed the stream and got a few tips.

Can’t we have something like a subcategory completely dedicated to this topic? What do you guys think?

1 Like

How do I get this vm onto the local network? Looking at adding another virtual network under qemu/kvm but im not sure.