msm: iommu: Clean newly-allocated page tables
If L2 redirection is disabled, clean page tables upon
allocation to prevent hardware table walks into unmapped
areas from accessing stale data.
Change-Id: If1e70bfa52f86d9ddc5a001a699050667b075631
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
diff --git a/arch/arm/mach-msm/iommu.c b/arch/arm/mach-msm/iommu.c
index 0652f3b..d099e59 100644
--- a/arch/arm/mach-msm/iommu.c
+++ b/arch/arm/mach-msm/iommu.c
@@ -292,6 +292,10 @@
memset(priv->pgtable, 0, SZ_16K);
domain->priv = priv;
+
+ if (!priv->redirect)
+ clean_pte(priv->pgtable, priv->pgtable + NUM_FL_PTE);
+
return 0;
fail_nomem:
@@ -548,6 +552,8 @@
goto fail;
}
memset(sl, 0, SZ_4K);
+ if (!priv->redirect)
+ clean_pte(sl, sl + NUM_SL_PTE);
*fl_pte = ((((int)__pa(sl)) & FL_BASE_MASK) | \
FL_TYPE_TABLE);
@@ -773,6 +779,9 @@
}
memset(sl_table, 0, SZ_4K);
+ if (!priv->redirect)
+ clean_pte(sl_table, sl_table + NUM_SL_PTE);
+
*fl_pte = ((((int)__pa(sl_table)) & FL_BASE_MASK) |
FL_TYPE_TABLE);
if (!priv->redirect)