GTA V on Linux (Skylake Build + Hardware VM Passthrough)

Look into virt-manager if you're looking for a nice friendly way to manage your VM's.

@wendell Can you reorganize it in a step by step-ish guide please, it'll make it way less overwhelming. Thanks

@wendell Is there anyway to do the pass through with one gpu, and no on board graphics? I could definitely see picking up a second graphics card some day, but would almost prefer to go with an SLI config. I don't think I'd have enough PCI-E slots left over to support Windows, after an NVME drive on Haswell E. Maybe, Skylake E will up the PCI-E count.

Other than not having pass through, I almost have the VM recognizing 3 monitors. It can see 3 monitors, but they don't map to actual displays right now.

It looks like I will be taking the jump into a new machine and putting Windows 10 into the Phantom Zone.

I was hoping to go with an X99 system, but it looks like I might have to go Skylake so I have the on board graphics handy, so I can pass through my 780. I might look around for a cheap PCI-8 graphics card.

That being said, are there any quirks doing this between Skylake and X99?

@wendell & everyone else I found a convenience script on GitHub that binds a PCI device and all of it's IOMMU group members to vfio-pci. All that you have to do beforehand is to enable IOMMU on your machine and afterwards pass through the device(s) to your vm.
GitHub: Here
Found it via the vfio users red hat mailing list, might want to check this link for updates after awhile: Here

1 Like

Adding this here for the ones that might get some help out of it.

This is my setup, but with a small addition, an EVGA 710 2GB GPU in it.

Inspired from @wendell and his Arch Linux setup, I went on and made a similar approach.

Used a modified kernel Fedora 23 OS (4.4.2-301.fc23.x86_64) with QEMU-KVM, took the vfio-pci route, and was able to pass-through the 980Ti, mouse,keyboard and usb headset to KVM. I have the desktop space for two keyboards, so no big deal there.

Two things for the ones that might try it.
One is under fedora, if you are going to assign usb devices you should edit the file located at /etc/selinux/config and replace enforcing by permissive or disabled. After a reboot you can check the selinux status with /usr/sbin/getenforce , and It should indicate whatever change you made. If you don't do this, Fedora will not unbind your usb device and let kvm grab it.
And second, kernel 4.2 & kernel 4.3 will not register huge pages correctly so the system will halt. Kernel 4.1 should work fine, but I haven't tried personally, to verify.

Best of luck to all. :)

1 Like

Dear Wendell,

this tutorial is great, if I could play games on Linux, there would be nothing stopping me from making it my primary OS, and I would really love that. One problem I have is I already have Windows installed with quite a lot of files and no backup drive capable of preserving my files during the transfer. Is there a way to install linux as a secondary OS, set up all the things in the secondary OS and then set up virtualization from the Winpartitions to Linux?

Thank you, I really love your videos!

I truly would love to switch to Linux! But limitations like gaming on games not available for Linux prevent me. My i7-4770K does not support pass through. Are there any other options available? How good is WINE these days?

I want something simpler than what was described. I just want windows to be in the vm and play minecraft( I have a cracked version that only works on windows, yeah I know don't judge I can't legally buy minecraft here) on it. I have a g3258 and an asus z87 sabertooth and a gtx 780(dont question it, there are reasons, I can explain if you want..). can someone give me some instructions because I am a real noob? I have very limited linux experience even though I use 3 linux distros for my everyday tasks. I am going to set this up on linux mint xfce 17.3 if that matters. thank you all in advance.

Can I do this on a i5-3570 and a Gigabyte GA-Z77X-D3H Mini-ITX? I'm also running on OpenSUSE LEAP

Hi,

This thread and especially video inspired me to take a plunge for VGA pass-through windows set up.
Thought I'll share my experience and hardware/software list.

I just assembled my new Skylake (i3-6320) CPU and MSI Z170A GAMING PRO (MS-7984) Motherboard desktop.
Had Arch Linux already installed, had no issues loading on new hardware.
I was following guides on Arch Linux forums, vfio.blogspot.co.uk, Arch Wiki, and Google in general. After spending a day and half a night setting this up finally got everything working.

Had no major issues, did not need to deviate from instructions.

One thing which kept me long - I forgot to pass x-vga=on parameter with my video card options, and was wondering why I get no output from GPU, VM is not booting and using one core at 100%.

To pass x-vga=on parameter had to create wrapper around /usr/sbin/qemu-system-x86_64, as described in http://vfio.blogspot.co.uk/.
My script (/usr/sbin/qemu-system-x86_64-vga) looks like this:

#!/bin/bash
exec /usr/sbin/qemu-system-x86_64 \
`/bin/echo "\$@" | \
/bin/sed 's|01:00.0|01:00.0,x-vga=on|g'`

