Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795018390; b=LLwWQ+Tdl1gPP6e6Sn3WtjgTTOIzsB3wvdiBJ6e0POvNb48D7dTyXNzPs5btVEr3LbiE IF594w9GisTA02QHBUsfjqMiG5T4A3zL/Mx3Ympz5YB7exUTJY4s1vdX4Fd4zCBz5FrQ+ cLpFb2ivr27nvjRMBgx0QcoWBohSTyBpH4UyOUwdB5i6B0dc/txaTuKFzVYSOtopKC+jA oORo58ansvi/tC5yPFz8VfQDOV1jzREV92rzj96qm7JNGuOKJztdJYi+UQmS0VEA0SZ37 +YtKbZ/1auf7RrV3XTlejQXlglTszXMT9tbthaoOJ6JsW9O+UlXDzRpzv2EvUXI04dQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795018390; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EoJA23CXPFsnrwb7TEJPc3mMLQTANlDRCJ354oeu3nQ=; b=EHY5sUTK4idJgvGJJbbfWFxhdeTQmnotj08+zhpA5MWHOYSZrLNsjbwnMIzDxrEgrYki GukT3m9B0qZDOWDC62IbE+J/v6m8VuUTiKA2MKGdGCoQ3ibCRdFYU1WPJ/vGcL0xp0tgS HrhBbmra5BR6T9yTSH86wqzhTGn1hpnq/jwndynTC6E/SgNemfTp0mWlpOT9aUe3zsZur EoaBlPX4PIIOrJ+BZPm0EQ+A9mBhTuoAIEbUzgqJrABdfCTr9DCm0FObU7uMcwzGFJtGH 8D3F/uB5HDgZLORYNPN5Xjn0GQ/LNELFtQZq36wYKdjkXoa0okDzMfvv/EnQepWSdFA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ptvSY+in; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBE4D606A325; Wed, 18 Nov 2026 16:13:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ptvSY+in Received: by smtp.kernel.org (Postfix) with ESMTPSA id 233CC1F000C4; Wed, 18 Nov 2026 16:13:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795018390; bh=EoJA23CXPFsnrwb7TEJPc3mMLQTANlDRCJ354oeu3nQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ptvSY+inAMjGNFiFZijLbH+2OraVDJL0coBSuBbrS9/wfG56WN0S0oMtY0+sVZNOJ UFcqliOflM79pyoM9yH+qkn9/CoAwbP/+F0C1WUOdclGv3Yb8SuRYU+tOfYXh5O99t soyCx2E6NywjIaQ3qd54u1hKNFkfQghfWyIAx+lU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nicolin Chen , Jason Gunthorpe , Mostafa Saleh , Pranjal Shrivastava , Will Deacon , Sasha Levin Subject: [PATCH 7.3 1173/2651] iommu/arm-smmu-v3: Ensure L2 tables are visible before L1 ptrs Date: Wed, 18 Nov 2026 15:40:13 +0100 Message-ID: <20261118150330.241565562@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mostafa Saleh [ Upstream commit 84366fb547ed987c4857311da0e5127d95bf97e6 ] Commit 6fabce53f6b9 ("iommu/arm-smmu-v3: Add a missing dma_wmb() for hitless STE update") adds a dma_wmb() to arm_smmu_write_entry() to make sure stream tables and context descriptors are observed first. However, STE L1 table descriptors are configured directly via WRITE_ONCE(), where before that they were zeroed with memset() inside dma_direct_alloc() then written to abort in via memset() also in arm_smmu_init_initial_stes() without a barrier in both cases which means that the SMMUv3 can observe the allocated table before the written descriptors causing it to fetch random data. Similarly in arm_smmu_write_cd_l1_desc() where the L1 CD is written after dma_alloc_coherent() with no barriers. Add dma_wmb() in both cases. Fixes: 48ec83bcbcf5 ("iommu/arm-smmu: Add initial driver support for ARM SMMUv3 devices") Reported-by: Sashiko <> Reviewed-by: Nicolin Chen Reviewed-by: Jason Gunthorpe Signed-off-by: Mostafa Saleh Reviewed-by: Pranjal Shrivastava Tested-by: Nicolin Chen Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index b510dd47f2315..c6176394fc890 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1515,6 +1515,9 @@ static void arm_smmu_write_cd_l1_desc(struct arm_smmu_cdtab_l1 *dst, { u64 val = (l2ptr_dma & CTXDESC_L1_DESC_L2PTR_MASK) | CTXDESC_L1_DESC_V; + /* Ensure the zero-cleared L2 table is fully visible. */ + dma_wmb(); + /* The HW has 64 bit atomicity with stores to the L2 CD table */ WRITE_ONCE(dst->l2ptr, cpu_to_le64(val)); } @@ -1804,6 +1807,9 @@ static void arm_smmu_write_strtab_l1_desc(struct arm_smmu_strtab_l1 *dst, val |= FIELD_PREP(STRTAB_L1_DESC_SPAN, STRTAB_SPLIT + 1); val |= l2ptr_dma & STRTAB_L1_DESC_L2PTR_MASK; + /* Ensure the new L2 table is fully visible. */ + dma_wmb(); + /* The HW has 64 bit atomicity with stores to the L2 STE table */ WRITE_ONCE(dst->l2ptr, cpu_to_le64(val)); } -- 2.53.0