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=1795047225; b=nOIT1/XTHBF/MSrbKwTSUnDXoZD4NF9ixSYE2EnMbPQcvahl/kNTIjlxaCz20Ce6Mu/2 odi116IF7GjO5T83aOcVW1tddfp36BSTzsuyCf/f2lwwZzn+on4+vqRDoI3i7qNU+15es jbsrNNpe37bGhIySyDJpUlzg6lhPsSoJdStuUWinCs/qUyXg0JvfFes/NhPWdLDiOCxu+ iwvY+u99MQNGw2BmW9lT12mDkHsKYi4OWQHZmk/aIlad2q9BFogVyJGAq9+QILeKPe2nj 9Rosm3iqTZqeXWUS5pIW5YWCr3+hUHJSPoGO5h8VMUyLYXv/At4sC6Oyyo8zyUu/v/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795047225; 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=0+MV8glmCRDDaeYYhm/QgsobTk3R8hFUkImMxXR/75c=; b=PPaYsthflHye3XO/Xg4/7WWgAFyBZKDAsGA8PZvw11uTvNsEHPic6WZzOWQE8X/6bEZX QsGIheyyOJKRQWO57QwzZOl3tOlj0hx/DPNmvYdYRFnvKfUmW04d4wIhgRNQSRrD+Gl4u rXjnD8ixcyDuoHPkuh006BmeLlQVrVXSfqTWHJ+f6xO+pU1K2S1udZ+cuUAzsWGkENezl rHmLrbZG/z0zPRSeDvu7XHRej4hOGDZfNQ4nObK0UZh5IUKix6WOJ00fuvPq1WRS+0eMT LbIpsY9q91uvLGdYm4R2iy7UCguUq7+O2qLy34CeooA9qeeNCmCXuW+k88N20Uh+nLQ== 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=FhRdlxWW; 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 D9168606A31C; Thu, 19 Nov 2026 00:13:45 +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=FhRdlxWW Received: by smtp.kernel.org (Postfix) with ESMTPSA id 339241F000C4; Thu, 19 Nov 2026 00:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795047225; bh=0+MV8glmCRDDaeYYhm/QgsobTk3R8hFUkImMxXR/75c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FhRdlxWW6kslgZbP7KG0W0ZQDeaWHq2aFHJ7hukEEhIiNGNtNtWaNYIzKKFxSCrpF Ng+XBiXbVh2KgcVALwA2gR2Lb38SaZdkaK8s/fuA5Vs9/IEaAFR90+NWo3Z35DLF26 zzpYkQuwIEB1WU682IYdDz2DR3nb2gX3eUPuCDJs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sumit Kumar , Manivannan Sadhasivam , Bjorn Helgaas , Sasha Levin Subject: [PATCH 6.1 1564/2857] PCI: dwc: Set DMA_BYPASS bit in outbound IATU CTRL2 register Date: Wed, 18 Nov 2026 15:43:18 +0100 Message-ID: <20261118150257.700449298@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@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 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sumit Kumar [ Upstream commit efadda401c5c8e2390ba66508eba154dbd0db5a9 ] An outbound iATU region matches any local (AXI/application-side) address that falls within its Base/Limit window and rewrites it to the PCIe-side address programmed in that region's Target Address Registers before the transaction goes out on the link. This matching does not distinguish CPU-initiated transactions from ones issued by the internal DMA engine (eDMA/HDMA). Example: outbound region 0 is programmed with Base/Limit covering local addresses 0x8000_0000-0x8000_0FFF and Target 0x1_0000_0000, for CPU-initiated accesses. The DMA engine is later given a descriptor whose destination is the host address 0x8000_0080, which happens to fall inside region 0's Base/Limit range. The iATU matches the DMA transaction against region 0 too and rewrites it to 0x1_0000_0080 instead of passing 0x8000_0080 through unchanged. The transaction then lands on the wrong host address, causing data corruption or an IOMMU fault when the rewritten address has no valid mapping. Set the DMA_BYPASS bit (bit 27) in PCIE_ATU_REGION_CTRL2 when programming outbound iATU regions so only CPU/AXI-initiated transactions are matched against the region; DMA engine transactions bypass the translation and go out on the PCIe link with their original address. Signed-off-by: Sumit Kumar Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260908-dma_bypass-v2-1-c3c81d408c0c@oss.qualcomm.com [ sashal: adapted CTRL2 value construction to the existing __dw_pcie_prog_outbound_atu() helper using PCIE_ATU_* constants ] Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pcie-designware.c | 5 ++++- drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 575834cae3b9e..ef88c9d8553da 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -348,7 +348,10 @@ static int __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, val = dw_pcie_enable_ecrc(val); dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_REGION_CTRL1, val); - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_REGION_CTRL2, PCIE_ATU_ENABLE); + val = PCIE_ATU_ENABLE; + if (dw_pcie_ver_is_ge(pci, 460A)) + val |= PCIE_ATU_DMA_BYPASS; + dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_REGION_CTRL2, val); /* * Make sure ATU enable takes effect before any subsequent config diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 44254f31b5ac1..535205b8d1596 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -135,6 +135,7 @@ #define PCIE_ATU_REGION_CTRL2 0x004 #define PCIE_ATU_ENABLE BIT(31) #define PCIE_ATU_BAR_MODE_ENABLE BIT(30) +#define PCIE_ATU_DMA_BYPASS BIT(27) #define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19) #define PCIE_ATU_LOWER_BASE 0x008 #define PCIE_ATU_UPPER_BASE 0x00C -- 2.53.0