[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260102155715.GC125162@nvidia.com>
Date: Fri, 2 Jan 2026 11:57:15 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: will@...nel.org, robin.murphy@....com, joro@...tes.org, jpb@...nel.org,
praan@...gle.com, miko.lenczewski@....com,
linux-arm-kernel@...ts.infradead.org, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH v1 2/9] iommu/arm-smmu-v3: Add alloc_id/free_id functions
to arm_smmu_invs
On Tue, Dec 30, 2025 at 10:52:53AM -0800, Nicolin Chen wrote:
> Hi Jason,
>
> On Fri, Dec 19, 2025 at 01:05:51PM -0400, Jason Gunthorpe wrote:
> > +static int arm_smmu_get_tag(struct arm_smmu_domain *smmu_domain,
> > + struct arm_smmu_master *master,
> > + struct arm_vsmmu *vsmmu,
> > + struct arm_smmu_iotlb_tag *tag, bool no_alloc)
> [...]
> > + case ARM_SMMU_DOMAIN_S2:
> > + if (smmu_domain->nest_parent) {
> > + /* FIXME we can support attaching a nest_parent without
> > + * a vsmmu, but to do that we need to fix
> > + * arm_smmu_get_id_from_invs() to never return the vmid
> > + * of a vsmmu. Probably by making a
> > + * INV_TYPE_S2_VMID_VSMMU */
> > + id = vsmmu->vmid;
> > + return 0;
> > + }
>
> Would you mind elaborating why arm_smmu_get_id_from_invs() can't
> return vsmmu->vmid to share with a naked S2 STE?
A "naked" S2 domain doesn't have a pointer to the vsmmu, so it is
impossible to get vsmmu->vmid.
The only domains which have it are nested domains using a bypass vSTE.
So, if userspace attaches a bypass vSTE then it should use vsmmu->vmid
However if they attach a raw S2 HWPT without a vSTE then there is no
vsmmu and it should work like any other S2 attach and allocate a VMID
for this domain, ignoring any vSMMU that may exist.
In sort, the only case where we use the vsmmu->vmid is for vSTEs.
Jason
Powered by blists - more mailing lists