Have not tested VM properly, but it seems OK. I only assigned two vCpus (one core and one thread) to VM, so I'm not sure what performance I will get in games. I'm broke right now, so no better CPU in foreseeable future.
Unigine seems to run OK, will install Fallout 4 and see how it goes.

Other spec's:
Motherboard BIOS: 1.80
RAM: 16 Gb Kingston DDR4 @ 2133 (Dual channel)
SSD: PNY CS1311 240GB (EFI and Arch Linux root partitions, /var is moved to HDD)
Image file: located on SSD in my home folder, in qcow2 format, size - 128 GiB.
2 vCPUS are pinned to 1 and 3 physical CPU's.
Host GPU - Intel HD 530 (Integrated)
Guest (passthrough) GPU - Nvidia GTX 660 Ti 2 Gb (Zotac, not AMP - has no UEFI firmware)
Host OS: Arch, kernel 4.5.4-1-vfio (from Aur) - with i915 VGA Arbiter, ACS Override patches, systemd-boot UEFI bootloader
Emulation and VM management: QEMU 2.5.1-1, libvirt 1.3.4-1
Guest OS: Windows 10 Pro (no license yet, for testing), Legacy BIOS bootloader
Guest RAM: 6 GiB assigned, using 4096 of 2 MiB hugepages (6 GiB VM RAM + 2 GiB VGA RAM)
Host/Guest Networking: libvirt default virtual network bridge (NAT), Guest is using virtio NIC.
Sound: have not configured yet, but nvidia DisplayPort audio does work.
Monitor: Asus VE278Q, Host - HDMI input, Guest - DidplayPort input
Mouse keyboard support: Synergy (Host as Server, Guest as Client)

wow, that's super inspiring and really want me to try out a double Xeon build. For me it would be perfect as I need to use a CAD app that does not have a Linux version and it is a sore spot in my workflow.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

I ended up doing a write up since none of the guides worked for me. I hope it will save someone some time, as I wasted far more than I hoped I would :)

GPU Passthrough with QEMU on Arch Linux

Yeah things have changed a bit the last year. I should really update this post to be more current or maybe the community can help with that.

I tried to also be somewhat distro agnostic but a lot of people found that difficult

1 Like

Yes, it is quite a complex topic to write a guide on, the second part of the article is still a draft months later :)

It might be better to reproduce the how-to here on the forum, and link it here on this thread, instead of linking off to your blog. I can make it a wiki post so the community can update it, or you can duplicate my post and fix the parts of it that need love again?

The part 2, the command line part, I feel like the replies on this topic are still on point as far as the CLI options someone might need for different configs.

I'd like to also cover the case where someone has two radeon adapters and wants to use one with the VM and one with linux.

1 Like

It's probably best to have all resources as the more info the better on a topic like this. My blog is easy to follow but very specific while the Arch wiki has a ton of info to go through and is still quite specific. It would be good to have something in between, most common scenarios covered and also multiple distros.

Dual radeon cards shouldn't be difficult at all, I have blacklisted all devices specifically so I believe all I would have to do is add an extra device to the list.

Don't have the will to come back to this right now after the hell I went through to set it up :) Maybe when ZEN and Polaris comes out I will have to come back to it.

@wendell: Just signed up to thank you for the tutorial and the video. I'm actually running this type of setup for over 4 years now, and I don't want to look back to the dark times when I had to dual-boot. I had written a popular how-to on doing this under Xen, and a year ago a similar one to yours using KVM, both over at the Linux Mint forum.
Still, I learned a thing or two reading through your tutorial, in particular the trick with the "intel_iommu=igfx_off" to remove the integrated Intel graphics from the IOMMU.
Ubuntu and Linux Mint ship with kernel 4.4, with the option to update to 4.8. This is what I'm running now. The new kernel may help with some issues that would require for example an ACS patch.
I am actually curious to see what happens when you remove the "pcie_acs_override=downstream" option. If you run ArchLinux and the linux-vfio kernel, the ACS override patch is already applied to the kernel, so your command line makes sense. However, I'm not aware of that ACS patch being applied to a standard kernel, so I would be surprised if that would work in any other distribution or even the standard ArchLinux kernel. Hope I haven't repeated something that had been discussed here (haven't read through the entire thread).

Thanks again for making this great technology more accessible. To me running Windows on bare metal is like riding in a car without a seat belt - it's alright as long as it doesn't crash.

1 Like

@wendell, great write up! I was running into an issue on my skylake and got it resolved through your guide here. Now if I could just figure out how to run two of these machines. I have two of the same video card to pass to my guests (easy since they have the same IDs for exclusion) they're both controlled by vfio-pci but the second machine hates me and refuses to utilize the video card. I shall prevail!

Keep up the great work!