Re: [PATCH v12 03/12] iommu/arm-smmu-v3: Make the ASID space per SMMU instance
From: Nicolin Chen
Date: Mon Nov 16 2026 - 13:22:50 EST
On Mon, Nov 16, 2026 at 09:46:31AM +0000, John Garry wrote:
> On 11/2/26 05:19, Nicolin Chen wrote:
> > An ASID tags the TLB entries within one SMMU, so two instances can use the
> > same ASID without ever aliasing each other. Yet the driver allocates them
> > out of a single global xarray, which makes the instances share a space that
> > the hardware keeps apart, and lets one instance exhaust the IDs of another.
> >
> > That global space is a leftover from the BTM support that shared ASIDs with
> > the CPU. Now ARM_SMMU_FEAT_BTM is never set, nothing looks a domain up by
> > its ASID, and a domain is pinned to one SMMU at the attach.
> >
> > Give each SMMU its own asid_map, mirroring the per-SMMU vmid_map, and clean
> > it up with devres,
>
> maybe you could use a single devres for both vmid and asid cleanup, but I am
> not sure if it would be neater.
Doesn't seem neater to me. I'd keep them separate as-is.
> > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > index 5cabbe5652dc6..cb45bd154c9e5 100644
> > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> > @@ -90,7 +90,6 @@ struct arm_smmu_option_prop {
> > const char *prop;
> > };
> > -DEFINE_XARRAY_ALLOC1(arm_smmu_asid_xa);
> > DEFINE_MUTEX(arm_smmu_asid_lock);
>
> Ignoring what I wrote above, it may be worth adding a comment that this
> global lock now covers per-SMMU instance asid maps.
/* Global lock serializing the STE/CD updates against ASID changes */
Nicolin