[PATCH 9/9] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()
Jan Kara
jack at suse.cz
Wed May 6 08:02:02 PDT 2015
On Wed 06-05-15 12:47:35, Vlastimil Babka wrote:
> On 05/06/2015 09:28 AM, Jan Kara wrote:
> >Convert g2d_userptr_get_dma_addr() to pin pages using get_vaddr_frames().
> >This removes the knowledge about vmas and mmap_sem locking from exynos
> >driver. Also it fixes a problem that the function has been mapping user
> >provided address without holding mmap_sem.
> >
> >Signed-off-by: Jan Kara <jack at suse.cz>
> >---
> > drivers/gpu/drm/exynos/exynos_drm_g2d.c | 89 ++++++++++--------------------
> > drivers/gpu/drm/exynos/exynos_drm_gem.c | 97 ---------------------------------
> > 2 files changed, 29 insertions(+), 157 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> >index 81a250830808..265519c0fe2d 100644
> >--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> >+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> ...
> >@@ -456,65 +458,37 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
> > return ERR_PTR(-ENOMEM);
> >
> > atomic_set(&g2d_userptr->refcount, 1);
> >+ g2d_userptr->size = size;
> >
> > start = userptr & PAGE_MASK;
> > offset = userptr & ~PAGE_MASK;
> > end = PAGE_ALIGN(userptr + size);
> > npages = (end - start) >> PAGE_SHIFT;
> >- g2d_userptr->npages = npages;
> >-
> >- pages = drm_calloc_large(npages, sizeof(struct page *));
> >- if (!pages) {
> >- DRM_ERROR("failed to allocate pages.\n");
> >- ret = -ENOMEM;
> >+ vec = g2d_userptr->vec = frame_vector_create(npages);
> >+ if (!vec)
> > goto err_free;
> >- }
> >
> >- down_read(¤t->mm->mmap_sem);
> >- vma = find_vma(current->mm, userptr);
> >- if (!vma) {
> >- up_read(¤t->mm->mmap_sem);
> >- DRM_ERROR("failed to get vm region.\n");
> >+ ret = get_vaddr_frames(start, npages, 1, 1, vec);
>
> Use true instead of 1.
Yes, thanks!
Honza
--
Jan Kara <jack at suse.cz>
SUSE Labs, CR
More information about the dri-devel
mailing list