[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1ce5287f-22d1-3704-1e81-a44b2c63cbd8@gmail.com>
Date: Fri, 11 Jan 2019 17:10:01 +0200
From: Oleksandr Andrushchenko <andr2000@...il.com>
To: Souptick Joarder <jrdr.linux@...il.com>, akpm@...ux-foundation.org,
willy@...radead.org, mhocko@...e.com, airlied@...ux.ie,
linux@...linux.org.uk, robin.murphy@....com
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
dri-devel@...ts.freedesktop.org, xen-devel@...ts.xen.org,
"Oleksandr_Andrushchenko@...m.com" <Oleksandr_Andrushchenko@...m.com>
Subject: Re: [PATCH 5/9] drm/xen/xen_drm_front_gem.c: Convert to use
vm_insert_range
On 1/11/19 5:10 PM, Souptick Joarder wrote:
> Convert to use vm_insert_range() to map range of kernel
> memory to user vma.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@...il.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@...m.com>
> ---
> drivers/gpu/drm/xen/xen_drm_front_gem.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c
> index 47ff019..9990c2f 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c
> @@ -225,8 +225,7 @@ struct drm_gem_object *
> static int gem_mmap_obj(struct xen_gem_object *xen_obj,
> struct vm_area_struct *vma)
> {
> - unsigned long addr = vma->vm_start;
> - int i;
> + int ret;
>
> /*
> * clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the
> @@ -247,18 +246,11 @@ static int gem_mmap_obj(struct xen_gem_object *xen_obj,
> * FIXME: as we insert all the pages now then no .fault handler must
> * be called, so don't provide one
> */
> - for (i = 0; i < xen_obj->num_pages; i++) {
> - int ret;
> -
> - ret = vm_insert_page(vma, addr, xen_obj->pages[i]);
> - if (ret < 0) {
> - DRM_ERROR("Failed to insert pages into vma: %d\n", ret);
> - return ret;
> - }
> + ret = vm_insert_range(vma, xen_obj->pages, xen_obj->num_pages);
> + if (ret < 0)
> + DRM_ERROR("Failed to insert pages into vma: %d\n", ret);
>
> - addr += PAGE_SIZE;
> - }
> - return 0;
> + return ret;
> }
>
> int xen_drm_front_gem_mmap(struct file *filp, struct vm_area_struct *vma)
Powered by blists - more mailing lists