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

Commit 70409712 authored by Neeti Desai's avatar Neeti Desai
Browse files

iommu: msm: Do not invalidate the TLB during iommu map



Due to a hardware bug the TLB has to be invalidated
during map and map_range operations. Newer targets
no longer see this issue. Add config option
to invalidate the TLB only for older targets.

Change-Id: I5bbe84e9dde23bcf960cf5409eed41c6cea41c16
Signed-off-by: default avatarNeeti Desai <neetid@codeaurora.org>
parent 66d69d78
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -137,6 +137,17 @@ config IOMMU_FORCE_4K_MAPPINGS

         If unsure, say N here.

config MSM_IOMMU_TLBINVAL_ON_MAP
	bool "Invalidates the SMMU TLB on map"
	depends on MSM_IOMMU
	help
	 Say Y here if you want to invalidate the SMMU TLB during map
	 operations. This feature needs to be enabled only on older
	 targets which have a hardware bug and need the TLB to be
	 invalidated on all map and map range calls.

	 If unsure, say Y here.

# AMD IOMMU support
config AMD_IOMMU
	bool "AMD IOMMU support"
+6 −0
Original line number Diff line number Diff line
@@ -971,7 +971,10 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long va,
	if (ret)
		goto fail;

#ifdef CONFIG_MSM_IOMMU_TLBINVAL_ON_MAP
	ret = __flush_iotlb_va(domain, va);
#endif

fail:
	mutex_unlock(&msm_iommu_lock);
	return ret;
@@ -1023,7 +1026,10 @@ static int msm_iommu_map_range(struct iommu_domain *domain, unsigned int va,
	if (ret)
		goto fail;

#ifdef CONFIG_MSM_IOMMU_TLBINVAL_ON_MAP
	__flush_iotlb(domain);
#endif

fail:
	mutex_unlock(&msm_iommu_lock);
	return ret;
+8 −0
Original line number Diff line number Diff line
@@ -467,7 +467,11 @@ static int msm_iommu_sec_ptbl_map(struct msm_iommu_drvdata *iommu_drvdata,
	map.info.ctx_id = ctx_drvdata->num;
	map.info.va = va;
	map.info.size = len;
#ifdef CONFIG_MSM_IOMMU_TLBINVAL_ON_MAP
	map.flags = IOMMU_TLBINVAL_FLAG;
#else
	map.flags = 0;
#endif
	flush_va = &pa;
	flush_pa = virt_to_phys(&pa);

@@ -517,7 +521,11 @@ static int msm_iommu_sec_ptbl_map_range(struct msm_iommu_drvdata *iommu_drvdata,
	map.info.ctx_id = ctx_drvdata->num;
	map.info.va = va;
	map.info.size = len;
#ifdef CONFIG_MSM_IOMMU_TLBINVAL_ON_MAP
	map.flags = IOMMU_TLBINVAL_FLAG;
#else
	map.flags = 0;
#endif

	if (sg->length == len) {
		pa = get_phys_addr(sg);