On 8/27/2025 7:04 AM, Daniel P. Berrangé wrote:
Implement iommufdId attribute for hostdev devices that
can be used to specify associated iommufd object when
launching a qemu VM.
Signed-off-by: Nathan Chen<nathanc@xxxxxxxxxx>
---
docs/formatdomain.rst | 9 +++++++++
src/conf/domain_conf.c | 20 ++++++++++++++++++++
src/conf/domain_conf.h | 1 +
src/conf/schemas/domaincommon.rng | 9 +++++++++
src/qemu/qemu_command.c | 14 ++++++++++++++
5 files changed, 53 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 2558df18ef..e2b9be16c9 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -4581,6 +4581,7 @@ or:
</source>
<boot order='1'/>
<rom bar='on' file='/etc/fake/boot.bin'/>
+ <iommufdId>iommufd0</iommufdId>
IIUC, the only place that is used is in the QEMU command line as an
'id' value.
I'm sure we've discussed this before, but could you remind me - are
we expecting every <hostdev> to have a separate iommufd FD, or are
we expecting the same FD for all, or both/either ?
ie we turn this into a simple yes/no flag ? If not, then we can
probably turn this into a simple index value to express the uniqueness
/ sharing characteristics, without exposing the QEMU ID string concept
directly.
Either way, we can probably stuff this under <driver> rather than
creating a new element eg
<driver .... iommufd=yes|no>
or
<driver .... iommufdIndex="NNNN"/>
depending on the answer to the previous Q>
We would expect separate FDs for each VFIO cdev
(/dev/vfio/devices/vfioX) and a shared FD among the devices for
/dev/iommu (the <iommufdId> value here). Agreed that we can turn this
into a simple yes/no flag and put it under <driver>. I will note this
for the next revision.
Thanks,
Nathan Chen