[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250407165220.GH1557073@nvidia.com>
Date: Mon, 7 Apr 2025 13:52:20 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Pranjal Shrivastava <praan@...gle.com>
Cc: Nicolin Chen <nicolinc@...dia.com>, will@...nel.org,
robin.murphy@....com, joro@...tes.org,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, shameerali.kolothum.thodi@...wei.com
Subject: Re: [PATCH v1 3/4] iommu/arm-smmu-v3: Decouple vmid from S2
nest_parent domain
On Mon, Apr 07, 2025 at 10:51:24AM +0000, Pranjal Shrivastava wrote:
> > @@ -381,15 +401,24 @@ struct iommufd_viommu *arm_vsmmu_alloc(struct device *dev,
> > !(smmu->features & ARM_SMMU_FEAT_S2FWB))
> > return ERR_PTR(-EOPNOTSUPP);
> >
> > + vmid = ida_alloc_range(&smmu->vmid_map, 1, (1 << smmu->vmid_bits) - 1,
> > + GFP_KERNEL);
> > + if (vmid < 0)
> > + return ERR_PTR(vmid);
> > +
>
> Probably a basic question, I hope we'll have one vSMMU per VM?
A VIOMMU is tied to the physical SMMU, it cannot be shared across
physical SMMU, so this is the right sort of way to get the ID
> Even if that's not the case then the VMM should take care of
> invalidating contexts of all associated vSMMUs anyway? (Just
> thinking if we should allocate a VMID per VM or per vSMMU)
If the VMM wants to present a single vSMMU to the VM then the VMM
needs to replicate invalidations as required to all the physical
VIOMMU objects. This will prevent using the HW accelerated
invalidation paths, so I expect that the VMM will have one vSMM per
physical.
> Nit: Does it makes sense to create a helper like `arm_smmu_vmid_alloc`
> and call it here and finalise_s2?
Maybe so
Jason
Powered by blists - more mailing lists