Received: by 10.223.176.5 with SMTP id f5csp3736232wra; Mon, 29 Jan 2018 18:43:31 -0800 (PST) X-Google-Smtp-Source: AH8x226DIGk9HLdZrpBH68kI9s1x7VfH3aQ4nW77vLko/TJ7M+R2ow5KgLPL3kXbUijcU80pFy2R X-Received: by 10.101.98.26 with SMTP id d26mr23309457pgv.416.1517280211255; Mon, 29 Jan 2018 18:43:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517280211; cv=none; d=google.com; s=arc-20160816; b=s39RaP4J5csPINFz7MV6qIHPfq0/Sm27GTofzl5hArAc4eWiWUMuiWav3LFnXXoV4V OCZ572qvC/6w7236Tu09d7bX7KOXzu3PsMdOn+5/eTVjnX3060JVVCdIfRZ/Lu5hKWj+ /NNWBfuJrDYWq7/K4akWhPUtvxe7hDvUNXpicSjsafsuCaOt+6TqkyBwuacrjYg6HIBM nIoCPjSW3gHmY/ulD7zmXnu5NGelM0XeonPOTkFrJNyJhae94SnGJA5kJcQXFdjOECOf fm4ZJwVD6XItRPXk80xxMTZz8PBSrm2J3KJf+Fb1zQi9bGY3l5LBbwkMxlXA4ye09FWi Wi1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:arc-authentication-results; bh=LB+gA6wOpJKWqljgIDBFPCtoKCIAVJI3uGRFcB9q25k=; b=DrlFYa6JK1is8giRyGf4ueNHCwXAj1A/utRULG7vuBykLIjDRkZ5+SpgGR28fBSmRw W9/6TsLjuSOkRqTtn/SwbocH/fY3yspBpmxFN+8kvGDk6dUfZor+GVkcAnXAszyxvZid wmFK6d81v7LSAJocbVqj5FgP/eRlJD/gwuKSLsa8wpnht8lkwcqaYjA684mR9IfeDZY6 +c55xehgjsPmoXbLXYhY9drncEmF+YXTIWKgy9X+2sS7lWHtuMWbx5qf/lzCC/V0r4Yx 38lM8let19DQ1uDK/6R4X1a0dlCl2fza9429pxhMjD0fPLzu+VNYGBN3c6Joe/eKTN9M qj2w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9-v6si566214pls.560.2018.01.29.18.43.16; Mon, 29 Jan 2018 18:43:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752544AbeA3Cmp (ORCPT + 99 others); Mon, 29 Jan 2018 21:42:45 -0500 Received: from regular1.263xmail.com ([211.150.99.140]:46902 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbeA3Cmo (ORCPT ); Mon, 29 Jan 2018 21:42:44 -0500 Received: from hjc?rock-chips.com (unknown [192.168.167.242]) by regular1.263xmail.com (Postfix) with ESMTP id 4257C4C49; Tue, 30 Jan 2018 10:42:41 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from [172.16.10.72] (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 7DA7B38A; Tue, 30 Jan 2018 10:42:37 +0800 (CST) X-RL-SENDER: hjc@rock-chips.com X-FST-TO: sandy.huang@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: hjc@rock-chips.com X-UNIQUE-TAG: <38ad6620a96b165e97f627aeb8e1d508> X-ATTACHMENT-NUM: 0 X-SENDER: hjc@rock-chips.com X-DNS-TYPE: 0 Received: from [172.16.10.72] (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 66380SPBLG; Tue, 30 Jan 2018 10:42:39 +0800 (CST) Subject: Re: [PATCH v2 03/43] drm/rockchip: Respect page offset for PRIME mmap calls To: Thierry Escande , Archit Taneja , Inki Dae , Thierry Reding , Sean Paul , David Airlie , Tomasz Figa Cc: Zain Wang , Lin Huang , Douglas Anderson , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, =?UTF-8?Q?=c3=98rjan_Eide?= , Haixia Shi References: <20180126131710.7622-1-thierry.escande@collabora.com> <20180126131710.7622-4-thierry.escande@collabora.com> From: Sandy Huang Message-ID: <8c3724a2-868d-8dad-6ba7-a66e30cc94f0@rock-chips.com> Date: Tue, 30 Jan 2018 10:42:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180126131710.7622-4-thierry.escande@collabora.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2018/1/26 21:16, Thierry Escande 写道: > From: Ørjan Eide > > When mapping external DMA-bufs through the PRIME mmap call, we might be > given an offset which has to be respected. However for the internal DRM > GEM mmap path, we have to ignore the fake mmap offset used to identify > the buffer only. Currently the code always zeroes out vma->vm_pgoff, > which breaks the former. > > This patch fixes the problem by moving the vm_pgoff assignment to a > function that is used only for GEM mmap path, so that the PRIME path > retains the original offset. > > Cc: Daniel Kurtz > Signed-off-by: Ørjan Eide > Signed-off-by: Tomasz Figa > Signed-off-by: Sean Paul > Signed-off-by: Thierry Escande > Tested-by: Heiko Stuebner > --- > drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > index 5d52020deca1..074db7a92809 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c > @@ -264,7 +264,6 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj, > * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap(). > */ > vma->vm_flags &= ~VM_PFNMAP; > - vma->vm_pgoff = 0; > > if (rk_obj->pages) > ret = rockchip_drm_gem_object_mmap_iommu(obj, vma); > @@ -299,6 +298,12 @@ int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) > if (ret) > return ret; > > + /* > + * Set vm_pgoff (used as a fake buffer offset by DRM) to 0 and map the > + * whole buffer from the start. > + */ > + vma->vm_pgoff = 0; > + > obj = vma->vm_private_data; > > return rockchip_drm_gem_object_mmap(obj, vma); > Reviewed-by: Sandy huang