backends/iommufd: Introduce the iommufd object

Introduce an iommufd object which allows the interaction
with the host /dev/iommu device.

The /dev/iommu can have been already pre-opened outside of qemu,
in which case the fd can be passed directly along with the
iommufd object:

This allows the iommufd object to be shared accross several
subsystems (VFIO, VDPA, ...). For example, libvirt would open
the /dev/iommu once.

If no fd is passed along with the iommufd object, the /dev/iommu
is opened by the qemu code.

Suggested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Eric Auger 2023-11-21 16:44:00 +08:00 committed by Cédric Le Goater
parent dbb9d0c969
commit 6e6d8ac62b
8 changed files with 337 additions and 0 deletions

View file

@ -5224,6 +5224,18 @@ SRST
The ``share`` boolean option is on by default with memfd.
``-object iommufd,id=id[,fd=fd]``
Creates an iommufd backend which allows control of DMA mapping
through the ``/dev/iommu`` device.
The ``id`` parameter is a unique ID which frontends (such as
vfio-pci of vdpa) will use to connect with the iommufd backend.
The ``fd`` parameter is an optional pre-opened file descriptor
resulting from ``/dev/iommu`` opening. Usually the iommufd is shared
across all subsystems, bringing the benefit of centralized
reference counting.
``-object rng-builtin,id=id``
Creates a random number generator backend which obtains entropy
from QEMU builtin functions. The ``id`` parameter is a unique ID