How do I enable KVM device passthrough in Linux?

Solution 1:

The solution to this issue is to enable IOMMU in your GRUB boot parameters.

You can do this by setting the following in /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on"

If you're using an AMD processor, you should append amd_iommu=on to the boot parameters instead

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=on"

Then run update-grub and reboot

This link helped me quite a bit: https://www.centos.org/forums/viewtopic.php?f=47&t=48115

See also: https://pve.proxmox.com/wiki/Pci_passthrough

This eluded me somewhat as I believed that iommu was an AMD alternative to VT-D.

Solution 2:

Adding to Anonymouslemming's answer: There seems to be a bug in Ubuntu (18.04 for me), which causes the setting for GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub to be ignored.

It can be fixed by commenting out the GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub.d/50-curtin-settings.cfg

https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1569567