Take back PCI-E video card from QEMU: revert VGA passthrough

>>>Take back PCI-E video card from QEMU: revert VGA passthrough

Several months ago I’ve setup Qemu on my Linux Mint powered workstation to have Windows 10 virtualized for gaming. Hardware virtualization software Quemu/KVM was pretty much the only way to do VGA passthrough – use integrated Intel video card on host system and provide Nvidia GPU equipped one to virtualized operating system. In such way Windows see not virtual VGA (as it would be on VirtualBox or VMware) but actual physical one plugged in to PCI-E slot therefore providing use of official Nvidia driver and full acceleration. There are great guides how to setup VGA passthrough and even run it on unprivileged user, so I won’t go into details about setting up virtualization in this post. Instead, I’ll describe how to take PCI-E card back for use on host system (in my case Linux Mint).

Microsoft Windows 10 turned out to be a nightmare – user interface differs too much even from Windows 7 (which I’m kind of used to due to daily job where I can’t choose OS), updates are pushed and installed whenever Microsoft wants and there is no easy “official” way to turn them off. And most important, device drivers gets messed (probably because of Windows Updates). On PCI-E slot I’ve got ASUS GeForce GTX 1070 TI which has both Nvidia driver pack along with ASUS tweaking and overclocking utilities which from time to time got uninstalled or otherwise broken. In addition to that my favourite Logitech G G920 Driving Force steering wheel had connection problems, so I decided to ditch Windows 10.

Now when problem occured is when I decided to switch to PCI-E video card (Nvidia GeForce) from Onboard (Intel) in BIOS. GRUB bootloaded was showing up after plugging monitor to HDMI socket but login screen of Linux Mint didn’t come up.

I did check if proprietary Nvidia driver for Linux was installed – it was:

sudo apt-get update nvidia-384 nvidia-settings nvidia-modprobe

Actually there was a problem at the stage when system takes over PCI-E card somehow making it unavailable for host system. To fix that is quite simple. You should know device IDs of VGA and HDMI of your Nvidia card:

gytis@pc ~ $ lspci -nn | grep NVIDIA
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1b82] (rev a1)
01:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:10f0] (rev a1)

Now edit following file:

sudo nano /etc/modprobe.d/local.conf

And comment options line where your PCI-E card is mentioned:

# NVIDIA Corporation Device
# options vfio-pci ids=10de:1b82,10de:10f0

There is one more file to edit:

sudo nano /etc/initramfs-tools/modules

Comment following modules which you’ve added when setting up VGA passthrough:

# vfio
# vfio_iommu_type1
# vfio_pci
# vfio_virqfd
# vhost-net

After editing this file initramfs must be updated:

sudo update-initramfs -u

Now just restart computer and enjoy – PCI-E video card should be nicely recognized by host operating system.

Make sure to select vdpau as output driver in your favourite multimedia player (SMPlayer, etc.) to utilize hardware acceleration.

Since I’m back to using Nvidia video card on Linux, I can no longer utilize ASUS tweaking utilities. Therefore next step will be trying to do some overclocking based on this guide and that one. Stay tuned for updates!

2018-08-26T00:39:20+00:002018-08-26|Linux Mint|0 Comments

About the Author:

Gytis Repečka is System analyst with passion to open source, electronics & cars, spreading bits about tech, music and privacy.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.