From patchwork Mon Dec 17 20:23:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10734263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AEE6924 for ; Mon, 17 Dec 2018 20:19:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C4F12989C for ; Mon, 17 Dec 2018 20:19:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3034729F53; Mon, 17 Dec 2018 20:19:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C89F82989C for ; Mon, 17 Dec 2018 20:19:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D48288E0050; Mon, 17 Dec 2018 15:19:43 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CF8A18E0033; Mon, 17 Dec 2018 15:19:43 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE9428E0050; Mon, 17 Dec 2018 15:19:43 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 7E59F8E0033 for ; Mon, 17 Dec 2018 15:19:43 -0500 (EST) Received: by mail-pg1-f200.google.com with SMTP id s27so11595468pgm.4 for ; Mon, 17 Dec 2018 12:19:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:mime-version:content-disposition:user-agent; bh=vHtNG5YY7oqAEcnnEFXV1qkzWXHTgkZmEB/ZXAxtcsE=; b=pV9N214nfBTzvBn0GrnBIi1XSTsIt/u4UicRTrF8XEMjXTS8W5QFcXlzTEIAimKca4 uBtJTFnm9zWkDPkBP3RvrIrS4EN9mLCZgFQ1wj/WrFN6vEyeTNdQVC2tRtdYb7ffdzFd WHQ5UI2fKm3a9uuF+UyyJz4csSCstC3H8FlM0QSVW9QO8jBz+L6D7XgGaRpIgOnPwuTK zDzWHmvdLPwa69EM0y1S1Swd6VvrfeItuwT6r62/keHjfqs39rhi70bh7HXsZ0fYIB8p Tgp0Mo1OO7QIDwlj7sFOnDgORrjyVNx1CDxbnvIFVdlpChtnpouwreojiUkoHrPUAZUQ y0eg== X-Gm-Message-State: AA+aEWYb6jez9yFAwe/sZuPpVtx7uCm1kHTIL+q6OndvgrDRVzcNnzIV xhDFgSJzcBKtRKbJlJ+U3B/jGaThcmzFMxUjfUbUWOR2VqR7JSK1cJsrlrG1ZZbPujrsuzdBWtu xpcK0Avkh8GIaJy6T9rpAfU9vdxZtnRkrbxxtWpn1myZsXizpamdAffBj4D7VxFVDf3rFzp2fUr 6v2Y991ffqweKGomE83L5Ru00wWQCZpLzwzaEVnMMS7o2WQ3xlPfoAfxxqyjJNOYXEbU3O0MvvI XEsuKZ4eJtUCE+VHmknA1p49gyIc3H6LswgW11+EJUyz+N1TvIYKriBe35acCKAGZTMxdVO5sHx Hj6feenJv3suH5qaOU8y3SzAUBJSwtfyokSUy6DnRd6tMgpjdepmMTDSnmsfrT76XVjifGwrJMp A X-Received: by 2002:a63:7306:: with SMTP id o6mr13066306pgc.343.1545077982931; Mon, 17 Dec 2018 12:19:42 -0800 (PST) X-Received: by 2002:a63:7306:: with SMTP id o6mr13066279pgc.343.1545077982328; Mon, 17 Dec 2018 12:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545077982; cv=none; d=google.com; s=arc-20160816; b=XJbmhHo1Pup/BfO4vPFRZCUMwrMknqzcucDFYVbYPFsOdRmHnKwNuQugcdKad3wpyk ybAVOVeO7dmImYOU3FS1dgeldsZUY1bCl/pyoTfP1NS8jXj3DpI+RD2MYMv1dTpJVeVB IDbjE1jPNDod1KbYex5DhdP2kjHxZ1KJmGlW+JxhMR4A+hYTznpyEe6LUFnWunkT9Vdb c8w5uD9D7LTh0w7Blq8S7opBsvI2uELPogEiiT3s9TDV9UTIHfMHpzS9F5OeGYTEJUdk fYPOJc4V76l8tte2z8bghKtgyRnER8XreJnWLSi1fnD4P6ENmBvPf3aQXUSNCEQ5/y/X Z36Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:dkim-signature; bh=vHtNG5YY7oqAEcnnEFXV1qkzWXHTgkZmEB/ZXAxtcsE=; b=oiwPgNxpOEHLS6KvBP+T0KcXcGz3/8SzZ8XD1cE+0lVLo9fcf2vE80L+vnmcZMIycd DnEBPzyLYhKEsETOYwbXu3a47+CXUrgbm8/OO4NhrCB4bMXmDv9V82Fwj3P1GNl7D2oY t7NqZDqb2VwhAe912/rJE+sHmoSzpJfP4moIu4ktNksfZ1JIMvZzKiqee7ZIJoDAe9nd QChmwIGGnfyN/nYjKbEG5nAUF396kW8XnzPfytI9CWP2MPjWwofxtEiaYnf2uoVbpt+L 9z20ZqYqadZL5Q+9Sju7Z0QHfnQstKK2jIOFvEjbChBzjj5i08CpjZD+OMlgU+lLv+MH 5Dbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HDTJCfgn; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f91sor20271522plf.59.2018.12.17.12.19.42 for (Google Transport Security); Mon, 17 Dec 2018 12:19:42 -0800 (PST) Received-SPF: pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HDTJCfgn; spf=pass (google.com: domain of jrdr.linux@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jrdr.linux@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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=vHtNG5YY7oqAEcnnEFXV1qkzWXHTgkZmEB/ZXAxtcsE=; b=HDTJCfgnh+j0eG6OnfEpzoBfilcO9b+44SSH+rczBsLIYMzVoHJCuW+pyMCFqzu1V/ Zy29YyLtOwX2UDdP/SXCBW97juLvRF2DVYMvTzi4i7gL6TPz9Limk1pxhoJF2ZR2gdCa 7tJqkTGxerJpUQ4Okn3XGjeaWWgwbzll56yffTbkYAxyfBuv/nGBVByby04RrCEOGLBh iw4KiWfDMyasNKW7SRmZWh7oGNwhOdjF9l+eHcRuO4ZmQmXbT2DzCdawrCDVnJ6qPfsO 1gQeUUbdnGeiVu6w6a6Y+0opTR0MRZS8NcET2Nm32kXGicA27G+cCt8iUbI/NAzK56ww TNPA== X-Google-Smtp-Source: AFSGD/VztJFrJiCc5TxrvjdoAMM5foV3+t6D91QTlRMzDwrlUkxArWBo7WpY83vLc2dZ2XXJU04Cxw== X-Received: by 2002:a17:902:8a8a:: with SMTP id p10mr14060709plo.50.1545077982019; Mon, 17 Dec 2018 12:19:42 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.98.208]) by smtp.gmail.com with ESMTPSA id u87sm31872783pfi.2.2018.12.17.12.19.40 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Dec 2018 12:19:41 -0800 (PST) Date: Tue, 18 Dec 2018 01:53:34 +0530 From: Souptick Joarder To: akpm@linux-foundation.org, willy@infradead.org, mhocko@suse.com, hjc@rock-chips.com, heiko@sntech.de, airlied@linux.ie Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Subject: [PATCH v4 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range Message-ID: <20181217202334.GA11758@jordon-HP-15-Notebook-PC> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Convert to use vm_insert_range() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder Tested-by: Heiko Stuebner Acked-by: Heiko Stuebner --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index a8db758..8279084 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -221,26 +221,11 @@ static int rockchip_drm_gem_object_mmap_iommu(struct drm_gem_object *obj, struct vm_area_struct *vma) { struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); - unsigned int i, count = obj->size >> PAGE_SHIFT; unsigned long user_count = vma_pages(vma); - unsigned long uaddr = vma->vm_start; unsigned long offset = vma->vm_pgoff; - unsigned long end = user_count + offset; - int ret; - - if (user_count == 0) - return -ENXIO; - if (end > count) - return -ENXIO; - for (i = offset; i < end; i++) { - ret = vm_insert_page(vma, uaddr, rk_obj->pages[i]); - if (ret) - return ret; - uaddr += PAGE_SIZE; - } - - return 0; + return vm_insert_range(vma, vma->vm_start, rk_obj->pages + offset, + user_count - offset); } static int rockchip_drm_gem_object_mmap_dma(struct drm_gem_object *obj,