Linux – Splitting an IOMMU group for PCIe Passthrough

kvm-virtualizationlinuxpassthroughpci-expressvirtualization

I am trying to passthrough my graphics card to a virtual machine using kvm and libvirt. I get an error message when I try to passthrough the card without binding an ethernet card which seems to be in the same IOMMU group to the vfio-pci driver.

I'd like to use that ethernet port on the host so I am wondering if I can split the IOMMU group. The reference on these things seems to be this blog post which mentions near the bottom that

Newer kernels than used for this example will split this IOMMU group as support has been added to expose the isolation capabilities of this chipset, even though it does not support PCIe ACS directly.

But I am on kernel 4.10, and this blog post is from 2014, so I am wondering if there were any new developments in the space.

My basic question is can I find out of the IOMMU group is splitable and if so how can I split it?

Best Answer

I wasnt able to find any native method of splitting the IOMMU group: if it is splittable it will be split on boot

However, there is a patch that overrides the IOMMU placement

this thread will lead you to this patch which builds successfully against the 4.8 kernel that ships with ubuntu 16.10 by default.

After applying this patch and building the new kernel, my IOMMU groups were split and passthrough works as I want. Note that it is possible to leak DMA's across devices in theory but I've never heard of it happening and it works flawlessly for me.