Re: [PATCH v2 3/5] drm: Add and export function drm_gem_cma_mmap_noncoherent

Christoph Hellwig
2021-03-11T12:38:03Z

On Thu, Mar 11, 2021 at 12:32:27PM +0000, Paul Cercueil wrote:
> > dma_to_phys must not be used by drivers.
> >
> > I have a proper helper for this waiting for users:
> >
> > http://git.infradead.org/users/hch/misc.git/commitdiff/96a546e7229ec53aadbdb7936d1e5e6cb5958952
> >
> > If you can confirm the helpers works for you I can try to still sneak
> > it to Linus for 5.12 to ease the merge pain.
>
> I can try. How do I get a page pointer from a dma_addr_t?

You don't - you get it from using virt_to_page on the pointer returned
from dma_alloc_noncoherent. That beind said to keep the API sane I
should probably add a wrapper that does that for you.