On Wed, Jul 30, 2025 at 10:51:13AM +0000, Duan, Zhenzhong wrote:
> >> 2. there can also be more than one vIOMMUs with different user
> >>     configuration, e.g., arm smmuv3.

That's correct. But would you please elaborate how different user
configurations would benefit from this new op? I don't see a good
reasoning behind that.

> >> 4. It's too late for VFIO to call get_viommu_cap() after set_iommu_device()
> >>     because we need get_viommu_cap() to determine if creating nested
> >parent
> >>     hwpt or not at attaching stage, meanwhile hiod realize needs
> >iommufd,
> >
> >hiod -> "host IOMMU device"
> 
> Will do.
> 
> >
> >>     devid and hwpt_id which are ready after attach_device().
> >
> >I find the above sentence difficult to understand.
> 
> This is trying to explain the reason of order between attach_device(), 
> get_viommu_cap() and hiod realizing.
> What about:
> 
> 4. host IOMMU capabilities are passed to vIOMMU through set_iommu_device()
>    interface which have to be after attach_device(), when get_viommu_cap()
>    is called in attach_device(), there is no way for vIOMMU to get host
>    IOMMU capabilities yet, so only emulated capabilities can be returned.
>    See below sequence:
> 
>      attach_device()
>        get_viommu_cap()
>        create hwpt
>      ...
>      vfio_device_hiod_create_and_realize()
>      set_iommu_device(hiod)

I think it should be:

    vfio_device_attach():
        iommufd_cdev_attach():
            pci_device_get_viommu_cap() for HW nesting cap
            create a nesting parent hwpt
            attach device to the hwpt
            vfio_device_hiod_create_and_realize() creating hiod
    ...
    pci_device_set_iommu_device(hiod)

?

Thanks
Nicolin

Reply via email to