Re: [PATCH v4 09/13] iommu/arm-smmu-v3: Implement set_dev_pasid
From: Michael Shavit
Date: Thu Jul 13 2023 - 04:46:03 EST
On Wed, Jun 21, 2023 at 2:44 PM Michael Shavit <mshavit@xxxxxxxxxx> wrote:
> + mutex_lock(&arm_smmu_asid_lock);
> + ret = arm_smmu_write_ctx_desc(master->smmu, master->s1_cfg, master,
> + pasid, &smmu_domain->cd);
> + if (ret) {
> + mutex_unlock(&arm_smmu_asid_lock);
> + kfree(attached_domain);
> + }
> +
> + spin_lock_irqsave(&smmu_domain->attached_domains_lock, flags);
> + list_add(&attached_domain->domain_head, &smmu_domain->attached_domains);
> + spin_unlock_irqrestore(&smmu_domain->attached_domains_lock, flags);
> + mutex_unlock(&arm_smmu_asid_lock);
> +
> + return 0;
A small bug in this patch as well: we return 0 when
arm_smmu_write_ctx_desc() fails instead of the error. Will upload fix
in v5.