Re: [PATCH v3 08/10] iommu/arm-smmu-v3: Allocate INV_TYPE_S2_VMID_VSMMU in arm_vsmmu_init

From: Nicolin Chen

Date: Thu Mar 12 2026 - 15:55:07 EST


On Thu, Mar 12, 2026 at 05:11:20PM +0000, Jonathan Cameron wrote:
> On Mon, 23 Feb 2026 12:27:44 -0800
> Nicolin Chen <nicolinc@xxxxxxxxxx> wrote:
> > +void arm_vsmmu_destroy(struct iommufd_viommu *viommu)
> > +{
> > + struct arm_vsmmu *vsmmu = container_of(viommu, struct arm_vsmmu, core);
> > +
> > + guard(mutex)(&arm_smmu_asid_lock);
> > + /*
> > + * arm_smmu_iotlb_tag_free() must have flushed the IOTLB with the VMID,
> > + * but it did not free the VMID to align its lifecycle with the vSMMU.
> > + */
> > + ida_free(&vsmmu->smmu->vmid_map, vsmmu->vmid);
>
> I'm being slow today, but why do you need the lock?
> The ida itself doesn't need it according to the docs.
> (it's using the xarray lock underneath)
>
> Likewise of the ida_alloc_range()

You are right. These do seem unnecessary.

Thanks!
Nicolin