From patchwork Thu Apr 16 14:41:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=98rjan_Eide?= X-Patchwork-Id: 6226671 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9A0229F1AC for ; Thu, 16 Apr 2015 14:45:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D358B2034B for ; Thu, 16 Apr 2015 14:45:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0090F2013D for ; Thu, 16 Apr 2015 14:45:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yil2u-0001oA-HV; Thu, 16 Apr 2015 14:45:36 +0000 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yil2h-0000Ur-1v for linux-rockchip@lists.infradead.org; Thu, 16 Apr 2015 14:45:23 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-7.uk.mimecast.lan; Thu, 16 Apr 2015 15:41:53 +0100 Received: from e106893-lin.trondheim.arm.com ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 16 Apr 2015 15:41:53 +0100 From: =?UTF-8?q?=C3=98rjan=20Eide?= To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org Subject: [PATCH 1/2] drm: rockchip: Don't pass DRM fake offset to dma-api Date: Thu, 16 Apr 2015 16:41:51 +0200 Message-Id: <1429195312-25898-1-git-send-email-orjan.eide@arm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-OriginalArrivalTime: 16 Apr 2015 14:41:53.0246 (UTC) FILETIME=[7AD9D7E0:01D07853] X-MC-Unique: 3sc6C6XHQd-WQhZ7e-5KjQ-1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150416_074523_507540_C6A0EA94 X-CRM114-Status: UNSURE ( 6.59 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) Cc: djkurtz@chromium.org X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Set vm_pgoff to 0 after using it to look up the GEM node, before passing it on rockchip_gem_mmap_buf() where the offset must be from the start of the buffer. Passing in the fake offset currently works because the dma_mmap_attrs implementation that is used for this device, arm_iommu_mmap_attrs, ignores the offset completely. Signed-off-by: Ørjan Eide Tested-by: Heiko Stuebner Reviewed-by: Daniel Kurtz Acked-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index 7ca8799e..69f01c3 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -94,6 +94,11 @@ int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) return -EACCES; } + /* 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 = container_of(node, struct drm_gem_object, vma_node); ret = rockchip_gem_mmap_buf(obj, vma);