On Mon, Mar 14, 2022 at 04:50:33PM -0600, Alex Williamson wrote: > > +/* > > + * The KVM_IOMMU type implies that the hypervisor will control the mappings > > + * rather than userspace > > + */ > > +#define VFIO_KVM_IOMMU 11 > > Then why is this hosted in the type1 code that exposes a wide variety > of userspace interfaces? Thanks, It is really badly named, this is the root level of a 2 stage nested IO page table, and this approach needed a special flag to distinguish the setup from the normal iommu_domain. If we do try to stick this into VFIO it should probably use the VFIO_TYPE1_NESTING_IOMMU instead - however, we would like to delete that flag entirely as it was never fully implemented, was never used, and isn't part of what we are proposing for IOMMU nesting on ARM anyhow. (So far I've found nobody to explain what the plan here was..) This is why I said the second level should be an explicit iommu_domain all on its own that is explicitly coupled to the KVM to read the page tables, if necessary. But I'm not sure that reading the userspace io page tables with KVM is even the best thing to do - the iommu driver already has the pinned memory, it would be faster and more modular to traverse the io page tables through the pfns in the root iommu_domain than by having KVM do the translations. Lets see what Matthew says.. Jason