From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C5C33932F1 for ; Thu, 4 Jun 2026 07:46:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780559215; cv=none; b=ZoG6LGz52Z/CfGa7iKLkx2lBiqX4NGdQjBqXaM8gkSGwVtz6sq4P6tDmYEmJdITfqAmSzX7Mq/ObdLVPw/JKvbu1m63gJDU3EOB3ynNaiPsWYFPpsTRf0Oxd/XZRctOgxMUPPljErgMVyBHYB/7gi2obSRaK9HK9EKwzVH4h0z8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780559215; c=relaxed/simple; bh=QuQ6yd+qiTMx7wu9ukvpMClIGTQzcrTyFNlcmK2JTcE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q7K/2fLyO1XMhtYC/qzBCw9hhTR0UI2HygRqYkUOryIOyJ9btSJzlrM9XcGiOrZwezjUNApgA/gxyqav/xKu4AkIx91N5SvlY3Xk1p+PfJfPpHS39qL2ghidpqneOh90uFW965PJ6lwnM6de5CBvNDik3B9qZa4mqHDwjbjk4Mc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uQCRcTf9; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uQCRcTf9" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2bf22c18ad3so84525ad.0 for ; Thu, 04 Jun 2026 00:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780559212; x=1781164012; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=OEvlqMLJ2/4sje01Hu61egtPwYlipbO9vTjEeFPQIjM=; b=uQCRcTf9rlg4FiijkWXaXpdxmNl9b4hQOkLC08axfRqoB4dInmuWlaCFCOq1xkL6t6 Y9+nPaV4oqav+kFOFTr7U71JltDj8Nbg00afIR+3OkkN/a+oUYfvcuvLgmwextcfjZ4e mvw5yPsduvhEhNDrz1TEXlu8eJTLwDJfTfJfydDs44cFhx9LiT/AidAxC+KKRCVj+92W 75Axn1S8EOLVFYVTjtYTtHA/EcR2hF859eROf+kAOhATSqs58xjzWPRJNlVRcAzYzOx7 noIXUnVMAcih4NGfZ5Nppin/ALN1zAJtUgL0sKH0ByOlxktEuxDxnwZriA1GUamvwkik YBuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780559212; x=1781164012; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OEvlqMLJ2/4sje01Hu61egtPwYlipbO9vTjEeFPQIjM=; b=aul7Lik/hjk6JWE1FWp6ryXamXOEDp6E8hSx+jduXRWC4eBZ6ccWbrpmMU5p4nNMEI JLFWIFv0pb2iP9mIReBibAKhTgOX59k5Rd8jfs0/UIO9Jtc71GMR+F9kEQ364HDNM3C3 a5C8U2wFBpRzyOHoKy70fRCwZxOmvpkSmAieHF3f2biuwy2+E2ChyALFm89T5myKvjWk OsGFO2ljWV5L6i53KnDjbaSqV6cKWJ8qD80bZwoLRKVhzH2IzGj1FjIO7ZyocuRx6+i5 XRwBqy4Y8RK3c4f9aewn8QonhYnB5gZQaZAs6dNjg011ym3CpINWkAc8q5Ufn4Q1EJ/a aJmw== X-Forwarded-Encrypted: i=1; AFNElJ9CuhRUX/w6vKNnHTXq871KQRVpz1FJI+aMarAAmnPqNMIPjxBthsKm0cc6ao/xsRXsFtJMDR6WZr8BpnA=@vger.kernel.org X-Gm-Message-State: AOJu0YxeH9kDnUdDs0/qqAlf7Pzcv0naQQIePc9VVXKr4NZFtx73yA3k fCwxgmEBOav0zc62q3AVfCKx7cv+oK1WXjU3IFJ673iRlWBjWxYuXZHgItuqEy0fGw== X-Gm-Gg: Acq92OEsW745lPqI+bctL6pHkiabENe3Z7a/hxFxu9NrGE9Fgd1uTEROKm+ZOEbOJZd WBpXVVBjYhqJ4lq6Bp52peuaYhnRYmMBIaaEMmoDsMQ4+nASfg68/bMMf8H3+lYnx+BtcsLJFNH aidV/ZCMfQlCCxP9AcQuDkVqBS+1wwTDh8eCwneGwd2cFJW11Ne2epwowLsHq9pa6NBhKjq9MHE ycQ3kJ5TeYLPASI38l0ACTIrbdrIyoQC/7MEBnfWa0onK6Dog+svzMzW/K5ks3zHlTKPTTdJeaW E2X+gUj31uKfeAe/OxGVqZ9l+xDkHGg3XM11ncqQthKtXUzJ/5lb27WOdN5je6uSVVhgNWwsvRf kzpa7RJIFNi637ivakqGNxoRT9A+zCIxJHDLxrQ+IdDpqqFUFdJgijcNgNoCc3JMOjiAQFMQTTi m5k972gyfQ/cNhndcLheSiN0AshvmUYH7Lyx2IUlAgTsMewxdzy9Sal+OBohlkvVf2R7thP3Imv ctOsnuC7Q== X-Received: by 2002:a17:902:ea10:b0:2c0:b19c:2e10 with SMTP id d9443c01a7336-2c198ab2908mr2379365ad.0.1780559211598; Thu, 04 Jun 2026 00:46:51 -0700 (PDT) Received: from google.com (199.255.142.34.bc.googleusercontent.com. [34.142.255.199]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84282916b10sm5271203b3a.58.2026.06.04.00.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 00:46:51 -0700 (PDT) Date: Thu, 4 Jun 2026 07:46:45 +0000 From: Pranjal Shrivastava To: Leon Romanovsky Cc: Marek Szyprowski , lirongqing , Robin Murphy , Lu Baolu , Luis Chamberlain , Logan Gunthorpe , Bjorn Helgaas , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, hch@lst.de Subject: Re: [PATCH] dma-mapping: direct: fix missing mapping for THRU_HOST_BRIDGE segments Message-ID: References: <20260603013723.2439-1-lirongqing@baidu.com> <20260604071856.GA245424@unreal> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260604071856.GA245424@unreal> On Thu, Jun 04, 2026 at 10:18:56AM +0300, Leon Romanovsky wrote: > On Wed, Jun 03, 2026 at 06:25:22PM +0200, Marek Szyprowski wrote: > > On 03.06.2026 03:37, lirongqing wrote: > > > 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 > > > > Applied to dma-mapping-fixes, thanks! > > The change looks correct, but it will be better if this change will > improve d0d08f4bd7f6 ("dma-direct: Fix missing sg_dma_len assignment in > P2PDMA bus mappings") too. I was thinking the same and was about to post a fix. > > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c > index ec887f443741..e98b6547c950 100644 > --- a/kernel/dma/direct.c > +++ b/kernel/dma/direct.c > @@ -489,9 +489,8 @@ int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents, > case PCI_P2PDMA_MAP_BUS_ADDR: > sg->dma_address = pci_p2pdma_bus_addr_map( > p2pdma_state.mem, sg_phys(sg)); > - sg_dma_len(sg) = sg->length; > sg_dma_mark_bus_address(sg); > - continue; > + break; > default: > ret = -EREMOTEIO; > goto out_unmap; > > Thanks > For this fix: Reviewed-by: Pranjal Shrivastava Thanks, Praan