This should be a quick one. I bought some older hardware for my home lab/home services and one of the things I want to do with it is host my plex server on it. Plex benefits from a GPU, it doesn’t have to be a fancy one, but a lower end nvidia GeForce desktop adapter will help with transcoding. So I’ve been working on PCI passthrough for a desktop adapter that’s in the system, to a libvirt qeum-kvm guest which will run Plex.

I don’t have plex running yet, but I ran into a lot of trouble getting the passthrough working. Apparently on some HP hardware, there’s an issue with PCI interrupts when doing iommu passthrough. The old server I have happens to be an HP.

So I found this KB article on our (Red Hat’s) web site, that addresses this exact issue. In summary, there’s a work-around, you tell the vfio kernel module to “allow_unsafe_interrupts” and this is supposed to make it all work. Without it, you get an error in your /var/log/messages to the tune of:

kernel: vfio_iommu_type1_attach_group: No interrupt remapping support.  Use the module param "allow_unsafe_interrupts" to enable VFIO IOMMU support on this platform
internal error: qemu unexpectedly closed the monitor: 2022-10-24T19:56:18.812756Z qemu-kvm: -device vfio-pci,host=0000:0b:00.0,id=hostdev0,bus=pci.7,addr=0x0: vfio 0000:0b:00.0: failed to setup container for group 33: Failed to set iommu for container: Operation not permitted

Our KB says to enable the vfio-pci module, and add the option “allow_unsafe_interrupts 1”

The article was written for RHEL 8 and older, I am on RHEL 9. I found that this doesn’t work on RHEL 9, I kept seeing this in the logs when I tried to add the option:

kernel: vfio: unknown parameter 'allow_unsafe_interrupts' ignored

But the kernel clearly told me that I should enable allow_unsafe_interrupts, right? Sort of. I noticed later that it’s referring to the vfio_iommu_type1 module. So I did the following:

In /etc/modprobe.d, I created the file vfio_iommu_type1.conf, which contains:

$ pwd
/etc/modprobe.d
$ cat vfio_iommu_type1.conf
options vfio_iommu_type1 allow_unsafe_interrupts=1 

You can also see, and change this option by looking at, or changing /sys/module/vfio_iommu_type1/allow_unsafe_interrupts (changing from N to Y) to make the change on the fly. This of course will not survive a reboot unless you also made the file change above.