On Fri, Mar 18, 2022 at 07:01:19AM +0000, Tian, Kevin wrote: > > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > Sent: Tuesday, March 15, 2022 10:55 PM > > > > The first level iommu_domain has the 'type1' map and unmap and pins > > the pages. This is the 1:1 map with the GPA and ends up pinning all > > guest memory because the point is you don't want to take a memory pin > > on your performance path > > > > The second level iommu_domain points to a single IO page table in GPA > > and is created/destroyed whenever the guest traps to the hypervisor to > > manipulate the anchor (ie the GPA of the guest IO page table). > > > > Can we use consistent terms as used in iommufd and hardware, i.e. > with first-level/stage-1 referring to the child (GIOVA->GPA) which is > further nested on second-level/stage-2 as the parent (GPA->HPA)? Honestly I don't like injecting terms that only make sense for virtualization into iommu/vfio land. That area is intended to be general. If you use what it exposes for virtualization, then great. This is why I prefer to use 'user page table' when talking about the GIOVA->GPA or Stage 1 map because it is a phrase independent of virtualization or HW and clearly conveys what it is to the kernel and its inherent order in the translation scheme. The S1/S2 is gets confusing because the HW people choose those names so that S1 is the first translation a TLP sees and S2 is the second. But from a software model, the S2 is the first domain created and the first level of the translation tree, while the S1 is the second domain created and the second level of the translation tree. ie the natural SW numbers are backwards. And I know Matthew isn't working on HW that has the S1/S2 HW naming :) But yes, should try harder to have good names. Maybe it will be clearer with code. Jason