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

Commit 8e4c3bdc authored by Charan Teja Reddy's avatar Charan Teja Reddy
Browse files

iommu/arm-smmu: update tlb ops for slave side secure targets



Use proper TLB ops for slave side secure targets where tlb
operations are not required on secure context bank.

Change-Id: I93366ad7e9fb321c339847b84da35864c0f24806
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
parent e3d045af
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -1366,6 +1366,28 @@ static struct iommu_gather_ops arm_smmu_gather_ops = {
	.free_pages_exact = arm_smmu_free_pages_exact,
};

static void msm_smmu_tlb_inv_context(void *cookie)
{
}

static void msm_smmu_tlb_inv_range_nosync(unsigned long iova, size_t size,
					  size_t granule, bool leaf,
					  void *cookie)
{
}

static void msm_smmu_tlb_sync(void *cookie)
{
}

static struct iommu_gather_ops msm_smmu_gather_ops = {
	.tlb_flush_all	= msm_smmu_tlb_inv_context,
	.tlb_add_flush	= msm_smmu_tlb_inv_range_nosync,
	.tlb_sync	= msm_smmu_tlb_sync,
	.alloc_pages_exact = arm_smmu_alloc_pages_exact,
	.free_pages_exact = arm_smmu_free_pages_exact,
};

static phys_addr_t arm_smmu_verify_fault(struct iommu_domain *domain,
					 dma_addr_t iova, u32 fsr)
{
@@ -1887,6 +1909,9 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
	if (smmu->options & ARM_SMMU_OPT_MMU500_ERRATA1)
		tlb = &qsmmuv500_errata1_smmu_gather_ops;

	if (arm_smmu_is_slave_side_secure(smmu_domain))
		tlb = &msm_smmu_gather_ops;

	ret = arm_smmu_alloc_cb(domain, smmu, dev);
	if (ret < 0)
		goto out_unlock;
@@ -1907,6 +1932,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
				.sec_id = smmu->sec_id,
				.cbndx = cfg->cbndx,
			},
			.tlb		= tlb,
			.iommu_dev      = smmu->dev,
		};
		fmt = ARM_MSM_SECURE;
@@ -2277,8 +2303,6 @@ static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain,
	const struct iommu_gather_ops *tlb;

	tlb = smmu_domain->pgtbl_cfg.tlb;
	if (!tlb)
		return;

	mutex_lock(&smmu->stream_map_mutex);
	for_each_cfg_sme(fwspec, i, idx) {