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

Commit 57f10390 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

iommu/arm-smmu: Move arm_iommu_put_cookie() to the SMMU driver



The SMMU driver is the only user of the arm_iommu_put_cookie(),
thus move it to the SMMU driver.

Change-Id: I92d37bcbe3cdfa92349811a1fae90645ad026230
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 099ee7c6
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -1072,20 +1072,6 @@ static int arm_iommu_get_dma_cookie(struct device *dev,
	return err;
}

void arm_iommu_put_dma_cookie(struct iommu_domain *domain)
{
	int s1_bypass = 0, is_fast = 0;

	iommu_domain_get_attr(domain, DOMAIN_ATTR_S1_BYPASS,
					&s1_bypass);
	iommu_domain_get_attr(domain, DOMAIN_ATTR_FAST, &is_fast);

	if (is_fast)
		fast_smmu_put_dma_cookie(domain);
	else if (!s1_bypass)
		iommu_put_dma_cookie(domain);
}

/*
 * Checks for "qcom,iommu-dma-addr-pool" property.
 * If not present, leaves dma_addr and dma_size unmodified.
+15 −1
Original line number Diff line number Diff line
@@ -2252,6 +2252,20 @@ static struct iommu_domain *arm_smmu_domain_alloc(unsigned type)
	return &smmu_domain->domain;
}

static void arm_smmu_put_dma_cookie(struct iommu_domain *domain)
{
	int s1_bypass = 0, is_fast = 0;

	iommu_domain_get_attr(domain, DOMAIN_ATTR_S1_BYPASS,
					&s1_bypass);
	iommu_domain_get_attr(domain, DOMAIN_ATTR_FAST, &is_fast);

	if (is_fast)
		fast_smmu_put_dma_cookie(domain);
	else if (!s1_bypass)
		iommu_put_dma_cookie(domain);
}

static void arm_smmu_domain_free(struct iommu_domain *domain)
{
	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
@@ -2260,7 +2274,7 @@ static void arm_smmu_domain_free(struct iommu_domain *domain)
	 * Free the domain resources. We assume that all devices have
	 * already been detached.
	 */
	arm_iommu_put_dma_cookie(domain);
	arm_smmu_put_dma_cookie(domain);
	arm_smmu_destroy_domain_context(domain);
	kfree(smmu_domain);
}