From patchwork Thu Dec 6 18:42:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souptick Joarder X-Patchwork-Id: 10716617 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 5B66C109C for ; Thu, 6 Dec 2018 18:38:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4495A2DCBC for ; Thu, 6 Dec 2018 18:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 307D42CF39; Thu, 6 Dec 2018 18:38:43 +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 7597B2DCBC for ; Thu, 6 Dec 2018 18:38:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A42626B7B61; Thu, 6 Dec 2018 13:38:41 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9CB816B7B63; Thu, 6 Dec 2018 13:38:41 -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 893F26B7B66; Thu, 6 Dec 2018 13:38:41 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by kanga.kvack.org (Postfix) with ESMTP id 420896B7B61 for ; Thu, 6 Dec 2018 13:38:41 -0500 (EST) Received: by mail-pl1-f197.google.com with SMTP id v2so827458plg.6 for ; Thu, 06 Dec 2018 10:38:41 -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=AjTZ5EvES2QmgeCiwY3T2NwqsCMYnDKpw2/jmlx0zrP/Hr9h43GRw/4su9RIrkNuYR RiL09AVOV9O048rTvc23e7c+VFM2QyMWDacgbUlkECtKtXfLApI4zmEeKCU6AwwrtLLe Uqob6k7Rk+JGGU8tTR+sJXTVnI9Jswu6ySAdjYezF0Xh1MMMUx0cq8wotkjUQFxr6VhT Ww7verkOyuQx9y7a61atAw6DZved3rFS8npy1ilMQGLC9KG/f57nnczyu/5mgPmb14cY Um88IlBM6u+jOk8gk/ZDp+J07L4UOLoniZcglDd0ZUDnTXCwmy1Sfs/mMoifmShR/HM/ FQ6Q== X-Gm-Message-State: AA+aEWZBPw3AiGiZ6Q0bKGrR9jeIlwJwQ99wjbOf6RnKkw6MvfGMMEWp lfSw746gSqT17VDdeLXr+5WLEJvJLF1ip62YAw+JXo2YjuD05SBKr+nWkrGCN67iRWCP03tEAE0 75WojQ/bM1DG9TsgZbKVpg7i9//zbWU5XZ/pA8sxaFzK3qTZmGHWc4TSLfKpRZVoMOI2vX7vd8u si8Ql3GfxXkrxJ2X2cyvg/nGY3dqpBWr+YD7AtrFgtg4OLPbaoufRwkhvEJuCkmSEjDcA3UKBDT ykRE+eHZOlkUcfGRYf+VF/MFYNqMPaaQX3DcHim4hf00OtT0A6d0OCz2NQvOKG/Gp7eP4fG6bM8 EeG8f5ANOCFf0dBhHzvPWp3890RnRHypgUbQgF9YhfViSS/cmw7/VK0jJQKbcgbcc/erz8r8841 p X-Received: by 2002:a62:5dd1:: with SMTP id n78mr29075821pfj.58.1544121520938; Thu, 06 Dec 2018 10:38:40 -0800 (PST) X-Received: by 2002:a62:5dd1:: with SMTP id n78mr29075783pfj.58.1544121520220; Thu, 06 Dec 2018 10:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544121520; cv=none; d=google.com; s=arc-20160816; b=fueCdKNQ05sfKiYfEQFmNsb0Yy5Ve3aYag0EHbnpulzxO8D4N7SDCp2DBZBXI+8K24 rpH+bpwmBjVbzduQo34yEs1+wXxOdkTto0vP5X/vj3urcy3ZX3wG5Qfnq6nEp6BF3szS /lBZQgckvuY4d/zMCBlo9AlWOpQZ89uHU09pbP9eGCKhLB+QS5m+g7aQm47bFvuPq4cD or9cYdK/NCx+vz0v4RieoGf61pARkoYPfdze9SZ1gnOgQFvPgRo2KShXSA9uyitnRRrh 8DFe0BBcn3GLmd4kr/nFpyBEaJhe9JGOkdgWiyCGesCF6NwhJiq4Z6iozdC5xz0dnov1 4sCQ== 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=tkAuom9sAsR62UHMpZtlAhH+j5UtWju1zX2rqDUqAjXPBSVdOPD2R901lue5jVlixf XQQl+Iobk1RvJxONbIRzUHR8Cby3eLHlQwZiJGo5RZvsHcZE0EtGQQpp520BJ4hI9kx5 ABQyqPCDRWGExEn/Mg1bS0n5dMYR99C37MPOtr+Yww8er6U/FETSq4GliCDQFlQBoLXl JCoOVjsjyyGj5zzejbPH4cKTukiN7hIZ3rEljwrx59ZwpUHgASQPApjYjVV5B35Tq9E2 GAJxnulH57/oAZ1zqVh6e30yUKv35MFVruwTZXQXffAcdr7IFPiiOalegE40xjp19KV7 8Avg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UD31QJ6G; 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 f21sor2010097pgm.40.2018.12.06.10.38.40 for (Google Transport Security); Thu, 06 Dec 2018 10:38:40 -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=UD31QJ6G; 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=UD31QJ6GC66z7VnoRsNyMmQJNDtWDYhH1t1EhWvLVC35clbrhHvtCLfIDc3kuI/kjo PhE6/Q4QGJNtbeVj2PuHR6i0D2aaPFSW/lrGYQAawYaJpSZ00GcK0STbAQbASLfKcXbW KSmwt4pirPr0FbcPDgPDSPCxOIqY7CFQcfCnf1brtTusb4rK2TnWnnCiyvjOlAwhSnVj fpCFVKaKzndenoWYom9LwhhOrVfEHUY+WbndNJqxZnMyKCBPm0+weR2X++USF0iNayF4 WigpOsLRPEHu9s0S1Xs9XsH4QUV/+2uVeBmsr+h8O/0evUYqwJAesx/WQW19miTVpRjC i+ag== X-Google-Smtp-Source: AFSGD/VdfjPNYk7vJ3JQ1RT1pvFcY6rlX1YYQBpdVWgqyCdVx5xPkkuEuOXRFKVBkjSnBJ0Zx3q50w== X-Received: by 2002:a63:b81a:: with SMTP id p26mr25564117pge.433.1544121519885; Thu, 06 Dec 2018 10:38:39 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([103.227.99.39]) by smtp.gmail.com with ESMTPSA id z9sm1534389pfd.99.2018.12.06.10.38.38 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Dec 2018 10:38:39 -0800 (PST) Date: Fri, 7 Dec 2018 00:12:27 +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 v3 4/9] drm/rockchip/rockchip_drm_gem.c: Convert to use vm_insert_range Message-ID: <20181206184227.GA28656@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,