[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250305170157.GB133783@nvidia.com>
Date: Wed, 5 Mar 2025 13:01:57 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: 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 Tue, Mar 04, 2025 at 09:04:02PM -0800, Nicolin Chen wrote:
> @@ -2249,10 +2249,22 @@ static void arm_smmu_tlb_inv_context(void *cookie)
> */
> if (smmu_domain->stage == ARM_SMMU_DOMAIN_S1) {
> arm_smmu_tlb_inv_asid(smmu, smmu_domain->cd.asid);
> - } else {
> + } else if (!smmu_domain->nest_parent) {
> cmd.opcode = CMDQ_OP_TLBI_S12_VMALL;
> cmd.tlbi.vmid = smmu_domain->s2_cfg.vmid;
> arm_smmu_cmdq_issue_cmd_with_sync(smmu, &cmd);
> + } else {
> + struct arm_vsmmu *vsmmu, *next;
> + unsigned long flags;
> +
> + cmd.opcode = CMDQ_OP_TLBI_S12_VMALL;
> + spin_lock_irqsave(&smmu_domain->vsmmus.lock, flags);
> + list_for_each_entry_safe(vsmmu, next, &smmu_domain->vsmmus.list,
> + vsmmus_elm) {
> + cmd.tlbi.vmid = vsmmu->vmid;
> + arm_smmu_cmdq_issue_cmd_with_sync(smmu, &cmd);
> + }
> + spin_unlock_irqrestore(&smmu_domain->vsmmus.lock, flags);
> }
I see.. So this just makes a 3rd classification of invalidation
protocol that uses a spinlock and linked list
> arm_smmu_atc_inv_domain(smmu_domain, 0, 0);
This is no good, arm_smmu_atc_inv_domain() is invalidating against the
instance that created the domain.
IMHO if you do this you should set domain->iommu = NULL to indicate
that the iommu is non-valid in this mode to catch issues.
Jason
Powered by blists - more mailing lists