Re: [PATCH v1 3/9] iommu/arm-smmu-v3: Store ASIDs and VMID in arm_smmu_master
From: Nicolin Chen <hidden>
Date: 2025-12-19 19:17:29
Also in:
linux-iommu, linux-patches, lkml
On Fri, Dec 19, 2025 at 11:16:08AM -0400, Jason Gunthorpe wrote:
On Thu, Dec 18, 2025 at 12:26:49PM -0800, Nicolin Chen wrote:quoted
Currently, ASID is allocated per smmu_domain, stored in the domain, and freed with the domain. Practically, ASID is only used in a CD as an iotlb tag. Therefore, ASID doesn't really follow the life cycle of a domain but domain attachment. On the other hand, the CD carrying ASID is installed to a device's STE. This applies to the VMID as well, which is installed in an STE directly. Since a device can only have one ASID per SSID and one VMID per SID, add an ASID array and VMID in the arm_smmu_master structure, to decouple the ASID/VMID from the domain structure.I don't think this is entirely right.. When a S1 is attached to a master the master needs to store the VMID it is using, as the VMID is global to the STE and effectively becomes global to the master. But the ASID should be stored in the invalidation list of the domain.
Hmm, you mean the nested case (host VMID + guest ASID), right? But in that case, the guest-level ASID isn't needed anywhere in the host driver? The ASID should be configured in a guest-level CD. And the invalidation command directly coming from the guest is already filled with the guest-level ASID. Also, the invalidation array stores either ASID or VMID, there is no case of storing both, right?
Jus search the list for the (instance, vmid) pair of the master to get back the right ASID. We don't need to store it again in another list, that's confusing.
Okay. I was trying to get rid of the extra for loop searching for an ID in the array. That's why I had the alloc_id/free_id ops too, so everything would be done in existing two loops in the merge/unref functions. Nicolin