Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp207406imj; Thu, 14 Feb 2019 18:42:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZwE7IjkKnwMnz9xse9PwdJS5/NcMgGILRgmm6Cf8rnqGMVtBr08H7JGzfgjJI1qJl+8aap X-Received: by 2002:a17:902:8f98:: with SMTP id z24mr7569976plo.40.1550198545846; Thu, 14 Feb 2019 18:42:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198545; cv=none; d=google.com; s=arc-20160816; b=ZRUgp+WosBABzQnRo/8n2lL1Fr/fTpODTz64E04SGmR+g3kBCp6RT4lm0yyoEwdx5s /kzewTlR9LCFYnF+TX8sHThVYlgUTN0XZKLHRObmWyjJDwyVAHtld6rqvPvQoX7433JV OhfJaF7r7Rzr3RDoD207aub1olp6jp47xClrwg8kqT+T3Eh0gOsv0KVaqcPkIwzO3vUx 5sT6DvSQmIvuuPvCsyGSnz2AXe5QKRluJteFOYcbJ7G8XFkSCmxzgvPUpCIZD1BLc3D/ qPgRehoB8rzXZkSkWU9rtJaPpMbXzsSjGKcb82RgrJISQZSqg0Kp28AXa/VBERUG/XRy AZqQ== 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=+cqpEOgVsQX6FuKbkjkqnPdK6JJEhfhSEvMIkCtIVgk=; b=Xaawf7CCpx/HKwNEigTh7JpR/LClNEAloVvGz/ukA1fgEqYFNPFt0uc508ilF0cJau h1VB3yz/dMd0KJZdufEVxc8b4NJs2Sw89OLxyJGQkRxOxOumpqVkm94l9KSA6WDcheFT xxmQXidURqB2RCe8lWh/2t5j5jh3SIdOjQXSCo5Zw5CI9sZ23IrU1frmb2IRWcSglYdp QHl/R9l5KnYr3asT0B8PMzyZSH55cwEA0+OiPMUanAXHR08kH9mLItZ1ogHhk3VngqAn rHi3AiUBAulxV6ABJIp32Dl8sC+/e2gEx1IQEU2INLQCqO9dkDY6eCKQsqG3Z+ubHWy2 CVcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PZBET/v+"; 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 r10si3932229pgr.489.2019.02.14.18.42.10; Thu, 14 Feb 2019 18:42:25 -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="PZBET/v+"; 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 S1731303AbfBOClJ (ORCPT + 99 others); Thu, 14 Feb 2019 21:41:09 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:33047 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731007AbfBOClF (ORCPT ); Thu, 14 Feb 2019 21:41:05 -0500 Received: by mail-pl1-f195.google.com with SMTP id y10so4197036plp.0 for ; Thu, 14 Feb 2019 18:41:04 -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=+cqpEOgVsQX6FuKbkjkqnPdK6JJEhfhSEvMIkCtIVgk=; b=PZBET/v+AvTm5uI6YhLQd/yhp9OJU4BXs5QA0Gv2/WEpddBD1QACIx3W+qj/R+DwpM B3BzpTqjks4wX/579seQjUOZNkBasPTeBbzS7Ts4S8uR/gAobhLKvuuBjPvnZ0p2M1+e UH/Gc2iPGBMYC4EV/ODk3qG1i7BTa624G4IbAyHgpQom75nwKU1TVfguAY8NM1SpQhag t/bnF90mVuhLmHwSRidYkQGL4uxY7KCT7jqdywdvHspXzYeX6exXlLeF+WVbzBFla7Za xrpAZoUBgGaI0ABuhCyNn+4AoykbvyaUO80m2jJbnwhHLhgC8kP1xoZ96ASplt0w6m2V UyKA== 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=+cqpEOgVsQX6FuKbkjkqnPdK6JJEhfhSEvMIkCtIVgk=; b=bNZteLrYahCi8kVY6HCDbZSUr0YmqDe0fdFj2cLOPXBbMJOD2F0B2WOltnCBZDuZmo 776zJXbKG6vaub4OrmGoN+8rmINbSaqoxalsQhHe7QIIMw+TtyQb/E3lf1FxmttWYS9h XhIa9OUXzkOiE3AxVjH8ZANUfDek2SZ9sMyvanTOBndBuknfwAC9O3eXANErgOiCLOxV A1MT0Tlft4h76F0gKFrl/jRg2cmMDA82pYKR94NHWQFWCXwpVuHal6Ki/3SgMYmML4db KjVN/d9gHI61uK/nTEC+ZJuJgYz/8cCcpkBy2N7lE4MjBqwBGz499k4YwsDJNxw9gIft mkMQ== X-Gm-Message-State: AHQUAubutU8wDKIi9uTBdrP59d2PCx6tlqhB7ZwAxBKEexB0H4KylXA3 p/SfYeJKVCmM4RDYZmXKE4I= X-Received: by 2002:a17:902:d83:: with SMTP id 3mr7519491plv.43.1550198464676; Thu, 14 Feb 2019 18:41:04 -0800 (PST) Received: from jordon-HP-15-Notebook-PC ([49.207.53.51]) by smtp.gmail.com with ESMTPSA id g87sm9521109pfe.43.2019.02.14.18.41.03 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Feb 2019 18:41:03 -0800 (PST) Date: Fri, 15 Feb 2019 08:15:24 +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, linux@armlinux.org.uk, robin.murphy@arm.com 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_map_pages() Message-ID: <20190215024524.GA26405@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_map_pages() to map range of kernel memory to user vma. Tested on Rockchip hardware and display is working, including talking to Lima via prime. Signed-off-by: Souptick Joarder Tested-by: Heiko Stuebner --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index a8db758..a2ebb08 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -221,26 +221,13 @@ 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 int 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_map_pages(vma, rk_obj->pages, count); } static int rockchip_drm_gem_object_mmap_dma(struct drm_gem_object *obj, -- 1.9.1