From: Chintan Pandya Date: Tue, 17 Mar 2015 10:39:19 +0000 (+0530) Subject: iommu: msm: Invalidate properly from iommu_unmap X-Git-Tag: Ubuntu-snapdragon-4.4.0-1076.81~484 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=158c6228eee3f509c6dc405b3888a4fe572fd0e1;p=mirror_ubuntu-zesty-kernel.git iommu: msm: Invalidate properly from iommu_unmap TLB invalidation by VA will work for the given VA and not the range of VA. So, for a region that spreads across multiple PTEs, that need to call TLBIVA multiple times. This is un-optimized. Anyways, the present implementation also support single TLBIVA only for the first VA and rest may be kept in TLB as is. This is a problem. Fix this by upgrading TLBIVA with TLBIASID which will do invalidation for all the VAs for matching ASID. We may still skip fixing this in iommu_map as iommu_map is still indeed mapping one VA at a time. Change-Id: I6c833e62fd47d9c11457ef90cdd322b6f751c698 Signed-off-by: Chintan Pandya --- diff --git a/drivers/iommu/qcom/msm_iommu-v1.c b/drivers/iommu/qcom/msm_iommu-v1.c index 43092d7e9778..a3559314ef83 100644 --- a/drivers/iommu/qcom/msm_iommu-v1.c +++ b/drivers/iommu/qcom/msm_iommu-v1.c @@ -308,6 +308,7 @@ static void __sync_tlb(struct msm_iommu_drvdata *iommu_drvdata, int ctx, check_tlb_sync_state(iommu_drvdata, ctx, priv); } +#ifdef CONFIG_MSM_IOMMU_TLBINVAL_ON_MAP static int __flush_iotlb_va(struct iommu_domain *domain, unsigned int va) { struct msm_iommu_priv *priv = domain->priv; @@ -335,6 +336,7 @@ static int __flush_iotlb_va(struct iommu_domain *domain, unsigned int va) fail: return ret; } +#endif static int __flush_iotlb(struct iommu_domain *domain) { @@ -967,7 +969,7 @@ static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, if (ret < 0) goto fail; - ret = __flush_iotlb_va(domain, va); + ret = __flush_iotlb(domain); msm_iommu_pagetable_free_tables(&priv->pt, va, len); fail: