[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210624054003.GB25165@lst.de>
Date: Thu, 24 Jun 2021 07:40:03 +0200
From: Christoph Hellwig <hch@....de>
To: Oded Gabbay <oded.gabbay@...il.com>
Cc: Jason Gunthorpe <jgg@...pe.ca>,
Christian König
<ckoenig.leichtzumerken@...il.com>,
Christian König <christian.koenig@....com>,
Gal Pressman <galpress@...zon.com>, sleybo@...zon.com,
linux-rdma <linux-rdma@...r.kernel.org>,
Oded Gabbay <ogabbay@...nel.org>,
Christoph Hellwig <hch@....de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@...ts.linaro.org>,
Doug Ledford <dledford@...hat.com>,
Tomer Tayar <ttayar@...ana.ai>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
Greg KH <gregkh@...uxfoundation.org>,
Alex Deucher <alexander.deucher@....com>,
Leon Romanovsky <leonro@...dia.com>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@...r.kernel.org>
Subject: Re: [Linaro-mm-sig] [PATCH v3 1/2] habanalabs: define uAPI to
export FD for DMA-BUF
On Wed, Jun 23, 2021 at 10:39:48PM +0300, Oded Gabbay wrote:
> hmm, I thought using dma_map_resource will solve the IOMMU issues, no ?
> We talked about it yesterday, and you said that it will "work"
> (although I noticed a tone of reluctance when you said that).
>
> If I use dma_map_resource to set the addresses inside the SGL before I
> export the dma-buf, and guarantee no one will use the SGL in the
> dma-buf for any other purpose than device p2p, what else is needed ?
dma_map_resource works in the sense of that helps with mapping an
arbitrary phys_addr_t for DMA. It does not take various pitfalls of
PCI P2P into account, such as the offset between the CPU physical
address and the PCIe bus address, or the whole support of mapping between
two devices behding a switch and not going through the limited root
port support.
Comparing dma_direct_map_resource/iommu_dma_map_resource with
with pci_p2pdma_map_sg_attrs/__pci_p2pdma_map_sg should make that
very clear.
So if you want a non-page based mapping you need a "resource"-level
version of pci_p2pdma_map_sg_attrs. Which totall doable, and in fact
mostly trivial. But no one has even looked into providing one and just
keeps arguing.
Powered by blists - more mailing lists