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

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

Revert "arm64: mm: dma-mapping: Modify handling for S1 bypass initialization"



This reverts commit 099ee7c6.
This should be reverted, as it does not account for setting up
the DMA ops correctly for users of the legacy ARM IOMMU
interfaces.

Change-Id: Ica0c3efd4a4db36d3f8922d801ed3dad161ab716
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent cd8ac3aa
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -1056,14 +1056,18 @@ iommu_init_mapping(struct device *dev, struct dma_iommu_mapping *mapping)
static int arm_iommu_get_dma_cookie(struct device *dev,
				    struct dma_iommu_mapping *mapping)
{
	int is_fast = 0;
	int s1_bypass = 0, is_fast = 0;
	int err = 0;

	mutex_lock(&iommu_dma_init_mutex);

	iommu_domain_get_attr(mapping->domain, DOMAIN_ATTR_S1_BYPASS,
					&s1_bypass);
	iommu_domain_get_attr(mapping->domain, DOMAIN_ATTR_FAST, &is_fast);

	if (is_fast)
	if (s1_bypass)
		mapping->ops = &arm64_swiotlb_dma_ops;
	else if (is_fast)
		err = fast_smmu_init_mapping(dev, mapping);
	else
		err = iommu_init_mapping(dev, mapping);
@@ -1117,22 +1121,17 @@ static void arm_iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size)
	struct iommu_domain *domain;
	struct iommu_group *group;
	struct dma_iommu_mapping mapping = {0};
	int s1_bypass;

	group = dev->iommu_group;
	if (!group)
		return;

	arm_iommu_get_dma_window(dev, &dma_base, &size);

	domain = iommu_get_domain_for_dev(dev);
	if (!domain)
		return;

	iommu_domain_get_attr(domain, DOMAIN_ATTR_S1_BYPASS, &s1_bypass);
	if (s1_bypass)
		return;

	arm_iommu_get_dma_window(dev, &dma_base, &size);

	/* Allow iommu-debug to call arch_setup_dma_ops to reconfigure itself */
	if (domain->type != IOMMU_DOMAIN_DMA &&
	    !of_device_is_compatible(dev->of_node, "iommu-debug-test")) {