iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache
       [not found] <CGME20170320091820eucas1p22b62f2d7e089cd997aecc62a4c5b7730@eucas1p2.samsung.com>
@ 2017-03-20  9:17 ` Marek Szyprowski
       [not found]   ` <CGME20170320091825eucas1p19e9ee18390287c275c9406144e88eef8@eucas1p1.samsung.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Szyprowski @ 2017-03-20  9:17 UTC (permalink / raw)
  To: iommu, linux-samsung-soc
  Cc: Marek Szyprowski, Joerg Roedel, Krzysztof Kozlowski,
	Andrzej Hajda, Bartlomiej Zolnierkiewicz, stable

Documentation specifies that SYSMMU should be in blocked state while
performing TLB/FLPD cache invalidation, so add needed calls to
sysmmu_block/unblock.

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(-)

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)) {
 		clk_enable(data->clk_master);
-		__sysmmu_tlb_invalidate_entry(data, iova, 1);
+		if (sysmmu_block(data)) {
+			__sysmmu_tlb_invalidate_entry(data, iova, 1);
+			sysmmu_unblock(data);
+		}
 		clk_disable(data->clk_master);
 	}
 	spin_unlock_irqrestore(&data->lock, flags);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] iommu/exynos: Workaround FLPD cache flush issues for SYSMMU v5
       [not found]     ` <1490001484-18890-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2017-03-20  9:17       ` Marek Szyprowski
       [not found]         ` <1490001484-18890-2-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  2017-03-22 14:51       ` [PATCH 1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache Joerg Roedel
  1 sibling, 1 reply; 4+ messages in thread
From: Marek Szyprowski @ 2017-03-20  9:17 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA
  Cc: Bartlomiej Zolnierkiewicz, stable-u79uwXL29TY76Z2rM5mHXA,
	Andrzej Hajda, Krzysztof Kozlowski

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.

Fixes: 740a01eee9ada ("iommu/exynos: Add support for v5 SYSMMU")
CC: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org # v4.10+
Signed-off-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
The mentioned commit has been merged to v4.6, 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(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 32d43f1994e4..c01bfcdb2383 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -513,7 +513,10 @@ static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data,
 	if (data->active && data->version >= MAKE_MMU_VER(3, 3)) {
 		clk_enable(data->clk_master);
 		if (sysmmu_block(data)) {
-			__sysmmu_tlb_invalidate_entry(data, iova, 1);
+			if (data->version >= MAKE_MMU_VER(5, 0))
+				__sysmmu_tlb_invalidate(data);
+			else
+				__sysmmu_tlb_invalidate_entry(data, iova, 1);
 			sysmmu_unblock(data);
 		}
 		clk_disable(data->clk_master);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] iommu/exynos: Workaround FLPD cache flush issues for SYSMMU v5
       [not found]         ` <1490001484-18890-2-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
@ 2017-03-20 10:31           ` Andrzej Hajda
  0 siblings, 0 replies; 4+ messages in thread
From: Andrzej Hajda @ 2017-03-20 10:31 UTC (permalink / raw)
  To: Marek Szyprowski,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA
  Cc: stable-u79uwXL29TY76Z2rM5mHXA, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz

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-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Regards
Andrzej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache
       [not found]     ` <1490001484-18890-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
  2017-03-20  9:17       ` [PATCH 2/2] iommu/exynos: Workaround FLPD cache flush issues for SYSMMU v5 Marek Szyprowski
@ 2017-03-22 14:51       ` Joerg Roedel
  1 sibling, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2017-03-22 14:51 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	Bartlomiej Zolnierkiewicz, stable-u79uwXL29TY76Z2rM5mHXA,
	Andrzej Hajda, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Krzysztof Kozlowski

On Mon, Mar 20, 2017 at 10:17:56AM +0100, Marek Szyprowski wrote:
> Documentation specifies that SYSMMU should be in blocked state while
> performing TLB/FLPD cache invalidation, so add needed calls to
> sysmmu_block/unblock.
> 
> Fixes: 66a7ed84b345d ("iommu/exynos: Apply workaround of caching fault page table entries")
> CC: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org # v4.10+
> Signed-off-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
> 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(-)

Applied both patches to iommu/fixes, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-22 14:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20170320091820eucas1p22b62f2d7e089cd997aecc62a4c5b7730@eucas1p2.samsung.com>
2017-03-20  9:17 ` [PATCH 1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache Marek Szyprowski
     [not found]   ` <CGME20170320091825eucas1p19e9ee18390287c275c9406144e88eef8@eucas1p1.samsung.com>
     [not found]     ` <1490001484-18890-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-03-20  9:17       ` [PATCH 2/2] iommu/exynos: Workaround FLPD cache flush issues for SYSMMU v5 Marek Szyprowski
     [not found]         ` <1490001484-18890-2-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-03-20 10:31           ` Andrzej Hajda
2017-03-22 14:51       ` [PATCH 1/2] iommu/exynos: Block SYSMMU while invalidating FLPD cache Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).