Linux Gaming System using PCI passthrough with KVM

Only issue is USB for hot plug, unless you use the 2nd PCIe 3.0 x16 slot for a USB addon card. With the GT 710 plugged into the PCIe 1x slot so you should be good, but I don’t have any experience with KVM, so may be some quirks with it.

Thank you for the reply.

So to be clear the reset bug on the Vega cards is a thing of the pass?

I am also thinking as FutureFade pointed out I could use synergy to switch mouse and keyboard. And the monitor has an input selector so I can switch that too. So I don’t think I would need USB hot plug. I need to learn more how synergy works though.

Synergy is a very buggy solution when playing games. You’ll have lots of problems. The only solution I know of that really solves the problem is the Level1 KVM, but it is extremely expensive. (worth it IMO though)

I believe it was fixed as of Linux 4.16. So, if you’re running a recent kernel, you should be fine.

Synergy only works after you’ve logged in on Windows, and it uses the network to communicate

1 Like

Thank you for the reply!

All is clear. I hope the budget KVM I picked works. It doesn’t have terrible reviews like most of them. Or I’ll get two keyboards and mice, that should be an interested desktop space problem. I have very little space.

1 Like

Just an update, I bought a Logitech G710+ German keyboard map, cherry brown keys, 97€. I’ve had the keyboard for just over a week and it is a great keyboard. It reminds me of the old IBM keyboard only quieter for those that know what I am referring too. Bonus the keyboard has programmable keys. I would buy this keyboard again!

I have a CPU i5 4570 with 16 GB and GTX 970 MSI, using LinuxMint 19.1 and Kernel 4.19.8.

After configure vfio in /etc/modules and reboot my system, the system apparently loads normal, because I hear the sound of starting, but I only see a black screen.

I wanted to run windows 7 with acceleration 3d in kvm / qemu

You should be able to switch to another TTY, remove your changes in /etc/modules, then update-initramfs, then reboot and be back to normal.

More information on what you are trying to setup is needed such as which GPU you are trying to passthrough(the GTX 970 or the Intel HD iGPU), the output of bash script below, and any changes you made to config files for passthrough.

#!/bin/bash
  shopt -s nullglob
  for d in /sys/kernel/iommu_groups/*/devices/*; do 
  n=${d#*/iommu_groups/*}; n=${n%%/*}
  printf 'IOMMU Group %s ' "$n"
  lspci -nns "${d##*/}"
 done;

Comes from there-
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#Ensuring_that_the_groups_are_valid

the output of script above

IOMMU Group 0 00:00.0 Host bridge [0600]: Intel Corporation 4th Gen Core Processor DRAM Controller [8086:0c00] (rev 06)
IOMMU Group 1 00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller [8086:0c01] (rev 06)
IOMMU Group 1 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM204 [GeForce GTX 970] [10de:13c2] (rev a1)
IOMMU Group 1 01:00.1 Audio device [0403]: NVIDIA Corporation GM204 High Definition Audio Controller [10de:0fbb] (rev a1)
IOMMU Group 2 00:14.0 USB controller [0c03]: Intel Corporation 9 Series Chipset Family USB xHCI Controller [8086:8cb1]
IOMMU Group 3 00:16.0 Communication controller [0780]: Intel Corporation 9 Series Chipset Family ME Interface #1 [8086:8cba]
IOMMU Group 4 00:19.0 Ethernet controller [0200]: Intel Corporation Ethernet Connection (2) I218-V [8086:15a1]
IOMMU Group 5 00:1a.0 USB controller [0c03]: Intel Corporation 9 Series Chipset Family USB EHCI Controller #2 [8086:8cad]
IOMMU Group 6 00:1b.0 Audio device [0403]: Intel Corporation 9 Series Chipset Family HD Audio Controller [8086:8ca0]
IOMMU Group 7 00:1c.0 PCI bridge [0604]: Intel Corporation 9 Series Chipset Family PCI Express Root Port 1 [8086:8c90] (rev d0)
IOMMU Group 8 00:1d.0 USB controller [0c03]: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1 [8086:8ca6]
IOMMU Group 9 00:1f.0 ISA bridge [0601]: Intel Corporation 9 Series Chipset Family Z97 LPC Controller [8086:8cc4]
IOMMU Group 9 00:1f.2 SATA controller [0106]: Intel Corporation 9 Series Chipset Family SATA Controller [AHCI Mode] [8086:8c82]
IOMMU Group 9 00:1f.3 SMBus [0c05]: Intel Corporation 9 Series Chipset Family SMBus Controller [8086:8ca2]

