[1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache

Message ID 1490001484-18890-1-git-send-email-m.szyprowski@samsung.com
State Accepted
Commit 7d2aa6b814476a2e2794960f844344519246df72
Headers show
  • [1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache
Related show

Commit Message

Marek Szyprowski March 20, 2017, 9:17 a.m.
Documentation specifies that SYSMMU should be in blocked state while
performing TLB/FLPD cache invalidation, so add needed calls to

Fixes: 66a7ed84b345d ("iommu/exynos: Apply workaround of caching fault page table entries")
CC: stable@vger.kernel.org # v4.10+
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

This issue has been introduced long time ago, but this fix applies only for
v4.10+ kernels due to other changes in the surrounding code.
 drivers/iommu/exynos-iommu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)



Andrzej Hajda March 20, 2017, 10:31 a.m. | #1
On 20.03.2017 10:17, Marek Szyprowski wrote:
> For some unknown reasons, in some cases, FLPD cache invalidation doesn't

> work properly with SYSMMU v5 controllers found in Exynos5433 SoCs. This

> can be observed by a firmware crash during initialization phase of MFC

> video decoder available in the mentioned SoCs when IOMMU support is

> enabled. To workaround this issue perform a full TLB/FLPD invalidation

> in case of replacing any first level page descriptors in case of SYSMMU v5.

It fixes also crashes of MFC encoder on Exynos5433.

For both patches:
Tested-by: Andrzej Hajda <a.hajda@samsung.com>



diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index a7e0821c9967..32d43f1994e4 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -512,7 +512,10 @@  static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data,
 	spin_lock_irqsave(&data->lock, flags);
 	if (data->active && data->version >= MAKE_MMU_VER(3, 3)) {
-		__sysmmu_tlb_invalidate_entry(data, iova, 1);
+		if (sysmmu_block(data)) {
+			__sysmmu_tlb_invalidate_entry(data, iova, 1);
+			sysmmu_unblock(data);
+		}
 	spin_unlock_irqrestore(&data->lock, flags);