From: Prathyush Subject: [PATCH 0/4] [RFC] Addition of dma-mapping IOMMU framework in Exynos DRM Date: Sat, 14 Apr 2012 17:22:09 +0530 Message-ID: <1334404333-24592-1-git-send-email-prathyush.k@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F1C2A0F42 for ; Sat, 14 Apr 2012 04:46:56 -0700 (PDT) Received: from epcpsbgm2.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0M2G007ZNW9H3K50@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Sat, 14 Apr 2012 20:36:53 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0M2G00CFAW941S00@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Sat, 14 Apr 2012 20:36:53 +0900 (KST) 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, linaro-mm-sig@lists.linaro.org Cc: inki.dae@samsung.com, sunilm@samsung.com, subash.rp@samsung.com, prashanth.g@samsung.com, prathyush.k@samsung.com List-Id: dri-devel@lists.freedesktop.org From: Prathyush K With these set of patches, the Exynos5 DRM module will be able to allocate, export and map non-contiguous memory for GEM objects using the dma-mapping IOMMU framework. These patches are based on the following references: 1> Exynos 5 SYSMMU driver by Kyongho Cho http://lists.infradead.org/pipermail/linux-arm-kernel/2011-December/078636.htm 2> DMA-MAPPING IOMMU framework by Marek Szyprowski http://lists.infradead.org/pipermail/linux-arm-kernel/2011-June/053636.html 3> DRM-PRIME by Dave Airlie http://patches.linaro.org/7480/ 4> DRM Exynos DMABUF module by Inki Dae http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/ d59d3e521d8a9d27e7b329f89f24a8473f32f50c/ 5> Support for dma_get_pages by Tomasz Stanislawski http://patchwork.linuxtv.org/patch/9639/ The updated GEM framework by Inki Dae is not considered for this patch set. IOMMU mapping is created for exynos-drm-device initially. Allocation of GEM objects happens through dma_alloc_writecombine which inturn calls arm_iommu_alloc_attrs. This will allocate a non-contig set of pages, allocate a iova and map all the pages. The following changes are done to support non-contiguous memory for GEM objects [PATCH 1/4]: drm/exynos: DMABUF: Added support for exporting non-contig buffers. This patch is for creating and mapping a SGT in map_dma_buf by retrieving the pages by calling dma_get_pages. [PATCH 2/4]: drm/exynos: Mapping of gem objects uses dma_mmap_writecombine. This patch is for mapping the non-contiguous GEM objects to user space by calling dma_mmap_writecombine. [PATCH 3/4]: drm/Exynos: Added 'disable' function to Exynos drm crtc module. This patch is required for safe release of DRM. If a FB of a CRTC is released, the driver tries to disable the CRTC if that is supported by the CRTC. This patch adds Exynos DRM CRTC disable functionality. [PATCH 4/4]: drm: Releasing FBs before releasing GEM objects during drm_release. This patch is required for safe release of DRM. During drm release, all the FBs and GEM objects are released. A gem object which is used as a FB must not be freed first before releasing the FB. This patch modifies the drm release function to first release the FBs and then release the GEMs. drivers/gpu/drm/drm_fops.c | 6 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 +++ drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 98 +++++++++++++++++++++++----- drivers/gpu/drm/exynos/exynos_drm_gem.c | 70 +++++++++----------- 4 files changed, 128 insertions(+), 57 deletions(-)