I was trying to follow the tutorial of the link below

That is good, the GTX 970 does not have another slot in the same IOMMU group.

Assuming that you want to passthrough the 970 to the VM, and use the motherboard Intel iGPU for linux, you first should set the Intel iGPU as the boot GPU with the video cable plugged into the motherboard.

Then you can bind the 970 to vfio. The guide you have been using is for Debian 9, so it is not ideal for newer Debian and Ubuntu based systems. Try the guide linked below, starting at binding the GPU to vfio. Replace amdgpu with nvidia or noveau(depending on which nvidia driver you are using), and the PCI IDs with the IDs of your 970.

Another update, I bought a ViewSonic XG2401, 144hz, FreeSync, 24" gaming monitor. I followed the setup instructions at Tom’s Hardware. I think it is a great monitor for 214€.

I plan to pair it with the Sapphire Nitro + Radeon RX 590. One poster said there is no reset problem. I hope @wendell has a follow up soon to his review of this card and confirms.

I wanted to use 3d in kvm / qemu to be able to run one or another game of windows 7 inside the emulator, but using windows 7 as the same host, and without having to change the monitor

If you want to use passthrough, then you need two GPUs. One to use for the Linux host OS, and one that is passed through into the VM for the guest OS(in your case Windows 7)

The GPU that is passed through is NOT available for the host OS. So once Linux stars booting, it will not output any video until the guest OS in the VM boots. With passthrough, you need a second monitor or a second input on your monitor unless you use looking-glass.(see below)

https://looking-glass.hostfission.com/

https://www.youtube.com/watch?v=U44lihtNVVM&t=1s

  1. To configure passthrough in guest Windows 7 ( run in KVM ),
    i need install nvidia drivers on the Linux?

  2. What driver set default enabled in startup Linux, Intel i915 driver or nvidia driver?

I my LinuxMint 19, did not work passthrough, I will do a new installation using ubuntu 18.10

At this point, I would recommend starting a new thread with what you have tried and what your problems/questions are.

But, as for you questions-

  1. You need to use the VFIO driver in linux for the card you are passing through to a VM. If you are passing through an nvidia card and keeping the i915 for the host, then no you do not need nvidia drivers.
  2. Use appropriate one for the one for the GPU you are NOT passing through.

I have already been able to pass the VFIO to my linux.

Now I have to create the system.

I saw several topics, using Windows 10 with UEFI boot, can you use Windows 7, or only Windows 10 even?

What is the command to use the nvidia video card monitor?

I’m looking at this setup example.

also i need use the exclusive mouse and keyboard in guest system?

You need to use Seabios for win7 or older. Win8 and newer can use either seabios or Ovmf uefi. I would recommend ovmf since with seabios you may need to patch your kernel for i915 vga arbitration.

it looks like QEMU 3.0.0 the command

no longer works

I don’t want to create a new topic for this. And I am also looking to build a new PC.

But could someone explain how audio works? For example if I am using Discord, could it be running on my Linux machine (host) awhile I game on my Windows VM, receiving audio from both? Do I need to use a switch with an addition USB card for passthrough? How does onboard audio work? Do I need a second sound card?

There is a lot about graphics but I am having a hard time finding information on what to expect or options for audio both input and output.

Thanks for any help :slight_smile:

I think you will need two sets of speakers unless someone knows of a way to merge audio streams.

With my build I plan to feed the HDMI audio feeds into the monitor. However that only works with one feed at a time.