# Re: use exact allocation for dma coherent memory

- From: Christoph Hellwig \<hch@lst.de\>
- Date: 2019-06-20 10:51:58 
- List: netdev
- Page: https://ratatoskr.run/netdev/2019/06/5634530
- Thread: https://ratatoskr.run/linux-s390/2019/06/5629039/t.md

```text
On Wed, Jun 19, 2019 at 01:29:03PM -0300, Jason Gunthorpe wrote:
> > Yes.  This will blow up badly on many platforms, as sq->queue
> > might be vmapped, ioremapped, come from a pool without page backing.
> 
> Gah, this addr gets fed into io_remap_pfn_range/remap_pfn_range too..
> 
> Potnuri, you should fix this.. 
> 
> You probably need to use dma_mmap_from_dev_coherent() in the mmap ?

The function to use is dma_mmap_coherent, dma_mmap_from_dev_coherent is
just an internal helper.

That beiŋ said the drivers/infiniband code has a lot of
*remap_pfn_range, and a lot of them look like they might be for
DMA memory.
```
