qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call
@ 2025-05-21 11:03 Zhenzhong Duan
  2025-05-21 13:12 ` Cédric Le Goater
  2025-05-21 15:26 ` Cédric Le Goater
  0 siblings, 2 replies; 3+ messages in thread
From: Zhenzhong Duan @ 2025-05-21 11:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson, clg, chao.p.peng, Zhenzhong Duan

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>
---
 hw/vfio/iommufd.c | 4 ++++
 1 file changed, 4 insertions(+)

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;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call
  2025-05-21 11:03 [PATCH] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call Zhenzhong Duan
@ 2025-05-21 13:12 ` Cédric Le Goater
  2025-05-21 15:26 ` Cédric Le Goater
  1 sibling, 0 replies; 3+ messages in thread
From: Cédric Le Goater @ 2025-05-21 13:12 UTC (permalink / raw)
  To: Zhenzhong Duan, qemu-devel; +Cc: alex.williamson, chao.p.peng

On 5/21/25 13:03, Zhenzhong Duan wrote:
> 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>

Thanks,

C.


> ---
>   hw/vfio/iommufd.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> 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;



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call
  2025-05-21 11:03 [PATCH] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call Zhenzhong Duan
  2025-05-21 13:12 ` Cédric Le Goater
@ 2025-05-21 15:26 ` Cédric Le Goater
  1 sibling, 0 replies; 3+ messages in thread
From: Cédric Le Goater @ 2025-05-21 15:26 UTC (permalink / raw)
  To: Zhenzhong Duan, qemu-devel; +Cc: alex.williamson, chao.p.peng

On 5/21/25 13:03, Zhenzhong Duan wrote:
> 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>
> ---
>   hw/vfio/iommufd.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> 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;


Applied to vfio-next.

Thanks,

C.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-21 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 11:03 [PATCH] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call Zhenzhong Duan
2025-05-21 13:12 ` Cédric Le Goater
2025-05-21 15:26 ` Cédric Le Goater

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).