On Wed, Nov 02, 2022 at 03:28:20PM +0800, Yi Liu wrote: > On 2022/10/26 02:50, Jason Gunthorpe wrote: > > This makes VFIO_GROUP_SET_CONTAINER accept both a vfio container FD and an > > iommufd. > > > > In iommufd mode an IOAS will exist after the SET_CONTAINER, but it will > > not be attached to any groups. > > is there any special reason that we cannot attach the IOAS in the SET > container phase or SET_IOMMU phase? It is because iommufd has been deliberately made to work only on struct device * not iommu_groups, and when we go to do the SET_CONTAINER we have no idea what the device will be. So defering the operation is the cleanest approach. > > From a VFIO perspective this means that the VFIO_GROUP_GET_STATUS and > > VFIO_GROUP_FLAGS_VIABLE works subtly differently. With the container FD > > the iommu_group_claim_dma_owner() is done during SET_CONTAINER but for > > IOMMFD this is done during VFIO_GROUP_GET_DEVICE_FD. Meaning that > > s/IOMMFD/IOMMUFD Done Jason