On Fri, Nov 29, 2024 at 02:38:10PM +0000, Shameerali Kolothum Thodi wrote: > > + /* FIXME Move VMID allocation from the S2 domain allocation to > > here */ > > I am planning to respin the " iommu/arm-smmu-v3: Use pinned KVM VMID for > stage 2" [0] based on the latest IOMMUF code. One of the comment on that > RFC was, we should associate the KVM pointer to the sub objects like viommu > instead of iommufd itself[1]. Yes > But at present the s2 domain is already finalized > with a VMID before a viommu object is allocated. Right, this needs fixing up. The vmid must come from the viommu and the same s2 domain shared by viommus needs different vmids. > So does the above comment indicates that we plan to do another > S2 VMID allocation here and replace the old one? I have been planning to remove the vmid and asid values from the domains, along with the instance pointers. When the domain is attached in some way the vmid and instance will be recorded in a list. A viommu attach will use the vmid from the viommu, a normal attach will allocate a vmid for each instance. This will also allow S2's to be shared across instances which is another issue we have (10 copies of the S2 on big server HW is wasteful) It is simple enough to explain, but I think the datastructure will be a bit tricky to keep invalidations efficient. I haven't even started typing it in yet. But it is the next step in this project. The vcmdq has the same issue with vmid assignment as you are facing. Jason