From patchwork Sat Nov 3 12:21:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 1693581 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id E9883DF230 for ; Sun, 4 Nov 2012 09:50:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07E6F9E83C for ; Sun, 4 Nov 2012 01:50:30 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 58CC19EDD5 for ; Sat, 3 Nov 2012 05:02:05 -0700 (PDT) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MCW005PRURB33D0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Sat, 03 Nov 2012 21:02:04 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 16.ED.12699.CB705905; Sat, 03 Nov 2012 21:02:04 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-8a-509507bca0bd Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 45.ED.12699.BB705905; Sat, 03 Nov 2012 21:02:04 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MCW008RQUQYMG60@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Sat, 03 Nov 2012 21:02:03 +0900 (KST) From: Rahul Sharma To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/1] drm: exynos: fix for mapping contigous dma buffers Date: Sat, 03 Nov 2012 17:51:44 +0530 Message-id: <1351945304-15084-2-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1351945304-15084-1-git-send-email-rahul.sharma@samsung.com> References: <1351945304-15084-1-git-send-email-rahul.sharma@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsWyRsSkTncP+9QAg0nfhCyufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxoPmK+wF1zgqlt+bzdzAOJ29i5GTQ0LARGLjo+UsELaYxIV7 69m6GLk4hASWMko8XDqbCabox5s5LBCJ6YwSq2bMhXJWM0l86HjCDFLFJqArMfvgM0YQW0RA WeLvxFWMIEXMArcYJaY9WwG2Q1jAXeJZ6zFWEJtFQFVizsTTbCA2r4CHxIK2+4wQ6xQkWpcd AruPU8BTouvrEbAFQkA1kyecYIboFZD4NvkQ0EwOoHpZiU0HmCFar7NJ/FsXC2FLShxccYNl AqPwAkaGVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxiBYXj63zPpHYyrGiwOMQpwMCrx8BpI TAkQYk0sK67MPcQowcGsJMK7+BhQiDclsbIqtSg/vqg0J7X4EKMP0CETmaVEk/OBMZJXEm9o bGJuamxqaWRkZmqKQ1hJnLfZIyVASCA9sSQ1OzW1ILUIZhwTB6dUA2PvivwLMWdnCaxJXsu/ pi9kskY/2/VTTPeKA+4tf3mywf3W25xrFRuTbksuNMroTHtxYJP1d5uX/bsaD09hn/vtAWeO 4z3l7paiCYGng5/KT1/8Kc6h1iP0xs794Uufbll22/Vi+ed9judPMTO6q0UeuWIQfDhg/lbj Gi82I6/eB/9sPSpWfshVYinOSDTUYi4qTgQAtkwtJHACAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42I5/e+xoO4e9qkBBt1bGS2ufH3P5sDocb/7 OFMAY1QDo01GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO 0FglhbLEnFKgUEBicbGSvh2mCaEhbroWMI0Rur4hQXA9RgZoIGENY8aD5ivsBdc4Kpbfm83c wDidvYuRk0NCwETix5s5LBC2mMSFe+vZuhi5OIQEpjNKrJoxlwXCWc0k8aHjCTNIFZuArsTs g88YQWwRAWWJvxNXMYIUMQvcYpSY9mwF2ChhAXeJZ63HWEFsFgFViTkTT7OB2LwCHhIL2u4z QqxTkGhddgjsDE4BT4mur0fAFggB1UyecIJ5AiPvAkaGVYyiqQXJBcVJ6blGesWJucWleel6 yfm5mxjBYf5MegfjqgaLQ4wCHIxKPLwGElMChFgTy4orcw8xSnAwK4nwLj4GFOJNSaysSi3K jy8qzUktPsToA3TVRGYp0eR8YAzmlcQbGpuYmxqbWppYmJhZ4hBWEudt9kgJEBJITyxJzU5N LUgtghnHxMEp1cAoyLpo/Zqvpl+Y8mJvNusYOniG6t36t/FX8tUnE8UE55dyH8pwZmrQ8OGa 3vu6/ULS60dcq8pm/YnoOse8gO2NE8ORudJ70r2tSqbYMJoesJg0z/3Fh8hPi8se31kx1S4u YVb3ZQ/dg3NkRAKj0n/eOLuZ+6F/MJ/W3RnT2RhvTl39+RlL8EoBJZbijERDLeai4kQAWcrT /6ACAAA= X-CFilter-Loop: Reflected X-Mailman-Approved-At: Sun, 04 Nov 2012 01:44:36 -0800 Cc: sw0312.kim@samsung.com, joshi@samsung.com, kyungmin.park@samsung.com, rahul.sharma@samsung.com, prashanth.g@samsung.com, s.shirish@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org This patch fixes the problem of mapping contigous dma buffers. Currently page struct is calculated from the buf->dma_addr which is not the physical address. It is replaced by buf->pages which points to the page struct of the first page of contigous memory chunk. This gives the correct page frame number for mapping. Signed-off-by: Rahul Sharma --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index c557ac7..50d73f1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -120,8 +120,12 @@ static int exynos_drm_gem_map_buf(struct drm_gem_object *obj, } pfn = __phys_to_pfn(sg_phys(sgl)) + page_offset; - } else - pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset; + } else { + if (!buf->pages) + return -EINTR; + + pfn = page_to_pfn(buf->pages[0]) + page_offset; + } return vm_insert_mixed(vma, f_vaddr, pfn); }