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

Commit 22bf07b2 authored by Prakash Gupta's avatar Prakash Gupta
Browse files

Revert "iommu/io-pgtable-arm: Convert to IOMMU API TLB sync"



This reverts commit 57f59f37.

Change-Id: I3896c8c9cbd666fe8617a5627e29efa873eac26d
Signed-off-by: default avatarPrakash Gupta <guptap@codeaurora.org>
parent cf4e7e64
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -1759,14 +1759,6 @@ arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
	return ops->unmap(ops, iova, size);
}

static void arm_smmu_iotlb_sync(struct iommu_domain *domain)
{
	struct arm_smmu_device *smmu = to_smmu_domain(domain)->smmu;

	if (smmu)
		__arm_smmu_tlb_sync(smmu);
}

static phys_addr_t
arm_smmu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova)
{
@@ -1987,8 +1979,6 @@ static struct iommu_ops arm_smmu_ops = {
	.map			= arm_smmu_map,
	.unmap			= arm_smmu_unmap,
	.map_sg			= default_iommu_map_sg,
	.flush_iotlb_all	= arm_smmu_iotlb_sync,
	.iotlb_sync		= arm_smmu_iotlb_sync,
	.iova_to_phys		= arm_smmu_iova_to_phys,
	.add_device		= arm_smmu_add_device,
	.remove_device		= arm_smmu_remove_device,
+8 −17
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ struct arm_smmu_domain {
	struct arm_smmu_device		*smmu;
	struct device			*dev;
	struct io_pgtable_ops		*pgtbl_ops;
	const struct iommu_gather_ops	*tlb_ops;

	struct arm_smmu_cfg		cfg;
	enum arm_smmu_domain_stage	stage;
	struct mutex			init_mutex; /* Protects smmu pointer */
@@ -1998,6 +1998,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
	enum io_pgtable_fmt fmt;
	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
	struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
	const struct iommu_gather_ops *tlb_ops;
	bool is_fast = smmu_domain->attributes & (1 << DOMAIN_ATTR_FAST);
	unsigned long quirks = 0;
	bool dynamic;
@@ -2089,7 +2090,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
			ias = min(ias, 32UL);
			oas = min(oas, 32UL);
		}
		smmu_domain->tlb_ops = &arm_smmu_s1_tlb_ops;
		tlb_ops = &arm_smmu_s1_tlb_ops;
		break;
	case ARM_SMMU_DOMAIN_NESTED:
		/*
@@ -2109,9 +2110,9 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
			oas = min(oas, 40UL);
		}
		if (smmu->version == ARM_SMMU_V2)
			smmu_domain->tlb_ops = &arm_smmu_s2_tlb_ops_v2;
			tlb_ops = &arm_smmu_s2_tlb_ops_v2;
		else
			smmu_domain->tlb_ops = &arm_smmu_s2_tlb_ops_v1;
			tlb_ops = &arm_smmu_s2_tlb_ops_v1;
		break;
	default:
		ret = -EINVAL;
@@ -2133,7 +2134,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
		quirks |= IO_PGTABLE_QUIRK_QSMMUV500_NON_SHAREABLE;

	if (arm_smmu_is_slave_side_secure(smmu_domain))
		smmu_domain->tlb_ops = &msm_smmu_gather_ops;
		tlb_ops = &msm_smmu_gather_ops;

	ret = arm_smmu_alloc_cb(domain, smmu, dev);
	if (ret < 0)
@@ -2149,7 +2150,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
				.sec_id = smmu->sec_id,
				.cbndx = cfg->cbndx,
			},
			.tlb		= smmu_domain->tlb_ops,
			.tlb		= tlb_ops,
			.iommu_dev      = smmu->dev,
		};
		fmt = ARM_MSM_SECURE;
@@ -2159,7 +2160,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
			.pgsize_bitmap	= smmu->pgsize_bitmap,
			.ias		= ias,
			.oas		= oas,
			.tlb		= smmu_domain->tlb_ops,
			.tlb		= tlb_ops,
			.iommu_dev	= smmu->dev,
		};
	}
@@ -3114,14 +3115,6 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
	return ret;
}

static void arm_smmu_iotlb_sync(struct iommu_domain *domain)
{
	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);

	if (smmu_domain->tlb_ops)
		smmu_domain->tlb_ops->tlb_sync(smmu_domain);
}

/*
 * This function can sleep, and cannot be called from atomic context. Will
 * power on register block if required. This restriction does not apply to the
@@ -3933,8 +3926,6 @@ static struct iommu_ops arm_smmu_ops = {
	.map			= arm_smmu_map,
	.unmap			= arm_smmu_unmap,
	.map_sg			= arm_smmu_map_sg,
	.flush_iotlb_all	= arm_smmu_iotlb_sync,
	.iotlb_sync		= arm_smmu_iotlb_sync,
	.iova_to_phys		= arm_smmu_iova_to_phys,
	.iova_to_phys_hard	= arm_smmu_iova_to_phys_hard,
	.add_device		= arm_smmu_add_device,
+0 −10
Original line number Diff line number Diff line
@@ -621,14 +621,6 @@ static size_t ipmmu_unmap(struct iommu_domain *io_domain, unsigned long iova,
	return domain->iop->unmap(domain->iop, iova, size);
}

static void ipmmu_iotlb_sync(struct iommu_domain *io_domain)
{
	struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);

	if (domain->mmu)
		ipmmu_tlb_flush_all(domain);
}

static phys_addr_t ipmmu_iova_to_phys(struct iommu_domain *io_domain,
				      dma_addr_t iova)
{
@@ -886,8 +878,6 @@ static const struct iommu_ops ipmmu_ops = {
	.detach_dev = ipmmu_detach_device,
	.map = ipmmu_map,
	.unmap = ipmmu_unmap,
	.flush_iotlb_all = ipmmu_iotlb_sync,
	.iotlb_sync = ipmmu_iotlb_sync,
	.map_sg = default_iommu_map_sg,
	.iova_to_phys = ipmmu_iova_to_phys,
	.add_device = ipmmu_add_device_dma,