]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
iommu: msm: Invalidate properly from iommu_unmap
authorChintan Pandya <cpandya@codeaurora.org>
Tue, 17 Mar 2015 10:39:19 +0000 (16:09 +0530)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Sep 2017 16:19:06 +0000 (18:19 +0200)
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 <cpandya@codeaurora.org>
drivers/iommu/qcom/msm_iommu-v1.c

index 43092d7e97782a6f3a2b46827478d1d894ee8939..a3559314ef8354def7b9e3996bf5fc1dee8341e8 100644 (file)
@@ -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: