On Sun, Sep 19, 2021 at 02:38:44PM +0800, Liu Yi L wrote: > [HACK. will fix in v2] > > There are two options to impelement vfio type1v2 mapping semantics in > /dev/iommu. > > One is to duplicate the related code from vfio as the starting point, > and then merge with vfio type1 at a later time. However vfio_iommu_type1.c > has over 3000LOC with ~80% related to dma management logic, including: I can't really see a way forward like this. I think some scheme to move the vfio datastructure is going to be necessary. > - the dma map/unmap metadata management > - page pinning, and related accounting > - iova range reporting > - dirty bitmap retrieving > - dynamic vaddr update, etc. All of this needs to be part of the iommufd anyhow.. > The alternative is to consolidate type1v2 logic in /dev/iommu immediately, > which requires converting vfio_iommu_type1 to be a shim driver. Another choice is the the datastructure coulde move and the two drivers could share its code and continue to exist more independently Jason