From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=139.150.92.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796480328; b=mcrvjgxQQK3XMENePxxdJEDXcAI5huQwiDUP7t0xxAlkgXZJkyRrcAT3diiFeuSnt9Zq ydOvL4oBo6nHEATvaD5X6tU9IAx7jTc3YXGcYxud4e+Hj05btCc08es9S59+3ZnFmt509 erY3Ygvbi3yVvY0vMifqea9f0DT2yoJks04LKbqzIsHrp1iMYqEJ3bivibjv4pdw9In1M NOM5cMXxdskcfenob4SMivniUH5FtbFiZD7vy0cKhYtlhzs37gXGRzIHgP1eH0eoo2Gka SuaRnaoYnc7vBdQ7k7fj3ueTm00fdr2uQmRQgZzuJIQL2Qugbtd6WisPKj/didvtZMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796480328; h=DMARC-Filter:Received:Received:Received:X-Authinfo: X-Hiworks-Remote-IP:X-Hiworks-User:X-MailFrom-INFO:Received:From:To: Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=q83Q+D7dSbv9rAkg1dqEbx/uAfyV5OKynVzVlliveEQ=; b=bQDs+jgsgSD5rLILenK1i2OEJ3tD/uyiQCSTCNP/olEd5PNQnh4kRo/hrGlpcbmLuRf+ DfhbHrrXWQ8ezbeHluNpNGbWTDlLy4g36ut0jA179WtKnLkbDg6FRkfvr3EcEi3ISI3ov D5lDJM2+vw6tWWX3hPdlWEsi99HXHdv4sx0eQSW+E7t62H3V3VlzsIQKHxIdI+kRsaEGG M8x8xOl2TpGRd4JCdwP0p5AO8ien/5Dz7I5bF6VR7qJ/yJaJAhlEZG551TuqKcbU0FSQq PSfOlnRCBTJtYhR2ugYDSX3gZNpKz6W0GR3WPK87aQ+mlz729QVZW43Y7gLVpTrmqkw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=nirvanahyj.com; spf=pass smtp.mailfrom=nirvanahyj.com; arc=none smtp.remote-ip=139.150.92.44 Received: from smtp92-44.hiworks.co.kr (smtp92-44.hiworks.co.kr [139.150.92.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 867A2606A322 for ; Sat, 5 Dec 2026 14:18:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 867A2606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nirvanahyj.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nirvanahyj.com Received: from hi-smtp-node2 (unknown [172.18.0.3]) by smtp92-44.hiworks.co.kr (Postfix) with ESMTPS id 4jhVpS33MJz3wt1b for ; Sat, 5 Dec 2026 23:18:40 +0900 (KST) Received: from hi-smtp-node2 (unknown [192.168.71.87]) by hi-smtp-node2 (Postfix) with ESMTP id 4jhVpS2bM4zQLN75 for ; Sat, 5 Dec 2026 23:18:40 +0900 (KST) Received: from hi-total-node4 (amphora-3294b420-308a-4b9e-8a1d-bf25580dae1f.openstack.gabia.io) by hi-smtp-node2 with ESMTP id 66srfl3jpbpkg5zx; Sat, 05 Dec 2026 23:18:40 +0900 (KST) X-Authinfo: HIWORKS SMTP authenticated X-Hiworks-Remote-IP: 114.203.237.180 X-Hiworks-User: (SASL_USER) nirvanah@nirvanahyj.com X-MailFrom-INFO: Received: from localhost.localdomain (unknown [114.203.237.180]) (Authenticated sender: nirvanah@nirvanahyj.com) by hi-total-node4 (Postfix) with ESMTPSA id 4jhVpR1t99zSq5kC; Sat, 5 Dec 2026 23:18:39 +0900 (KST) From: Young-Jun Hong To: "Joerg Roedel (AMD)" , Robin Murphy , Will Deacon Cc: Shigeaki Asai , 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 Message-ID: <20261205141838.2492928-1-nirvanah@nirvanahyj.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261106054210.2893230-2-nirvanah@nirvanahyj.com> References: <20261106054210.2893230-2-nirvanah@nirvanahyj.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Young-Jun Hong --- 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