Looking for VFIO wizards to troubleshoot error vfio_dma_map = -22

Hi,

I have a NAS that runs a virtual machine using kvm/qemu. I pass through 1 network interface into the VM. This has worked perfectly fine for many years except for one thing: due to a BIOS issue with my HP microserver (Gen8) I have to patch & build the kernel myself per this article https://forums.unraid.net/topic/72681-unraid-hp-proliant-edition-rmrr-error-patching .

I recently tried to move from kernel 5.3 (eoan based) to 5.4 (focal based). Compilation is always done from the Ubuntu .deb sources, I just apply the rmrr patch.

The VM refuses to start, and spits out this VFIO error that I can’t find much information about:

error : qemuProcessReportLogError:1914 : internal error: qemu unexpectedly closed the monitor: 2020-02-14T12:24:47.749954Z qemu-system-x86_64: -device vfio-pci,host=07:00.0,id=hostdev0,bus=pci.0,addr=0x3: VFIO_MAP_DMA: -22
qemu-system-x86_64: -device vfio-pci,host=07:00.0,id=hostdev0,bus=pci.0,addr=0x3: vfio_dma_map(0x5599ab2f1750, 0xe0000, 0x20000, 0x7f1f94a20000) = -22 (Invalid argument)
qemu-system-x86_64: -device vfio-pci,host=07:00.0,id=hostdev0,bus=pci.0,addr=0x3: vfio error: 0000:07:00.0: failed to setup container for group 1: memory listener initialization failed for container: Invalid argument

If I remove the passed through adapter from the VM, it will start fine (but is largely useless ;-)).

I assume issues start with this invalid argument error, but I don’t know what causes it or why it is -22 or what that even means. I just reboot into the 5.3 kernel for now to get up and running but I want to understand this better. The issue only exists with kernel 5.4. The NAS is running for nearly 4 years, and I have never had this issue before.