[PATCH v2] iommu/io-pgtable-arm: Use inner-shareable PTEs for non-coherent Mali
From: Young-Jun Hong
Date: Sat Dec 05 2026 - 09:18:52 EST
ARM Mali systems originally used inner-shareable PTEs when the
ARM_MALI_LPAE format was introduced.
Commit 7618e4790982 ("iommu/io-pgtable-arm: Improve attribute handling")
changed non-cached mappings from inner-shareable to outer-shareable.
Because panfrost did not request IOMMU_CACHE, this changed
non-coherent Mali systems as well.
Commit 728da60da7c1 ("iommu/io-pgtable-arm: Support coherency for Mali
LPAE") later made Mali mappings outer-shareable regardless of
IOMMU_CACHE and documented Mali-specific shareability semantics.
On Exynos5422 with Mali-T628 (COHERENCY_NONE), outer-shareable PTEs
cause reproducible system hangs under GPU memory pressure. In testing
on a 6.12.55-based kernel, systems using outer-shareable PTEs failed
in 22 out of 22 runs, while inner-shareable PTEs completed 3 out of 3
runs under the same workload. This patch has been applied to v7.4-rc5
and passes checkpatch and a W=1 build without warnings.
The vendor kbase driver (r16p0) used on this SoC allocates
outer-shareable memory only on CPU-coherent configurations.
Restore inner-shareable PTEs only for ARM_MALI_LPAE configurations
that do not use coherent page-table walks. Configurations with
coherent_walk enabled remain unchanged.
The code and this changelog were generated with Claude Code (Anthropic),
a coding assistant; I designed the experiments, reviewed the generated
changes, and verified the results on hardware.
Fixes: 7618e4790982 ("iommu/io-pgtable-arm: Improve attribute handling")
Tested-by: Shigeaki Asai <y-asai.0816@xxxxxxxxxxxx>
Signed-off-by: Young-Jun Hong <nirvanah@xxxxxxxxxxxxxx>
---
v2:
- dropped the claim about atomics, which was not supported by later
measurements
- reworded the rationale around the documented Mali shareability model
- limited the justification to measured behaviour and vendor practice
- dropped Cc: stable
- updated the coding-assistants disclosure
v1: https://lore.kernel.org/r/20261106054210.2893230-2-nirvanah@xxxxxxxxxxxxxx/
drivers/iommu/io-pgtable-arm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index 476c0e25631a..5fd2c3080b22 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -565,6 +565,12 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
*/
if (prot & IOMMU_CACHE && data->iop.fmt != ARM_MALI_LPAE)
pte |= ARM_LPAE_PTE_SH_IS;
+ else if (data->iop.fmt == ARM_MALI_LPAE && !data->iop.cfg.coherent_walk)
+ /*
+ * Non-coherent Mali systems use inner-shareable PTEs.
+ * Outer-shareable PTEs hang Exynos5422 under GPU load.
+ */
+ pte |= ARM_LPAE_PTE_SH_IS;
else
pte |= ARM_LPAE_PTE_SH_OS;
--
2.47.3