On 5/20/2025 6:05 AM, Daniel P. Berrangé wrote:
Implement "iommufdId" and "iommufdFd" attributes for "hostdev" devices that
can be used to specify associated iommufd object and fd for externally opening
the /dev/iommu and VFIO cdev, when launching a qemu VM.
What does it mean if we enable iommufd on the 'hostdev' without enabling
iommufd on the 'iommu' device, or vica-verca ?
There are checks in this series that prevent enabling iommufd on the
hostdev without enabling iommufd on the iommu device as it would not
make sense to link a hostdev with a non-existent iommufd object.
If enabling iommufd on the iommu device and not enabling iommufd on a
hostdev, qemu will fall back to legacy VFIO behavior for the hostdev and
the iommufd object will not be used for passthrough device mappings.
IMHO it seems like we should be enabling iommufd once only.
I can see why we should be enabling iommufd once only for the initial
iommufd object, but we still need to provide an option to select legacy
VFIO or iommufd for each hostdev definition. And if we would like to
enable iommufd once only for the initial iommufd object, would it make
more sense to move the iommufd attribute outside of the <iommu> stanza
to account for the case where we have multiple <iommu> definitions?
Thanks,
Nathan