From 6ba8d4547e6e804fca9c88340b9b40413e189e89 Mon Sep 17 00:00:00 2001 From: Pavel Golikov Date: Fri, 24 Jun 2022 15:54:16 +0000 Subject: [PATCH] WIP: iommu/io-pgtable-arm: Fix coherency support for Mali LPAE Mali T628r0p1 which may be found in Samsung Exynos 5422 SOC is definitely not dma coherent, and it is not happy with PTE_SH_OS bit set by default in commit 728da60da7c1 ("iommu/io-pgtable-arm: Support coherency for Mali LPAE"). Use PTE_SH_IS by default for non dma coherent Mali GPUs. Signed-off-by: Pavel Golikov --- drivers/iommu/io-pgtable-arm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index 72dcdd468cf3..244ec6bb1d9f 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -444,9 +444,10 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data, * "outside the GPU" (i.e. either the Inner or System domain in CPU * terms, depending on coherency). */ - if (prot & IOMMU_CACHE && data->iop.fmt != ARM_MALI_LPAE) + if (prot & IOMMU_CACHE || + (data->iop.fmt == ARM_MALI_LPAE && !data->iop.cfg.coherent_walk)) pte |= ARM_LPAE_PTE_SH_IS; - else + else if (data->iop.fmt == ARM_MALI_LPAE) pte |= ARM_LPAE_PTE_SH_OS; if (prot & IOMMU_NOEXEC)