Return to Level1Techs.com

Play games in Windows on Linux! PCI passthrough quick guide

iommu
vfio
passthrough

#243

Hi all,
I'm kinda stuck with no idea what I'm doing as I am very new to this side of linux. Just built my new rig yesterday and I'm running into some trouples. Whenever I try to run the patch, I get this error.
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?

I have attatched an image of the full output. Pretty sure the problem is that the patch is for 4.7 and my kernel is 4.9, but I don't know where ot go from there. Any help would be very appreciated.


#244

Any GPU recommendations for host? I have currently GTX970 and I'm planning to use it with virtual machine. GTX 1050 looks like pretty affordable, would that do the thing?


#245

Yes it would, but if it where me I would use the GTX970 for the host and purchase a1080 for the guest. The only thing I would keep in mind Nividia graphic card don't like to run in a virtual machine, but there is a work around , see other GPU passthrough guides on this forum.


#246

I'm very pleased to GTX970s performance so I don't see point to buy new GPU which costs like 700 euros. :slight_smile:


#247

It depends what type of games you are playing your more demanding games will probably take advantage of the 1080.


#248

ktbh4jc: Not sure if this is the issue, but the video and I both were running the patch in the 'linux-source-4.7/linux-source-4.7' folder (yes, it's repeated twice). I, like you, am running the '4.9' kernel for Debian Stretch, but it seems to have patched fine for me (kernel rebuild is still in process). I did have to manually do an install of the "pkg-conifg" package before I could successfully run "make config", though...was getting an error related to "qt" otherwise.

Hope this helps!


#249

Thank you so much! I didn't catch that it was nested. It looks like that worked.


#250

Cool. I meant to type "pkg-config" in my original response, but looks like that didn't throw you off the scent :-).

Kernel rebuild for me was successful and I can get an older, non-UEFI card to be visible in a UEFI VM, but the drivers won't load because I am booting the host in BIOS mode. When I try to boot the VM in BIOS mode, I can't get it to even display the POST in the VM, although 20% CPU is still chugging away the whole time on the CPU meter. I've tried juggling around various graphics options, keeping the VM spice driver installed or removing it and passing through either of my two discrete graphics GPUs, but nothing seems to make a difference. Seems like I'm close, but I'm not sure what to try next to get it working in BIOS mode.

I have a Skylake I7 with BIOS set to boot from PCIe card, and one Nvidia GT 430 and one similarly older AMD Radeon card. Since this tutorial is mainly about running in UEFI mode, I probably should just give up on BIOS and head in that direction, unless someone's got some BIOS pointers for me that might have been left unspoken in the nice video.


#251

If you are trying to pass through one of your graphic cards to a guest VM both of the graphic cards are too old for graphic card passthrough to work. On the Nividia side you need at least a Nividia 700 or higher, I don't know about the ATI card.


#252

Anyone else have trouble getting past the Windows install? We're going on ten hours of just the windows 10 logo above the loading dots and the words "Getting Ready". VMM is showing 3-4% CPU usage.
EDIT: It automatically rebooted, but the OS install didn't take.
EDIT2: It's working now. My problem was that I was trying to do the install on a harddrive that was going out.


#253

I have rather interesting problem. Vfio partly works: It claims audio side of the card, but not graphics card itself:

29:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM204 [GeForce GTX 970] [10de:13c2] (rev a1)
Subsystem: eVga.com. Corp. GM204 [GeForce GTX 970] [3842:2974]
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_375_drm, nvidia_375
29:00.1 Audio device [0403]: NVIDIA Corporation GM204 High Definition Audio Controller [10de:0fbb] (rev a1)
Subsystem: eVga.com. Corp. GM204 High Definition Audio Controller [3842:2974]
Kernel driver in use: vfio-pci
Kernel modules: snd_hda_intel

Address is correct at vfio conf:

[~]% cat /etc/modprobe.d/vfio.conf
options vfio-pci ids=10de:13c2,10de:0fbb

I can't blacklist nvidia driver, because my other card is Nvidia too.

I'm running Ubuntu 17.04 with 4.10.0-26-generic, NVidia driver is the newest 375.66. Any suggestions what to do?

Edit:
I think problem is that nvidia driver is loaded too early. I have tried several tricks to load driver at later stage with no luck. For example blacklisted it at /etc/modprobe/blacklist and tried load it at /etc/initramfs-tools/modules.

Edit2:
I think udev rule which loads vfio stuff before nvidia might do the trick. Tried this, but didn't work. Found udev rules pretty hard to understand. Tried this but it didn't help. :frowning: Anyone knows how to write udev rule?

[~]% cat /etc/udev/rules.d/50-vfio.rules
SUBSYSTEM=="vfio", ACTION=="add", RUN+="/sbin/modprobe vfio"
SUBSYSTEM=="vfio", ACTION=="add", RUN+="/sbin/modprobe vfio_iommu_type1"
SUBSYSTEM=="vfio", ACTION=="add", RUN+="/sbin/modprobe vfio_pci"
SUBSYSTEM=="vfio", ACTION=="add", RUN+="/sbin/modprobe vfio_virqfd"


#254

Add vfio-pci.ids=10de:13c0,10de:0fbb to the line GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on.

So it looks like:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on vfio-pci.ids=10de:13c0,10de:0fbb"


#255

Don't bother with the ACS patch anymore, it has been added to the kernel upstream and is no longer required.


#256

When was it added upstream? I just compiled 4.9.30, and I needed to apply the patch to split my IOMMU groups. I used the patch from here: https://aur.archlinux.org/pkgbase/linux-vfio/, and I had to skip one piece of the patch. All of my groups are separate now with the patch.


#257

What about passing through the Intel HD 4000 that's onboard the Core i7 chip? Reading the posts below, it appears I don't even need to apply the ACS patch with newer kernels, although I went ahead and patched my 4.9 Debian Stretch kernel with it anyway.

Since much of my readings suggested passing through HD 4000 was an exercise in pain and suffering, I can't say that I've even attempted to summit this peak via that face of the mountain :slight_smile:


#258

Even though the GPU is not in its own IOMMU group it will still work. Just follow the rest of the steps, using UEFI for the VM's bios type and it should work just fine.


#259

Not possible as of yet. The iGPU is so heavily integrated with the CPU in more than just PCIe, as of now it isn't possible.


#260

I pass through my GPU, a PCINIC, and a USB 3 card. Without the patch I couldn't pass through my USB card, and it would say that it was an invalid group, just like with older versions of kernel 4.9. I wonder if it depends on hardware or something.


#261

Ah yes, without the ACS patch the PCIe device has to be UEFI compatible.


#262

That makes sense. I am using OVMF, but I'm not sure if all of the cards are uefi compatable.