summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@intel.com>2025-05-21 19:03:01 +0800
committerCédric Le Goater <clg@redhat.com>2025-06-05 10:40:38 +0200
commit1c729ca8860a5197da62d1fa68d6085a6ec0acd3 (patch)
treef46add2ef60f4b50c4fd3abf77646ea4ff352cfd
parenta483ad534734ad0c9e1fea34d959d0e62838b89e (diff)
downloadfocaccia-qemu-1c729ca8860a5197da62d1fa68d6085a6ec0acd3.tar.gz
focaccia-qemu-1c729ca8860a5197da62d1fa68d6085a6ec0acd3.zip
vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call
The nested IOMMU support needs device and hwpt id which are generated
only after attachment. Hiod encapsulates these information in realize()
and passes to vIOMMU.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250521110301.3313877-1-zhenzhong.duan@intel.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
-rw-r--r--hw/vfio/iommufd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index af1c7ab10a..6b2696793f 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -592,6 +592,10 @@ found_container:
         goto err_listener_register;
     }
 
+    /*
+     * Do not move this code before attachment! The nested IOMMU support
+     * needs device and hwpt id which are generated only after attachment.
+     */
     if (!vfio_device_hiod_create_and_realize(vbasedev,
                      TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO, errp)) {
         goto err_listener_register;