Insufficient permissions for pci passthrough

So after months and months of failure, I took another crack at trying VFIO GPU passthrough using Ubuntu 21.04, and various internet guides.

For some reason, I am getting the below issues when I try to run the VM attached with the GPU. This is a new box and a fresh install. I’ve probably overlooked something very obvious. Any ideas? Thanks.

Error starting domain: internal error: qemu unexpectedly closed the monitor: 2020-12-30T09:37:52.399631Z qemu-system-x86_64: -device vfio-pci,host=0000:08:00.0,id=hostdev0,bus=pci.0,addr=0xa: vfio 0000:08:00.0: failed to setup container for group 2: Failed to set iommu for container: Operation not permitted

Traceback (most recent call last):
File “/usr/share/virt-manager/virtManager/asyncjob.py”, line 65, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File “/usr/share/virt-manager/virtManager/asyncjob.py”, line 101, in tmpcb
callback(*args, **kwargs)
File “/usr/share/virt-manager/virtManager/object/libvirtobject.py”, line 57, in newfn
ret = fn(self, *args, **kwargs)
File “/usr/share/virt-manager/virtManager/object/domain.py”, line 1329, in startup
self._backend.create()
File “/usr/lib/python3/dist-packages/libvirt.py”, line 1234, in create
if ret == -1: raise libvirtError (‘virDomainCreate() failed’, dom=self)
libvirt.libvirtError: internal error: qemu unexpectedly closed the monitor: 2020-12-30T09:37:52.399631Z qemu-system-x86_64: -device vfio-pci,host=0000:08:00.0,id=hostdev0,bus=pci.0,addr=0xa: vfio 0000:08:00.0: failed to setup container for group 2: Failed to set iommu for container: Operation not permitted

Make sure you are passing through all of the devices in the IOMMU group.

You may also need to allow unsafe interrupts.

I’m having Issues Getting the VFIO driver to take the gpu.
would you mind sharing how you got it working?

I added

amd_iommu=on iommu=pt kvm.ignore_msrs=1 vfio-pci.ids=[PCIe:ID],[PCIe:ID]

and updated grub.
but no bueno. still seeing:

	Kernel driver in use: amdgpu

Have you made the necessary modifications to the /etc/mkinitcpio.conf and regenerated the initramfs?

Just realized that i butterfingered in my Ansible script.
i additionally set the GRUB_CMDLINE_LINUX_DEFAULT to the wrong setting at the end of the file.

Thanks for the response!

1 Like