From patchwork Mon Dec 10 13:45:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eunchul Kim X-Patchwork-Id: 1858191 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 1DFA73FCA5 for ; Mon, 10 Dec 2012 13:46:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FEADE5FFC for ; Mon, 10 Dec 2012 05:46:07 -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 A60CBE5D02 for ; Mon, 10 Dec 2012 05:45:52 -0800 (PST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MET00H26I8BEZJ0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 10 Dec 2012 22:45:51 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.45]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 6C.D0.01231.F87E5C05; Mon, 10 Dec 2012 22:45:51 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-eb-50c5e78f4803 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id AB.D0.01231.F87E5C05; Mon, 10 Dec 2012 22:45:51 +0900 (KST) Received: from localhost.localdomain ([10.90.54.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MET00B7TI899U30@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 10 Dec 2012 22:45:51 +0900 (KST) From: Eunchul Kim To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [RFC v2 2/5] drm/exynos: add iommu support for ipp Date: Mon, 10 Dec 2012 22:45:42 +0900 Message-id: <1355147145-13522-3-git-send-email-chulspro.kim@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1355147145-13522-1-git-send-email-chulspro.kim@samsung.com> References: <1355147145-13522-1-git-send-email-chulspro.kim@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsVy+t8zXd3+50cDDE4dkre48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGT8u/mAsuMdf8ajlCGMD4wzeLkZODgkBE4mP/U+ZIGwxiQv3 1rOB2EICyxglFu8yh6n5eeAWcxcjF1B8EaNEw8xDjBDOCiaJT9dWsIJUsQnoSBy51cwMYosI WEo82PobrINZYBqjxJ7Z58ASwgLWEhPv3QNrYBFQlej4swYszivgIfHlTB8bxDoFidZlh9hB bE4BT4np93rYIU7ykJhwZxIzRK+AxLfJh1i6GDmA6mUlNh0A2yUhcJlN4t6EB8wQcyQlDq64 wTKBUXgBI8MqRtHUguSC4qT0XEO94sTc4tK8dL3k/NxNjJAwlNrBuLLB4hCjAAejEg9vgOLR ACHWxLLiytxDjBIczEoivGIngUK8KYmVValF+fFFpTmpxYcYfYAumcgsJZqcD4yRvJJ4Q2MD Y0NDS0MzU0tTAxzCSuK8zR4pAUIC6YklqdmpqQWpRTDjmDg4pRoYN79n+ltx6sbTr+x7l+Z+ 3S7ud5rZUexs1ITVNlNfZ899dUqcacq06R068VOXSeSvtzvLIG2xMLYsOmyP76Rd6/93X+A+ 8dt4kr3b0jOGj41d1h2OF/f7t1bpmZJAfYtSiHIYywQ3+dKTOyvPhP4S9nGR+DbHZnloGmNX +tZf8xj0fSdtfbHATomlOCPRUIu5qDgRAMMZXh1wAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42I5/e+xgG7/86MBBjMviVtc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xowfF38wFtzjr3jUcoSx gXEGbxcjJ4eEgInEzwO3mCFsMYkL99azdTFycQgJLGKUaJh5iBHCWcEk8enaClaQKjYBHYkj t5rBOkQELCUebP3NDFLELDCNUWLP7HNgCWEBa4mJ9+6BNbAIqEp0/FkDFucV8JD4cqaPDWKd gkTrskPsIDangKfE9Hs9YLYQUM2EO5OYJzDyLmBkWMUomlqQXFCclJ5rqFecmFtcmpeul5yf u4kRHObPpHYwrmywOMQowMGoxMMboHg0QIg1say4MvcQowQHs5IIr9hJoBBvSmJlVWpRfnxR aU5q8SFGH6CrJjJLiSbnA2MwryTe0NjEzMjSyMzYxNzYGIewkjhvs0dKgJBAemJJanZqakFq Ecw4Jg5OqQZG53sb3Uym3r4Q3VNcKbCa85DSws4zS63/Pt2t7Clf/o0//PPNx/JhGXMU5c9/ M3qd5b/GiX/2JlmdGS2iXME/ONytNj3cfHvOlrcxM2PTHv3j/HV+5+U/PxdNEcjps447o2yS bHHCT6Lr0eTHHedtw0/GTwmIKnSZcvVFhs2Xwx4pzL+0mJlUlViKMxINtZiLihMBCXu8lKAC AAA= X-CFilter-Loop: Reflected Cc: jy0.jeon@samsung.com, jaejoon.seo@samsung.com, kyungmin.park@samsung.com, jmock.shin@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 adds iommu support for ipp. For this, it adds subdrv_probe/remove callback to enable or disable ipp iommu. we can get or put device address to a gem handle from user through exynos_drm_gem_get/put_dma_addr(). Signed-off-by: Eunchul Kim Signed-off-by: Jinyoung Jeon --- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 2d84477..c582300 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -23,6 +23,7 @@ #include "exynos_drm_drv.h" #include "exynos_drm_gem.h" #include "exynos_drm_ipp.h" +#include "exynos_drm_iommu.h" /* * IPP is stand for Image Post Processing and @@ -1668,10 +1669,24 @@ static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev) ippdrv->event_workq = ctx->event_workq; ippdrv->sched_event = ipp_sched_event; INIT_LIST_HEAD(&ippdrv->cmd_list); + + if (is_drm_iommu_supported(drm_dev)) { + ret = drm_iommu_attach_device(drm_dev, ippdrv->dev); + if (ret) { + DRM_ERROR("failed to activate iommu\n"); + goto err_iommu; + } + } } return 0; +err_iommu: + /* get ipp driver entry */ + list_for_each_entry_reverse(ippdrv, &exynos_drm_ippdrv_list, drv_list) + if (is_drm_iommu_supported(drm_dev)) + drm_iommu_detach_device(drm_dev, ippdrv->dev); + err_idr: idr_remove_all(&ctx->ipp_idr); idr_remove_all(&ctx->prop_idr); @@ -1689,6 +1704,9 @@ static void ipp_subdrv_remove(struct drm_device *drm_dev, struct device *dev) /* get ipp driver entry */ list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) { + if (is_drm_iommu_supported(drm_dev)) + drm_iommu_detach_device(drm_dev, ippdrv->dev); + ippdrv->drm_dev = NULL; exynos_drm_ippdrv_unregister(ippdrv); }