From patchwork Sun Dec 2 06:22:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10707857 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 E7CCF13AD for ; Sun, 2 Dec 2018 06:19:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D66742B4ED for ; Sun, 2 Dec 2018 06:19:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C97472B4F2; Sun, 2 Dec 2018 06:19:13 +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 6A0692B4ED for ; Sun, 2 Dec 2018 06:19:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB1686B61FC; Sun, 2 Dec 2018 01:19:12 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A60066B61FD; Sun, 2 Dec 2018 01:19:12 -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 9032F6B61FE; Sun, 2 Dec 2018 01:19:12 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by kanga.kvack.org (Postfix) with ESMTP id 4A25B6B61FC for ; Sun, 2 Dec 2018 01:19:12 -0500 (EST) Received: by mail-pl1-f200.google.com with SMTP id y2so7493425plr.8 for ; Sat, 01 Dec 2018 22:19:12 -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=ng6k7XN2+E7qu+YJG+ewVaHjUak4Dnv0s5kVr6uQuLI=; b=eVrH89lLX+P5XTr59E5+iiYNudEtZkEkknVqjCQlCp1DJgqcKJFm4k2rbuFFQaXWAy UGR3EWD10U2Rqq0/jqZy6V29TKsqj+wUFDbSYe/t/7bSEUipPy+hHgc6ZieXoqltWN/o nVyxOKif6nOAWOaAbAQiqyQxBrMyHqyuK3/iO8QqNzUUdDFmRbL1ZYR0EXjOfq+93dPo FkP+rZNXr+JBN2s8mgU+EXI4LyVdUgBcvKsVVWe7WemVmYWO4DDUVOip7AVQi45TeCjr EqbafnlRrJkLHGroEhn1Muwrg6SwEpp6kIoN1jgjWpmY10fV58fFFNVeGLih0U+/DOQC /gQg== X-Gm-Message-State: AA+aEWY7ESuNwvbsCwQYsrcow9jJmQsj4ulx8MUGOtV4kmzcGpputok/ p9luGA/kCtFsZUHnP/qMM0tTm5T60rjJFeZI8WWeDM3HFT4LBljOs7wONMQmcd5zPCd9CmBmiys V825KmjiyLSZwjRFeXa1NnemmB3j44jeCCL8QKiGmbzqsa3iY4yKstuLWToGFvLc4EjNvybv2Ux OHnv7SwxynqAl3zdOl+/PDkwh6hYfY+UxS+lNQaJCmzSquBZY6lFA0YVbnJtA7tpC7nMbKN/8aj 2cwoWbLjTDm8Uql62oVhlO/bDyQLVThttHFmwL4Sfk4ssZVYXV+9ZNmGvZzzYFYXGM27PNoa1Z6 V/UBNK6dcWbLJU2jiLzf6XqaaWTQdZ73UC3N9PgDJT+jKfg7BNBC2eHunl2MgNgQxBsaNVFEvuv U X-Received: by 2002:a17:902:4d46:: with SMTP id o6mr10962935plh.302.1543731551999; Sat, 01 Dec 2018 22:19:11 -0800 (PST) X-Received: by 2002:a17:902:4d46:: with SMTP id o6mr10962920plh.302.1543731551334; Sat, 01 Dec 2018 22:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543731551; cv=none; d=google.com; s=arc-20160816; b=gNczCFa4b+089ghk6CK9lsKF9Z0x9ZGDlMBNFAnqISduchtgW70cO4GjP7wBOaPavr +lpVHmtz0cfWReWdW7ZnaObRlSCQJgiugvFXemkvjskTgm6vDWZ48YRDAVzGtKSF/OLD 7ye6Uo0h0uaXWowfOSx3lW0MEdyjktg5WqNKFzyADbHZVp17PfSWut1tdohvfv7qGDBF tRpRp1ECs3KQ1U+x5SHvWmnoHg5msTECMtxWCyufie/aSP9qVbls6733f78GcLeHo8zJ UhoU/TO7fMFoVmYGbsByLwATkZqMg8ZrcERwdsA9v1oAq7qVAI06YhHPUTPWdyWgMhfG IDfw== 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=ng6k7XN2+E7qu+YJG+ewVaHjUak4Dnv0s5kVr6uQuLI=; b=d2WWpd+aVEdu5mT9QS/ZFMves8ADQQkgFO7PUyP1NLIl0dnT0+4g2DslnD/VALzutF mqtFpT2cQAyhJJoC1IR8moyyBU172xp0mxbLkBLyxSFz83ju7PH7zD4GL/3OmvBoJMWQ 7Wa+Z7rd33lKpHS0vgyiE9UZZ/RXqswupW9PUKjc1smI1FvYmaf9hvorIVvCGzyUd/1O 5n6mmjzG2MIBbUE5ZgtS6skgJYI4waX2OAQ94ZqgwnbdZxOwM17ZUCIpRuwzCwge+Xhl SREhclZPlrbaJFRGrW/mT/ByTSVhTp/3AXfz8PtA9UgqdKzdY0Y9jxvBcb4voyQ+E0wr FaOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Uy2BvgZZ; 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 z11sor13367326pln.25.2018.12.01.22.19.11 for (Google Transport Security); Sat, 01 Dec 2018 22:19:11 -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=Uy2BvgZZ; 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=ng6k7XN2+E7qu+YJG+ewVaHjUak4Dnv0s5kVr6uQuLI=; b=Uy2BvgZZkqOXNK7hWBYo3ARMJUfASECRH1vDxiNUgHBWwBso/Dw5MVQ3h240LKOn9r NhpjK25eGn1477k5XxEo8EOyY+Y9o+E/DUJKbzrcAxAiamgY14sFBQ5e4pPJJZIPgx0x NzFau/vgdlUWyYjWlRMcagejTL6DGAwAmAsSxpCb68yXr9XBuwp/SaCrwZvvzqcGm0L3 4PgcxWbXzJwKYve3R9DhlAzPDVVBxKO/xslBA5HeS47vJGvTrlgakEwa4L493x3uvLwo PdxNdGZOUlyPHJ+JMUkdbANMZcGvWiGUFFuBO0DsdK/adiQyQW7EAu9QSeBXHtYH1PiP vFeg== X-Google-Smtp-Source: AFSGD/WRNjFD6zB7/hjn8Xn+aoz1dyOHhd/PEH2NIgt7PDmUyJF+fZfXXjivwgpQAMMMOqZJ+B9xkw== X-Received: by 2002:a17:902:e085:: with SMTP id cb5mr11348736plb.24.1543731551018; Sat, 01 Dec 2018 22:19:11 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.99.148]) by smtp.gmail.com with ESMTPSA id n73sm14870007pfj.148.2018.12.01.22.19.09 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 01 Dec 2018 22:19:10 -0800 (PST) Date: Sun, 2 Dec 2018 11:52:55 +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 v2 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range Message-ID: <20181202062255.GA3159@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 | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index a8db758..2cb83bb 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -221,26 +221,10 @@ 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, + user_count); } static int rockchip_drm_gem_object_mmap_dma(struct drm_gem_object *obj,