iommufd_builtin() can be used to check at runtime whether the IOMMUFD feature is built in a qemu-system binary. Signed-off-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx> --- docs/devel/vfio-iommufd.rst | 2 +- include/system/iommufd.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/devel/vfio-iommufd.rst b/docs/devel/vfio-iommufd.rst index 3d1c11f175e..08882094eee 100644 --- a/docs/devel/vfio-iommufd.rst +++ b/docs/devel/vfio-iommufd.rst @@ -88,7 +88,7 @@ Step 2: configure QEMU ---------------------- Interactions with the ``/dev/iommu`` are abstracted by a new iommufd -object (compiled in with the ``CONFIG_IOMMUFD`` option). +object (which availability can be checked at runtime using ``iommufd_builtin()``). Any QEMU device (e.g. VFIO device) wishing to use ``/dev/iommu`` must be linked with an iommufd object. It gets a new optional property diff --git a/include/system/iommufd.h b/include/system/iommufd.h index cbab75bfbf6..3fedf8cfb63 100644 --- a/include/system/iommufd.h +++ b/include/system/iommufd.h @@ -63,4 +63,10 @@ bool iommufd_backend_get_dirty_bitmap(IOMMUFDBackend *be, uint32_t hwpt_id, Error **errp); #define TYPE_HOST_IOMMU_DEVICE_IOMMUFD TYPE_HOST_IOMMU_DEVICE "-iommufd" + +static inline bool iommufd_builtin(void) +{ + return type_is_registered(TYPE_IOMMUFD_BACKEND); +} + #endif -- 2.47.1