Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6621237imu; Wed, 30 Jan 2019 19:08:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN7VTSqgiuUJz4S/tv0O8soXPhMC5CWb0/BuYKzXme5JtCOhnFv4zLinw0tujnF3RpxSpjqu X-Received: by 2002:a62:8d4f:: with SMTP id z76mr34094550pfd.2.1548904097119; Wed, 30 Jan 2019 19:08:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548904097; cv=none; d=google.com; s=arc-20160816; b=Yckc0dj2d8m0bvN7Z5InBjfque08OgCBiyO5jajCiDY55I/No4fNg/oPtWDaIKNl5a UcWUQ38VYE6LV+9Pyfi2dsoEHrvVE96jmT+EcUqviVsqx3ZVu6oLv30tWYOUTnE1WAUv Esm0ZoH8Pka48dBqkfgsa05VPDUkVslZ+pYCfOm/1fSSbO5WBuE6P74Yiy9WPwq5jx6T lixNC5ae3uU9Paw5wm1HEgIaVCYtUHmwdeCEKlAJCmsIoiQHasaCK1LJWKPAyx/WE2m2 8tclYzNZoLqr3N+wHXCkhfrdI1rzhfnS/SEC6E7ClRG7+rMmwxDeXshekMqQCWDPDyOY A+pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=2owR9Y+Fu1XiPkZWSyijL0gEQb0pHlWrbxT50sCCie8=; b=hbYbUlx2WVIdbU4bwBZJJP3q7X6FkmQ42earOVCEjuidLDpNKBpV6H3rhL8hI9CTrj LXROXTzgHDyo1mrykYcx9TD+o+HByuBv96B67voOyiearxdk6hZtsuj5tkPqTJqaohKr YeqhP9oYM6dsoXeBEKfCXRdKAQBrgcjEPZztRa7x/qG//op07EOk+85z+acxBE3ow9Kx eCDW/y0Ck+d+3/KAr8aBVr7Qjib3xiU5VYRR37saBNTSICkixCVy3NVv2GHuSFr88jnV 5mHQAvkWRdquyZTdcxyC4IBNQOtiiq3ovo+WNKhj4K34obtwaTGWeuyHoMZ9/wckze24 SWtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NZQeve9z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si3171286plq.336.2019.01.30.19.08.01; Wed, 30 Jan 2019 19:08:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NZQeve9z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730198AbfAaDHb (ORCPT + 99 others); Wed, 30 Jan 2019 22:07:31 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41674 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbfAaDHa (ORCPT ); Wed, 30 Jan 2019 22:07:30 -0500 Received: by mail-pf1-f193.google.com with SMTP id b7so795818pfi.8 for ; Wed, 30 Jan 2019 19:07:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=2owR9Y+Fu1XiPkZWSyijL0gEQb0pHlWrbxT50sCCie8=; b=NZQeve9zbX4Ge5xvXA78Atzzs0uz6ecZSf2jwkaGy9naKq9UQ0tGyf9387X8jWOLDY 4ZExfwm2IiQfWLdL33XwJ3bqjuvWu3hYYxHJMPAMFEaVhAeOUc/0AE0trX9/ICzKCOpS i+ewoNERn06fUr3RKBdUL5yInvTYP9sftxNuXJaahmRL+kntme6zlalSzoLx36Tmhh8C VinMhm7g3UqnH8SQWO1LKsOibcKBsobp48bdEEKBNKNSZzue/f6r7SLEkykVE53pLDdT dpMFxOI4SJeXn7LVUGa+EVhuKWGKqicsil2CZOCmz1DHhwtAFNoCWpswU1DfJptM3n6G R9Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=2owR9Y+Fu1XiPkZWSyijL0gEQb0pHlWrbxT50sCCie8=; b=MedSPBlFZeuhCKij5P/jY6UWqKabTA1F8I326LE3Tzk14JnR5UNf/h8nerDGau7ltp RCZ5qNLETtSCcWXAAoIgQBelq5GUMgf3Qs33AaRufIyAg3Y9YssCxavpICdr98sZmTYq PdqIGHPdeAGfG9P+ZMFI47OPUSL2VnrJ0tJ5wjAvjQC/qEVne0j8NDgg6/kihzDFlVgr yGcMNlF0t3NkeGz1J6FLdEnyBYN8V+d9o3LHcLsPN9u5EB9JsHHHPcaO/dvJBnr4CmVh DoLFIjbaWpGMA0GiByZ9r+XV4TY0+xBqI02tU9G7K6GOGSPzN6f0nB+meClxZqt1htLR 977w== X-Gm-Message-State: AJcUukdRcxvbimk98hWn+8PytHX9ObFsHbNSKPaTbnT9AJNjq05NPwX1 e8usj894icgi5pYuMBtRMo0= X-Received: by 2002:a63:7512:: with SMTP id q18mr27636577pgc.231.1548904049578; Wed, 30 Jan 2019 19:07:29 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([106.51.20.103]) by smtp.gmail.com with ESMTPSA id v184sm3913763pfb.182.2019.01.30.19.07.28 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Jan 2019 19:07:28 -0800 (PST) Date: Thu, 31 Jan 2019 08:41:42 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, oleksandr_andrushchenko@epam.com, airlied@linux.ie, linux@armlinux.org.uk, robin.murphy@arm.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org, xen-devel@lists.xen.org Subject: [PATCHv2 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_insert_range Message-ID: <20190131031142.GA2339@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert to use vm_insert_range() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder Reviewed-by: Oleksandr Andrushchenko --- 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 28bc501..b72cf11 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -224,8 +224,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 @@ -246,18 +245,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) -- 1.9.1