In this tutorial, I will be using Debian Sid to bind a GPU to the vfio-pci driver. This is to make sure that the system doesn’t use the GPU so that we can successfully pass it through to our guest. The process is the same for Debian Stretch and Testing.

Read also: Critical Update Lands For Ryzen

Finding Device IDs for Passthrough

The first thing you will do is open up your terminal emulator and use the command “lspci -nnk”. This will output a lot of devices. What you want to look for is something like this.

lspci -nnk

For my system, I want to have the GTX 970 used by my Debian host. The GTX 1080 will be passed through to the guest. What we want from this is 10de:1b80 and 10de:10f0 that you see towards the end of the lines for the card you will be passing through and it’s audio device.

GPU ids

Enabling vfio-pci and Updating Initramfs

Next, we want to put these numbers into the modules file that is inside our initramfs-tools directory. The file you’ll want to edit is /etc/initramfs-tools/modules

nano /etc/initramfs-tools/modules

At the bottom of this file, we are going to put this line below. You will want to change out the ids with those of your own graphics card

vfio_pci ids=10de:1b80,10de:10f0

after you added that to the end of the file you will have to update your initramfs. This can be accomplished by running either:

update-initramfs -u

This command updates only the initramfs of the newest kernel

update-initramfs -u -k all

This command will update all of your initramfs

Once completed, all you will need to do is reboot your system. Once you’re back up and running you can use lspci -nnk to check if vfio-pci has taken control of the device. Under the graphics card, you chose you will see “Kernel driver in use: vfio-pci”

Blacklisting Nouveau

In the event that you are using Nvidia drivers for your other graphics card this is enough to be finished with the project. If you are using nouveau as your driver, or if nouveau has decided to take control of your Nvidia GPU instead of vfio-pci, then we will have to do one more step. We have to blacklist Nouveau.

This can be accomplished by editing the /etc/modprobe.d/blacklist.conf file. If this file does not exist you can create it with the same command as you would use to edit it.

nano /etc/modprobe.d/blacklist.conf

Inside this file, we will add these lines below.

blacklist nouveau
options nouveau modeset-0

After you’ve done that save and exit the file. In order to apply the settings it is time to reboot and check if vfio-pci has taken control of your GPU.

This time you should see that the Kernel driver in use is vfio-pci. If so then you’re ready to start getting your Virtual Machine setup for GPU passthrough.

Join our Discord to discuss and find help with other VFIO related tasks!