On 11/21/2025 7:14 AM, Ján Tomko wrote:
On a Thursday in 2025, Nathan Chen wrote:
On 11/6/2025 10:14 AM, Ján Tomko wrote:
Hi,
This series implements support for using iommufd to propagate DMA
mappings to the kernel for VM-assigned host devices in a qemu VM.
We add a new 'iommufd' attribute for hostdev devices to be
associated with the iommufd object.
For instance, specifying the iommufd object and associated hostdev in a
VM definition:
<devices>
...
<hostdev mode='subsystem' type='pci' managed='no'>
<driver iommufd='yes'/>
<source>
<address domain='0x0009' bus='0x01' slot='0x00' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x15' slot='0x00'
function='0x0'/>
</hostdev>
<hostdev mode='subsystem' type='pci' managed='no'>
<driver iommufd='yes'/>
<source>
<address domain='0x0019' bus='0x01' slot='0x00' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x16' slot='0x00'
function='0x0'/>
</hostdev>
...
</devices>
Are there any hardware/kernel requirements, or something done to be
host? Even when I add the device to the vfio-pci driver, it does not
create /dev/vfio/devices for me:
error: unsupported configuration: VFIO device /dev/vfio/devices/vfio0
not found - ensure device is bound to vfio-pci driver
Kernel: 6.17.6-300.fc43.x86_64 on Fedora
The answer was that the Fedora kernel did not have
CONFIG_VFIO_DEVICE_CDEV=y
enabled.
Jano
That makes sense - loading the VFIO driver should already load the
iommufd module. I will avoid including any changes in the 'managed'
hostdev logic for iommufd especially because we are not
binding/unbinding hostdevs to the iommufd module.
Thanks,
Nathan
QEMU: v10.1.0-2147-g917ac07f9a (the current master)
Also, I'd expect it to just work with managed='yes'.
The iommufd module should be loaded before adding the device to the
vfio-pci driver:
# lsmod | grep iommufd
iommufd 327680 1 vfio
I will ensure the iommufd module gets loaded with managed='yes' in the
next revision, thanks for catching that.