Virtualization with GPU Passthrough [NOT complete]

This guide shows how to setup a Ubuntu18.04 Host machine with a Windows 10 GPU passthrough using VFIO & libvirtd

In this guide i will use my AMD GPU on the host linux systems, and the Nvidia GPU on the guest system: Windows

More to come

Specs:
AMD Ryzen 7 2700x 8core
Gigabyte Aorus x470 Wifi7 Motherboard
16GB Kingston ECC 2400MHz Value Ram
Amd RX550 GPU
Nvidia Geforce 1050 (Asus)
Multiple SSD from Samsung and OCZ

Howto:

Identifying hardware:
Edit /etc/default/grub and find the line below. Append “iommu=1 intel_iommu=on”

GRUB_CMDLINE_LINUX_DEFAULT="iommu=1 intel_iommu=on"

For AMD systems it should look something like this:

GRUB_CMDLINE_LINUX_DEFAULT="iommu=1 amd_iommu=on"

Update Grub and reboot, for the edit to take affect.

grub-update
reboot

run the script lsd-iommu.sh as show below.

Look for the Entries with VGA, take note of the IOMMU group, and the hardware address [1003:8A23]
Under each GPU entry, you should also have the soundcard from GPU in the same IOMMU group.

Enabling VFIO & Setting Kernel Parameters

Using LibVirtD:

Install LibVirt and tools:

apt install virt-manager qemu-kvm ovmf

Links:

https://forum.level1techs.com/t/play-games-in-windows-on-linux-pci-passthrough-quick-guide/108981

https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF

Scripts:

ls-iommu.sh

#!/bin/bash
for d in /sys/kernel/iommu_groups/*/devices/*; do
  n=${d#*/iommu_groups/*}; n=${n%%/*}
  printf 'IOMMU Group %s ' "$n"
  lspci -nns "${d##*/}"
done