@@ -2564,13 +2564,9 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
mutex_lock(&smmu_domain->init_mutex);
- if (!smmu_domain->smmu) {
- smmu_domain->smmu = smmu;
- ret = arm_smmu_domain_finalise(domain, smmu);
- if (ret)
- smmu_domain->smmu = NULL;
- } else if (smmu_domain->smmu != smmu ||
- !arm_smmu_verify_domain_compatible(smmu, smmu_domain))
+ if (!smmu_domain->pgtbl_ops)
+ ret = arm_smmu_domain_finalise(&smmu_domain->domain, smmu);
+ else if (!arm_smmu_verify_domain_compatible(smmu, smmu_domain))
ret = -EINVAL;
mutex_unlock(&smmu_domain->init_mutex);
@@ -716,8 +716,7 @@ enum arm_smmu_domain_stage {
};
struct arm_smmu_domain {
- struct arm_smmu_device *smmu;
- struct mutex init_mutex; /* Protects smmu pointer */
+ struct mutex init_mutex; /* Protects pgtbl_ops pointer */
struct io_pgtable_ops *pgtbl_ops;
atomic_t nr_ats_masters;
Remove the arm_smmu_domain->smmu handle now that a domain may be attached to devices with different upstream SMMUs. Signed-off-by: Michael Shavit <mshavit@google.com> --- (no changes since v1) drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 10 +++------- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +-- 2 files changed, 4 insertions(+), 9 deletions(-)