Hi guys.
My windows 10 install recently borked after another update gone wrong… Third time in a year… So I’ve decided to check again if I could maybe switch to Linux and still game sometimes (Warframe mostly), and down the GPU passthrough rabbit-hole I went.
I’m writing this because I finally got it to work and I haven’t seen a guide (at least a pretty recent one) to this particular combo of hardware. And also because I want to write down the steps so I can do it again if I have to
So my Hardware/Software :
Intel CPU (i5 6600K)
ASUS MB (z170 Pro Gaming)
Host GPU : idGPU
Guest GPU : Nvidia Card (GTX 1070)
UBUNTU 18.04
I won’t go into super detail of all you have to do, this existing guide is pretty much all you have to know, this is just what you have to do to make it work with this particular combo of hardware/software. AGAIN, PLEASE READ ORIGINAL GUIDE SO YOU KNOW WHAT YOU ARE DOING.
Without further adoo :
sudo nano /etc/default/grub
locate this line and modify it like so, and of course add your ids.
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash iommu=1 intel_iommu=on vfio_pci.ids=10de:1b81,10de:10f0"
Yes, I had to specify the vfio ids here as well, couldn’t get vfio to snag the GPU, nouveau always won the battle even when I was using softdep as you will see later on. Also don’t forget to :
sudo update-grub
Then lets edit :
sudo nano /etc/initramfs-tools/modules
Like so:
softdep nouveau pre: vfio vfio_pci
vfio
vfio_iommu_type1
vfio_virqfd
options vfio_pci ids=10de:1b81,10de:10f0
vfio_pci ids=10de:1b81,10de:10f0
vfio_pci
#nouveau
Then :
sudo nano /etc/modules
has to contain :
vfio
vfio_iommu_type1
vfio_pci
Then make this file :
sudo nano /etc/modprobe.d/nouveau.conf
and paste the following :
softdep nouveau pre: vfio vfio_pci
Then :
sudo nano /etc/modprobe.d/vfio_pci.conf
and add :
options vfio_pci ids=10de:1b81,10de:10f0
Pheeeewww! But wait there’s more
Okay right now you should really
sudo update-initramfs -u
And at this point if you have your monitor hooked up to the HDMI port of your MB and you reboot you will get a a blank screen upon rebooting. Fret not It should actually be kinda ok. If you check : lspci -nnv |less
you should have vfio-pci as the loaded kernel module for your GPU. If you rebooted and are stuck at POST screen then do the following, if you haven’t rebooted then just continue along.
CTRL-ALT-F2
Then we will force UBUNTU to use Xorg and not Wayland:
sudo nano /etc/gdm3/custom.conf
and uncomment the following line :
WaylandEnable=false
and finally let’s tell Xorg which GPU he should use to display :
sudo nano /etc/X11/xorg.conf
and add the following :
Section "Device"
Identifier "Intel GPU"
Driver "modesetting"
BusID "PCI:0:2:0"
EndSection
Where BusID is the BusID of your IDGPU. (find it using lspci -nnv |less
)
That’s it, if you reboot now, everything should be ready to create your VM.
Have Fun!
P.S. : Fun fact : Nvidia drivers check to see if they are running inside a VM or not, if they see they are inside a VM they give you an error and stop working/Installing… anyway :
virsh edit [your vm name]
and make sure to have the followwing inside :
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
<vendor_id state='on' value='ab5485961025'/>
</hyperv>
<kvm>
<hidden state='on'/>
</kvm>
Peace!