mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Young-Jun Hong <nirvanah@nirvanahyj.com>
To: "Joerg Roedel (AMD)" <joro@8bytes.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>
Cc: Shigeaki Asai <y-asai.0816@docomonet.jp>,
	linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2] iommu/io-pgtable-arm: Use inner-shareable PTEs for non-coherent Mali
Date: Sat,  5 Dec 2026 23:18:35 +0900	[thread overview]
Message-ID: <20261205141838.2492928-1-nirvanah@nirvanahyj.com> (raw)
In-Reply-To: <20261106054210.2893230-2-nirvanah@nirvanahyj.com>

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@docomonet.jp>
Signed-off-by: Young-Jun Hong <nirvanah@nirvanahyj.com>
---
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@nirvanahyj.com/

 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


  parent reply	other threads:[~2026-12-05 14:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  5:41 [PATCH 0/4] Exynos 5422: Mali-T628 GPU compute fixes Young-Jun Hong
2026-11-06  5:41 ` [PATCH 1/4] iommu/io-pgtable-arm: use inner shareable for Mali LPAE on a non-coherent GPU Young-Jun Hong
2026-11-29 10:48   ` Shigeaki Asai
2026-12-05 14:18   ` Young-Jun Hong [this message]
2026-11-06  5:41 ` [PATCH 2/4] clk: samsung: exynos5420: add VPLL rates for 650, 700 and 750 MHz Young-Jun Hong
2026-11-06 14:45   ` Henrik Grimler
2026-11-06  5:41 ` [PATCH 3/4] drm/panfrost: only put powered shader cores in the job affinity Young-Jun Hong
2026-11-06  5:41 ` [PATCH 4/4] drm/panfrost: let jobs opt in to all core groups Young-Jun Hong
     [not found] ` <20261106054210.2893230-4-nirvanah@nirvanahyj.com_quarantine>
2026-11-23 15:37   ` [PATCH 3/4] drm/panfrost: only put powered shader cores in the job affinity Steven Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205141838.2492928-1-nirvanah@nirvanahyj.com \
    --to=nirvanah@nirvanahyj.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=y-asai.0816@docomonet.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®