Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2c96377 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

msm: ipa: Only attach to the IOMMU after setting all domain attrs



Attaching an IOMMU domain to an IOMMU device should only be done after
setting all relevant domain attributes on the domain, but we're
currently attaching before setting an important attribute.  Fix this.

Change-Id: Ife8ec2090060d99334d97e39b5cb1ea67d8b59bf
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 8ca03863
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -3921,22 +3921,22 @@ static int ipa_smmu_uc_cb_probe(struct device *dev)
		return -EPROBE_DEFER;
	}

	ret = arm_iommu_attach_device(cb->dev, cb->mapping);
	if (ret) {
		IPAERR("could not attach device ret=%d\n", ret);
		return ret;
	}

	if (smmu_disable_htw) {
		if (iommu_domain_set_attr(cb->mapping->domain,
				DOMAIN_ATTR_COHERENT_HTW_DISABLE,
				 &disable_htw)) {
			IPAERR("couldn't disable coherent HTW\n");
			arm_iommu_detach_device(cb->dev);
			return -EIO;
		}
	}


	ret = arm_iommu_attach_device(cb->dev, cb->mapping);
	if (ret) {
		IPAERR("could not attach device ret=%d\n", ret);
		return ret;
	}

	cb->valid = true;
	cb->next_addr = IPA_SMMU_UC_VA_END;
	ipa_ctx->uc_pdev = dev;
+7 −7
Original line number Diff line number Diff line
@@ -4032,22 +4032,22 @@ static int ipa_smmu_uc_cb_probe(struct device *dev)
		return -EPROBE_DEFER;
	}

	ret = ipa3_arm_iommu_attach_device(cb->dev, cb->mapping);
	if (ret) {
		IPAERR("could not attach device ret=%d\n", ret);
		return ret;
	}

	if (smmu_disable_htw) {
		if (iommu_domain_set_attr(cb->mapping->domain,
				DOMAIN_ATTR_COHERENT_HTW_DISABLE,
				 &disable_htw)) {
			IPAERR("couldn't disable coherent HTW\n");
			ipa3_arm_iommu_detach_device(cb->dev);
			return -EIO;
		}
	}


	ret = ipa3_arm_iommu_attach_device(cb->dev, cb->mapping);
	if (ret) {
		IPAERR("could not attach device ret=%d\n", ret);
		return ret;
	}

	cb->valid = true;
	cb->next_addr = IPA_SMMU_UC_VA_END;
	ipa3_ctx->uc_pdev = dev;