From: Rahul Sharma 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> References: <1351945304-15084-1-git-send-email-rahul.sharma@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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 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) In-reply-to: <1351945304-15084-1-git-send-email-rahul.sharma@samsung.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: sw0312.kim@samsung.com, joshi@samsung.com, kyungmin.park@samsung.com, rahul.sharma@samsung.com, prashanth.g@samsung.com, s.shirish@samsung.com List-Id: dri-devel@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); } -- 1.7.0.4