From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65768212183 for ; Thu, 7 Nov 2024 13:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730987435; cv=none; b=Rsw+oaSaOTODj8KDiXCggz0sKUcNNoH57Fg7uh0+hFaLlA6wzQCsr0CvDmZpS71Ff+VYvHniXvHiQW7qSOW/S16reCWqn9rGFWH16jkT8hx9F5Zbv3wWrZMz8B+sPOJq6sCs22ANdO+rboF5SIDhOa4k1iN+uohzXyzwmwwpyY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730987435; c=relaxed/simple; bh=fgn4sel1p5t88qRO7ExDxdwas+YGL5pgazTpkpcAbsY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p7jgS/FeyKOnoJZ1T1CFctCv0SEozqBXNxKG499e6NrS6bW22WAQjg7sYJ50fx8s1hzVp7mqt8efomF4WONHqQT9lahCsBbdGLclS9CfitpjexY8tlULbTkbbCXeCDKEz48SmKOQrrslmcY8JS4cKDSXW/JCjCIM8Uc4dpHW3oE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id A292468C4E; Thu, 7 Nov 2024 14:50:25 +0100 (CET) Date: Thu, 7 Nov 2024 14:50:25 +0100 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , Robin Murphy , Leon Romanovsky , Jens Axboe , Joerg Roedel , Will Deacon , Sagi Grimberg , Keith Busch , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , Marek Szyprowski , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrew Morton , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-rdma@vger.kernel.org, iommu@lists.linux.dev, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, matthew.brost@intel.com, Thomas.Hellstrom@linux.intel.com, brian.welty@intel.com, himal.prasad.ghimiray@intel.com, krishnaiah.bommu@intel.com, niranjana.vishwanathapura@intel.com Subject: Re: [PATCH v1 00/17] Provide a new two step DMA mapping API Message-ID: <20241107135025.GA14996@lst.de> References: <3567312e-5942-4037-93dc-587f25f0778c@arm.com> <20241104095831.GA28751@lst.de> <20241105195357.GI35848@ziepe.ca> <20241107083256.GA9071@lst.de> <20241107132808.GK35848@ziepe.ca> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241107132808.GK35848@ziepe.ca> User-Agent: Mutt/1.5.17 (2007-11-01) On Thu, Nov 07, 2024 at 09:28:08AM -0400, Jason Gunthorpe wrote: > Once we are freed from scatterlist we can explore a design that would > pass the P2P routing information directly. For instance imagine > something like: > > dma_map_p2p(dev, phys, p2p_provider); > > Then dma_map_page(dev, page) could be something like > > if (is_pci_p2pdma_page(page)) > dev_map_p2p(dev, page_to_phys(page), page->pgmap->p2p_provider) One thing that this series does is to move the P2P mapping decisions out of the low-level dma mapping helpers and into the caller (again) for the non-sg callers and moves the special switch based bus mapping into a routine that can be called directly. Take a look at blk_rq_dma_map_iter_start, which now literally uses dma_map_page for the no-iommu, no-switch P2P case. It also is a good use case for the proposed dma_map_phys. > GPU driver > > https://lore.kernel.org/dri-devel/20240117221223.18540-7-oak.zeng@intel.com/ Eww, that's horrible. Converting this to Leon's new hmm helpers would be really nice (and how that they are useful for more than mlx5).