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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Christoph,

Le jeu. 11 mars 2021 à 12:26, Christoph Hellwig <hch@xxxxxxxxxxxxx> 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;
 +
 +	/*
+ * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the + * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map
 +	 * the whole buffer.
 +	 */
 +	vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
 +	vma->vm_flags &= ~VM_PFNMAP;
 +	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
 +
 +	cma_obj = to_drm_gem_cma_obj(obj);
 +
+ pfn = PHYS_PFN(dma_to_phys(cma_obj->base.dev->dev, cma_obj->paddr));
 +
 +	ret = remap_pfn_range(vma, vma->vm_start, pfn,
 +			      vma->vm_end - vma->vm_start,
 +			      vma->vm_page_prot);

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?

-Paul


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux