From patchwork Wed Dec 12 07:34:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eunchul Kim X-Patchwork-Id: 1864881 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 9736A4006E for ; Wed, 12 Dec 2012 07:42:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 709C8E6530 for ; Tue, 11 Dec 2012 23:42:37 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AA07E6144 for ; Tue, 11 Dec 2012 23:35:07 -0800 (PST) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEW00LWDQD6T510@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 12 Dec 2012 16:34:42 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.41]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 6E.4B.01231.29338C05; Wed, 12 Dec 2012 16:34:42 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-3d-50c8339223ef Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 6D.4B.01231.29338C05; Wed, 12 Dec 2012 16:34:42 +0900 (KST) Received: from localhost.localdomain ([10.90.54.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEW0091BQDQ79K0@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 12 Dec 2012 16:34:42 +0900 (KST) From: Eunchul Kim To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [RFC v3 2/5] drm/exynos: add iommu support for ipp Date: Wed, 12 Dec 2012 16:34:39 +0900 Message-id: <1355297682-7990-3-git-send-email-chulspro.kim@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1355297682-7990-1-git-send-email-chulspro.kim@samsung.com> References: <1355297682-7990-1-git-send-email-chulspro.kim@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t8zTd1JxicCDLZ3KFtc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujI5T59kK7vFX7F09h7GBcQZvFyMHh4SAiUTrHtEuRk4gU0zi wr31bF2MXBxCAssYJfY/eM8IkTCReL/6FiNEYjqjxITXd9khnBVMEnM/N4FVsQnoSBy51cwM YosIWEo82PqbGaSIWWAao8Se2efAEsIC1hKd/2azgtgsAqoS9yc/ZAI5g1fAXWLl1xSIbQoS rcsOsYPYnAIeEgt6N7KClAgBlRx4UA7RKSDxbfIhFogHZCU2HQDbJCFwnU3i6bavrBBjJCUO rrjBMoFReAEjwypG0dSC5ILipPRcQ73ixNzi0rx0veT83E2MkBCU2sG4ssHiEKMAB6MSD2/D u+MBQqyJZcWVuYcYJTiYlUR4aw1PBAjxpiRWVqUW5ccXleakFh9i9AG6ZCKzlGhyPjA+8kri DY0NjA0NLQ3NTC1NDXAIK4nzNnukBAgJpCeWpGanphakFsGMY+LglGpgnLREa5FYctAvo1MX PpouaNbNMni+3cxtB3fzxXWzQrNnHnSTz/adoZzx7s/Xv7HLCpZ+1QzlUn99/e3sWEnNqdxf 7e2DPm2+IPmMM18if0PxzQszfOYEpgRP99gQ9bm3IVJXf5aNUu1fl3+7lHf5rpzE9045aV52 UvidO91n+WaLuu2f1id0UImlOCPRUIu5qDgRAILgpo5uAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeLIzCtJLcpLzFFi42I5/e+xoO4k4xMBBktvyFpc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xoyOU+fZCu7xV+xdPYex gXEGbxcjJ4eEgInE+9W3GCFsMYkL99azdTFycQgJTGeUmPD6LjuEs4JJYu7nJrAqNgEdiSO3 mplBbBEBS4kHW38zgxQxC0xjlNgz+xxYQljAWqLz32xWEJtFQFXi/uSHTF2MHBy8Au4SK7+m QGxTkGhddogdxOYU8JBY0LuRFaRECKjkwIPyCYy8CxgZVjGKphYkFxQnpeca6hUn5haX5qXr JefnbmIEh/gzqR2MKxssDjEKcDAq8fA2vDseIMSaWFZcmXuIUYKDWUmEt9bwRIAQb0piZVVq UX58UWlOavEhRh+gmyYyS4km5wPjL68k3tDYxMzI0sjM2MTc2BiHsJI4b7NHSoCQQHpiSWp2 ampBahHMOCYOTqkGRnPlmgmcq442mnNX8uh7KbO9b4jccaxV4JPjwWvf3vXUGchWu23KjXE8 826m4LdtJa959MtPv/A8avbN4PvHe4VL/dMzmA0fzv74cvX5g8uz7mTtFr6nN8Ny41KDe2mN xvG/qh74+5g8CdY8ucFlpky6W4X5Kr1YlQMC/7QjT0j0PLicFXLjjxJLcUaioRZzUXEiAMg9 2t2eAgAA 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 eb12cb5..cb2165a 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 @@ -1783,10 +1784,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); @@ -1803,6 +1818,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); }