Return to Level1Techs.com

Play games in Windows on Linux! PCI passthrough quick guide

iommu
vfio
passthrough
#21

You don't need to blacklist anything.

The main reason I use Debian in the guide is because Ubuntu's packages are really out of date. Virt-manager gets updates all the time which have drastically improved its functionality.

I'm on virt-manager 1.4.0 on Debian Stretch. What version do you have on Ubuntu (hit Help and then about in virt-manager)

0 Likes

#22

I am on version 1.3.2. This was what was available from the ubuntu repos. I also installed the OVMF from the base repos.

I will attempt to install the latest versions of virt-manager and OVMF manually. If this doesn't work out I will just wipe the OS and try Debian instead. I installed Kubuntu just for the purpose of testing this so it's no problem to wipe it.

0 Likes

#23

I believe you will have a better time with this on Debian. Just select KDE in the installer to install KDE for you.

0 Likes

#24

Will do. After some researching I saw that there are USB pass through related bugs with version 1.3.2. (https://bugzilla.redhat.com/show_bug.cgi?id=1293710)

Kudos for the tutorial and the advice. Hopefully I will post back when I am successful!

1 Like

#25

For me personally this is way beyond my expertise (and hardware) for now, but I will DEFINITELY do this in the future when I get the opportunity.

Nice video man! Nice personality also.

A enjoyable video to watch.

3 Likes

#26

I installed Debian stretch and followed the instructions specifically with the exception of the modification needed for the Nvidia cards, as I am passing through an AMD GPU. The installation was straight forward on Debian and I am currently using virt-manager 1.4. I encountered no issues blacklisting the AMD card or installing virt-manager. I also did not need to install the ACS patch as my AMD card is in its own IOMMU group, however I am still encountering some problems with the VM.

I was forced to use win 8.1 instead, as I was having the same problems when trying to use win7 and win10 as I was on Kubuntu. Win7 just gets stuck on the starting windows screen and win10 crashes randomly until it gets stuck in a crash cycle.

Win8.1 seems to be more stable in the VM and did not seem to be crashing like win10. Once the win8.1 VM booted, the display came through the AMD GPU meaning that the pci-passthrough was successful.

Once the windows installation was completed, I only had to install the Ethernet and PCI drivers from the virtIO CD. Strangely under the display adapter section of the device manager, it just displayed Microsoft Basic Display Adapter with no exclamation or error.

I still went ahead and tried to install the AMD driver. During the installation process, the screen went blank and I lost video signal from the AMD card completely. Looking at virt-manager I saw that the VM was still running but the load usage had dropped to almost none. I tried forcing it off then on again.
What happens when you turn the VM on now, is that I get video display from the AMD GPU which shows the windows loading screen then it goes blank and I eventually lose video signal. At this point virt-manager still shows that the VM is running but with very low usage.

Also all this was done as root.

0 Likes

#27

OK, I was able to get the VM working properly by using the i440FX chipset instead of Q35. The VM is now stable and I was able to install the AMD driver successfully. The device manager now reflects the graphics adapter as the AMD R9 390.

Now my only issue seems to be audio. I have tried every audio option but had no luck with any. With some of the audio options like ich6 for example, the windows VM reflects a 2 speaker setup and acts as though it's working, but I hear no audio from the actual speakers. I have a 5.1 setup with the onboard realtek audio. Is it possible to have this same setup on the VM? How did you setup your audio?

0 Likes

#28

Edit /etc/libvirt/qemu.conf and change the options for AllowHostAudio and the other one (can't remember what it's called). Restart libvirt-d. Then it should show up in pulseaudio.

0 Likes

#29

I ended up changing nographics_allow_host_audio = 1, vnc_allow_host_audio = 1 and setting the user and group in /etc/libvirt/qemu.conf. I then got sound but it was crackling. I am not sure of this, but it seems that after I tried adding my current user to pulse and pulse-access groups the crackling seemed to have went away. However it still shows up as a 2 speaker setup in the VM. Still working on it to see if it's possible to get my 5.1 setup in the VM.

0 Likes

#30

I'm pretty sure ich9 supports surround sound.

I didn't have to change the user qemu runs as to make it work. So not sure about that....

0 Likes

#31

Hello!

Thanks for the tutorial! Very solid walk through, and the video is pretty clear.

I'm just running into a few issues that I can't wrap my head around atm.

I've currently got the edits you've laid out for:
* /etc/default/grub
* /etc/modules

I do have the GPU showing as using the vfio-pci driver, however the audio portion won't move over to use the vfio-pci, rather is sticks with snd_hda_intel.

I wondered if this would be due to needing the ACS patch, which I wasn't sure if I needed, but found that I would since the GPU and it's audio show up in the same IOMMU group (which as I understand, would require the ACS patch).

When I try and compile the kernel along with the patch I receive the error seen in my image. I'm not overly familiar with kernel compiling as I've not had to do it before.

Any thoughts are appreciated.

0 Likes

#32

I got that error on kernel 4.8.5 I believe. There is a dirty fix if you google around, don't quite remember it.

As for the IOMMU groups, the GPU and audio device will always be in the same group since it is the same PCI slot. If the entire gpu (audio device too) is in its own group it's fine.

0 Likes

#33

What would cause the audio controller on the GPU to be using the vfio-pci if the GPU is?

output of lspci -k

01:00.0 VGA compatible controller: NVIDIA Corporation GK104 [GeForce GTX 660 Ti] (rev a1)
        Subsystem: eVga.com. Corp. GK104 [GeForce GTX 660 Ti]
        Kernel driver in use: vfio-pci
        Kernel modules: nouveau
01:00.1 Audio device: NVIDIA Corporation GK104 HDMI Audio Controller (rev a1)
        Subsystem: eVga.com. Corp. GK104 HDMI Audio Controller
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel
0 Likes

#34

Well since the GPU is already on it my guess is that when you edited grub to add the vfio PCI stubs there is either a typo or you didn't enter the address for the audio controller.

Remember the vfio-pci.ids=10de:13c0,10de:0fbb line has two addresses separated by commas, the first being the GPU itself and the second the audio device.

0 Likes

#35

That's what I thought as well, a typo being the issue but I've looked over these multiple times.

lspci -nn:

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK104 [GeForce GTX 660 Ti] [10de:1183] (rev a1)
01:00.1 Audio device [0403]: NVIDIA Corporation GK104 HDMI Audio Controller [10de:0e0a] (rev a1)

/etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on vfio-pci.ids=10de:1183,10de:0e0a"

0 Likes

#36

Just so you know, I've had nothing but trouble with the GTX 660 Ti. The 970 I've got works significantly better, and don't get me started on my R9 380.

If you have success, please let me know, I'd love to have a second passthru'd VM.

0 Likes

#37

I don't think the 660 ti supports UEFI.

0 Likes

#38

they are in a weird state, some new revisions have uefi support, and sometimes you can flash a bios for uefi support. 700 series cards are in a similar state, for example my 770 works fine for uefi passthrough. gpu-z may or maynot report uefi support depending on the gfx bios im using, and my mobo uses csm with every bios ive used on the card.

0 Likes

#39

likely a case of vfio-pci not starting early enough in the boot process, (i think fedora has a fix for this, though i dunno about deb based)

it may also be fine that its not on vfio-pci, some devices unbind/rebind drivers just fine. (like most nics, and usb controllers) Alternatively you could try to blacklist the audio driver at boot, then insmod it afterward if something else needs it?

edit: VGA arbitration is only needed if you arent using uefi (i think), but like Graybolt said your card might not actually support uefi

0 Likes

#40

In regards in the audio part you can pass a parameter no the snd_hda_intel to ignore you hdmi component of you gpu:

get a list of the detected soundcard :

aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: ...
  ...
card 1: ...
  ....

create a file /etc/modprobe.d/sound.conf and add:

options snd_hda_intel enable=1,0

with a 1 for each card you want to enable and a 0 for each card you want to disable and reboot

1 Like