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

2021-03-12 Thread Christoph Hellwig
On Thu, Mar 11, 2021 at 04:12:55PM +, Paul Cercueil wrote: > ret = dma_mmap_pages(cma_obj->base.dev->dev, > vma, vma->vm_end - vma->vm_start, > virt_to_page(cma_obj->vaddr)); > > It works fine. > > I think I can use remap_pfn_range() for now, and switch

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

2021-03-12 Thread Paul Cercueil
Le jeu. 11 mars 2021 à 12:36, Christoph Hellwig a écrit : On Thu, Mar 11, 2021 at 12:32:27PM +, 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/96a546e

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

2021-03-11 Thread Christoph Hellwig
On Thu, Mar 11, 2021 at 12:32:27PM +, 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 confir

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

2021-03-11 Thread Paul Cercueil
Hi Christoph, Le jeu. 11 mars 2021 à 12:26, Christoph Hellwig a écrit : +int drm_gem_cma_mmap_noncoherent(struct drm_gem_object *obj, + struct vm_area_struct *vma) +{ + struct drm_gem_cma_object *cma_obj; + unsigned long pfn; + int ret; + +

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

2021-03-11 Thread Christoph Hellwig
> +int drm_gem_cma_mmap_noncoherent(struct drm_gem_object *obj, > + struct vm_area_struct *vma) > +{ > + struct drm_gem_cma_object *cma_obj; > + unsigned long pfn; > + int ret; > + > + /* > + * Clear the VM_PFNMAP flag that was set by drm_gem_mmap()

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

2021-03-07 Thread Paul Cercueil
This function can be used by drivers that need to mmap dumb buffers created with non-coherent backing memory. v2: Use dma_to_phys() since cma_obj->paddr isn't a phys_addr_t but a dma_addr_t. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/drm_gem_cma_helper.c | 67 +---