Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3605719imu; Mon, 24 Dec 2018 05:23:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN6JMGGox4lpzGCIiN6VjyI799YKQA4kqM/PLecDKD6i2QQSJAJC8tAFFOwLbqnCL1ZtDvRn X-Received: by 2002:a63:4002:: with SMTP id n2mr12129022pga.137.1545657791779; Mon, 24 Dec 2018 05:23:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545657791; cv=none; d=google.com; s=arc-20160816; b=tJ/QFwIl69NI0wtUISH3bZnAvxyazDxT36NSioO3Hj2Bm9m1ZTdyjTH+jtFmY2HJFW JF3tcWAxEHcl67Oib8Wu3Kj6dSpuGHEvYIL+wcAndJtuCGjwLIjSrNz+rNvfNFyLIm17 qCVRguRlhts+a4NuBurwIVirVBQDYgRT2C1cM8Ir0/T1IQ5I0iVMedTjcWSKEUNtpZxv dJgXavCzH9SmZs/3cqwSHRi9EaybZd8j/R91Lp0zSfLN5MnzOQxz1BPE1sSISVfD9Qcv Ru1H0hwGSNGE+ixWXUXqrhkU0Aay6nujjvHFb4IkzduPgbs0A84eQdc5wCIl9ip43I0Y Aa2Q== 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=YwqNkUNPLYdK07Ra2/mSQ+jZoA95B8gqjnUO/EioucE=; b=AziNKZJqVW5X2QYyv+hsvMMfUIaJHSFBVdg4l3RlRUwslAe+cBQXS/KQrKOgVoTs0z kUDzC4P/hE2720BuUMVrrZ5T6jv1DhB9ohkBWIbbLu6a3CaLYbRHSSSklqVFrAdcunZT KmXDPj/40RDht/j26U1cDHMhofvk9wsiWwDBW3fPJStWjlB2AP1zJdKfIemQnYpwEhTi 2032mmyxo41e99izDKikBujjHarFIsyq02BZ6OJrbeDm5C0rZQ71p+GQ4up9dpk2MKN+ 8+HhQyHcV2FvPWB5frdOzfSXbUKBRumvwMO2IUHA5FCKt9tmiwQrSmI2i8VWCdmtzh1K Ou+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="CUnAh/Rq"; 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 q24si27558532pgi.334.2018.12.24.05.22.56; Mon, 24 Dec 2018 05:23:11 -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="CUnAh/Rq"; 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 S1725918AbeLXNU7 (ORCPT + 99 others); Mon, 24 Dec 2018 08:20:59 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45276 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbeLXNU7 (ORCPT ); Mon, 24 Dec 2018 08:20:59 -0500 Received: by mail-pf1-f195.google.com with SMTP id g62so5796934pfd.12 for ; Mon, 24 Dec 2018 05:20:58 -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=YwqNkUNPLYdK07Ra2/mSQ+jZoA95B8gqjnUO/EioucE=; b=CUnAh/Rqve+lXu2kbGyo9bkEQtyA5AD0Ti2n6JA3IoBI/ZQ2YxAVlgC5u47FeQQMhn RpjsyPtlNuUeBZsoZ+4VsJYM9iGoFNhhpJn2J68frv2rKaaO0T0uYDo2Sj+NUpduPHzm EgtQ1QgTv89NIcvJAt/gcyrEod5yHLdsLtYUsZaZpo25zf5zGahIyOpp2kMc5TgdpRt8 nKZrw+ux+pYMX7mul836T5MMdBuL4Kvuy3Nh05KJbMHRyYflMaTF53Q70EqkpjhsZmfa 17K6i6wlPIIC5zVJ30t12v5tkCWaDvMmkBB1Kla3Tlld8MXLACGIePanxTtvXoop3ANE 8tQg== 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=YwqNkUNPLYdK07Ra2/mSQ+jZoA95B8gqjnUO/EioucE=; b=nSjmgtA3hrWTwTTbwBndhFBeg+zv7gDYZQos5HyWU1aecU31QrM6yvf+34zLJN7cFL kJ8CiOGLN/V5nW1sEPjTbREBh41pvTL8jXVRBO+hlNnzKguqw3tSKfOTDKgRHRaawQFw MWjZe2YVHetmv+5yz3s7IJHW0xR1AaFqkQo5/Hpbeqz69gEWIQEYvzB+zYA1kYi/m0Gv HydnsIfM07hnOHKAHc9mWKhCwowyz4gJEChDCdmjobQ0nkTa/5y9CZWucSPySM+y6mQk pM2hZBKgobZZl/HaRCg4SuB4g6TGOxcpNE5Zvzu72gSItDz14pN5vv0iTPwWnG2hPqbe LRSA== X-Gm-Message-State: AJcUukdQw167jZi45oG+QkTAMp8/HIrNDgqT+I/VHVGsIIqbDmAJ3oxJ VZsFJi2q8S32ckXEpwwTeAk= X-Received: by 2002:a62:c185:: with SMTP id i127mr620171pfg.43.1545657657811; Mon, 24 Dec 2018 05:20:57 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([106.51.18.181]) by smtp.gmail.com with ESMTPSA id 84sm87589245pfa.115.2018.12.24.05.20.56 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Dec 2018 05:20:56 -0800 (PST) Date: Mon, 24 Dec 2018 18:54:53 +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: [PATCH v5 5/9] drm/xen/xen_drm_front_gem.c: Convert to use vm_insert_range Message-ID: <20181224132453.GA22132@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: Matthew Wilcox Reviewed-by: Oleksandr Andrushchenko --- drivers/gpu/drm/xen/xen_drm_front_gem.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 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..c21e5d1 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; - } - - addr += PAGE_SIZE; - } - return 0; + ret = vm_insert_range(vma, vma->vm_start, xen_obj->pages, + xen_obj->num_pages); + if (ret < 0) + DRM_ERROR("Failed to insert pages into vma: %d\n", ret); + return ret; } int xen_drm_front_gem_mmap(struct file *filp, struct vm_area_struct *vma) -- 1.9.1