Re: [RFC PATCH 3/5] qemu: Implement support for associating iommufd to hostdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 14, 2025 at 07:54:12PM -0700, Nathan Chen via Devel 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>


>       </hostdev>
>     </devices>
>     ...
> @@ -4829,6 +4830,14 @@ or:
>     device; if PCI ROM loading is disabled through this attribute, attempts to
>     tweak the loading process further using the ``bar`` or ``file`` attributes
>     will be rejected. :since:`Since 4.3.0 (QEMU and KVM only)`.
> +``iommufdId``
> +   The ``iommufdId`` element is used to specify using the iommufd interface to
> +   propagate DMA mappings to the kernel, instead of legacy VFIO. When the
> +   element is present, an iommufd object with its ID specified by ``iommufdId``
> +   will be created by the resulting qemu command. Libvirt will open the
> +   /dev/iommu and VFIO device cdev, passing the associated file descriptor
> +   numbers to the qemu command.
> +
>  ``address``
>     The ``address`` element for USB devices has a ``bus`` and ``device``
>     attribute to specify the USB bus and device number the device appears at on

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux