This is an example of how to passthrough an NVIDIA GPU to a virtual Windows 10 on Linux Mint 18.3 using QEMU/KVM with crackle free audio output and massively improved audio input delay.
- Hugepage memory backing for virtual memory tuning.
- VirtIO is used for storage and network for best performance.
- Intel HD graphics is used for host video.
Please note, that this is still work in progress, and some information is missing.
- CPU: Intel Core i7 7700K
- RAM: 32 GB
- GPU: Gainward GTX 1070 8GB
- Motherboard: ASUS STRIX Z270F GAMING
- Storage: Intel 512GB SSD (storage pool)
todo
/etc/libvirt/qemu.conf
user = "1000"
mkdir -p ~/src
git clone https://github.com/spheenik/qemu.git ~/src/qemu-spheenik
mkdir ~/src/qemu-spheenik/build && cd ~/src/qemu-spheenik/build
../configure --prefix=/opt/qemu-spheenik --python=/usr/bin/python2 --target-list=x86_64-softmmu --audio-drv-list=pa --disable-werror
make
sudo make install
/etc/default/grub.d/isolate_cpus.conf
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT isolcpus=2,3,6,7"
/etc/default/grub.d/intel_iommu.conf
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT intel_iommu=on"
/etc/modules-load.d/kvm.conf
kvm
kvm_intel
/etc/modules-load.d/vfio.conf
vfio
vfio_pci
vfio_virqfd
vfio_iommu_type1
/etc/modprobe.d/blacklist-video.conf
blacklist nouveau
blacklist nvidia
/etc/modprobe.d/kvm.conf
options kvm_intel nested=1
Discover the video and audio IDs of the NVIDIA vga device using this command
lspci -nn | grep NVIDIA
/etc/modprobe.d/vfio.conf
options vfio-pci ids=10de:1b81,10de:10f0
options vfio_iommu_type1 allow_unsafe_interrupts=1
/etc/sysctl.d/60-hugepages.conf
# Allocate 8192 HugePageTables (16GB)
vm.nr_hugepages = 8192
sudo update-grub
sudo update-initramfs -u
Full libvirt domain XML domain xml