From nobody Mon Jun 8 07:24:42 2026 Received: from outbound.baidu.com (mx15.baidu.com [111.202.115.100]) by smtp.subspace.kernel.org (Postfix) with SMTP id 47F6536C5BD for ; Wed, 3 Jun 2026 01:37:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.202.115.100 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780450673; cv=none; b=hl4kbaJjVe1mh+siE2Q66Docrufs7YO8/P2ScQnj1w+3HbkQsW2sTuYs9B9qqxAmQqoYmSDGqKXIVQ20v6KBMLo2+d6fECBEs9qLQDe9XHi569LZMZERroR2O3FB0WqDgy5m9Uly5+CbhrelRLxTuhljgi6qnYfg/UPQmMGH4vI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780450673; c=relaxed/simple; bh=GlKSaNALoJniaO9z1TGvbDDoEpejm6dNppIoxw6vPjE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=SheBIjBgc7CAU0p09KhhrxGXq5zM/Go0d48PIysZENmPTz5nI9Nnn4Y4YG98KOzPMOkrpzBrDQMg9/AJ5sm08jbSdSv1JTu/wpLdUKotX0cp+XAK//YiVkU/BObI0F2vrjF95c+NOyr0Bf9qI8QAyAUjuHP9ouAyFYjMVl2WRxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com; spf=pass smtp.mailfrom=baidu.com; dkim=pass (2048-bit key) header.d=baidu.com header.i=@baidu.com header.b=BfOlc1ha; arc=none smtp.client-ip=111.202.115.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baidu.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baidu.com header.i=@baidu.com header.b="BfOlc1ha" X-MD-Sfrom: lirongqing@baidu.com X-MD-SrcIP: 172.31.50.47 From: lirongqing To: Marek Szyprowski , Robin Murphy , Lu Baolu , Luis Chamberlain , Leon Romanovsky , Logan Gunthorpe , Bjorn Helgaas , , , CC: Li RongQing Subject: [PATCH] dma-mapping: direct: fix missing mapping for THRU_HOST_BRIDGE segments Date: Wed, 3 Jun 2026 09:37:23 +0800 Message-ID: <20260603013723.2439-1-lirongqing@baidu.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: bjhj-exc4.internal.baidu.com (172.31.3.14) To bjkjy-exc3.internal.baidu.com (172.31.50.47) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baidu.com; s=selector1; t=1780450656; bh=ZGT8wnI3bkA2YrrA6V5djWcDogcM9eQrQorZGg40Tvk=; h=From:To:CC:Subject:Date:Message-ID:Content-Type; b=BfOlc1ha8pWrrb9SGFuyyqZh8LsCbyMUvZVG5y29yyDq/6G5W4BUVghqy8N7Ijq3U dR8xn+AASDk8kJ+1ItNon1I3RPPh603uHZkn5EirLLwJdVLNE01GKu+6ElaQeNhqs3 H+8A281QJ4Nb90/33fPen2M0F5Tnc/by6utUjj858eqy3Pe3MEZo/hWQuKpyZjStmX GEOnUhNS6Zvj42pcnUcDE9SO6QEjuHZlU7EPnEn24LCLZrEwU5ZdsNpN+uLimsTz0T UN2fKLFFOGNu3vXXzimV7FGDwjNZ2pv+YnPeBCrjuAiXbyKKBbiCTIHDS1JQ9VLM11 WEf+qb797n4Ng== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li RongQing In dma_direct_map_sg(), the case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE incorrectly used 'break' instead of falling through to MAP_NONE. As a result, segments traversing the host bridge skipped the required dma_direct_map_phys() call entirely, leaving sg->dma_address uninitialized and leading to DMA failures. Fix this by using 'fallthrough;'. Fixes: a25e7962db0d79 ("PCI/P2PDMA: Refactor the p2pdma mapping helpers") Reviewed-by: Logan Gunthorpe Signed-off-by: Li RongQing Reviewed-by: Pranjal Shrivastava --- kernel/dma/direct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 583c592..4391b79 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -476,7 +476,7 @@ int dma_direct_map_sg(struct device *dev, struct scatte= rlist *sgl, int nents, * must be mapped with CPU physical address and not PCI * bus addresses. */ - break; + fallthrough; case PCI_P2PDMA_MAP_NONE: need_sync =3D true; sg->dma_address =3D dma_direct_map_phys(dev, sg_phys(sg), --=20 2.9.4