From patchwork Fri Dec 14 08:58:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eunchul Kim X-Patchwork-Id: 1877801 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 8EEAADF230 for ; Fri, 14 Dec 2012 08:59:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 67EAAE672D for ; Fri, 14 Dec 2012 00:59:32 -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 5FF21E5ECE for ; Fri, 14 Dec 2012 00:58:54 -0800 (PST) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MF00036WJLWCD60@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 14 Dec 2012 17:58:52 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.41]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E5.54.12699.C4AEAC05; Fri, 14 Dec 2012 17:58:52 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-f9-50caea4cc1f6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D4.54.12699.C4AEAC05; Fri, 14 Dec 2012 17:58:52 +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 <0MF0009UXJM1OE00@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 14 Dec 2012 17:58:52 +0900 (KST) From: Eunchul Kim To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [RFC v5 2/5] drm/exynos: add iommu support for ipp Date: Fri, 14 Dec 2012 17:58:54 +0900 Message-id: <1355475537-31989-3-git-send-email-chulspro.kim@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1355475537-31989-1-git-send-email-chulspro.kim@samsung.com> References: <1355475537-31989-1-git-send-email-chulspro.kim@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsVy+t8zTV2fV6cCDKb2WFhc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujKMTdzEV3OOvmPmuka2BcQZvFyMHh4SAicSmluAuRk4gU0zi wr31bF2MXBxCAssYJXat+swMU/PrvTNEfDqjxNS2jywQzgomieXfdjCDdLMJ6EgcudUMZosI WEo82PqbGaSIWeAno8S6J2dZQRLCAtYSb/7uYQOxWQRUJZ7MOwQW5xXwkHg2fwsbxBkKEq3L DrGD2JwCnhLLp+9mBLGFgGp2XLvKCtErIPFt8iEWiOtkJTYdANslIXCdTeLctNPsEHMkJQ6u uMEygVF4ASPDKkbR1ILkguKk9FwjveLE3OLSvHS95PzcTYyQIJTewbiqweIQowAHoxIP7weh UwFCrIllxZW5hxglOJiVRHgljwCFeFMSK6tSi/Lji0pzUosPMfoAXTKRWUo0OR8YIXkl8YbG BsaGhpaGZqaWpgY4hJXEeZs9UgKEBNITS1KzU1MLUotgxjFxcEo1MPLuTqo85v939pFEb4+H sct1gyzm/vE5FX51Ek98wBN5F+djVVsWyDux+YdMniT5o0ZvhcFHybBvi17vKFXfGOtndIs/ 4MaFdz1C2leeif70frDKZ+eTyQ8Xh+UW7JBa01c0UfElk1xw9JspJu77Zea/isqeXBBRJ8ce 0FvG4yAQdJbb4G+RoxJLcUaioRZzUXEiAHLNRyFvAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeLIzCtJLcpLzFFi42I5/e+xoK7Pq1MBBouWG1pc+fqezYHR4373 caYAxqgGRpuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wc oLFKCmWJOaVAoYDE4mIlfTtME0JD3HQtYBojdH1DguB6jAzQQMI6xoyjE3cxFdzjr5j5rpGt gXEGbxcjB4eEgInEr/fOXYycQKaYxIV769m6GLk4hASmM0pMbfvIAuGsYJJY/m0HM0gVm4CO xJFbzWC2iIClxIOtv5lBipgFfjJKrHtylhUkISxgLfHm7x42EJtFQFXiybxDYHFeAQ+JZ/O3 sEGsU5BoXXaIHcTmFPCUWD59NyOILQRUs+PaVdYJjLwLGBlWMYqmFiQXFCel5xrpFSfmFpfm pesl5+duYgQH+TPpHYyrGiwOMQpwMCrx8H4QOhUgxJpYVlyZe4hRgoNZSYRX8ghQiDclsbIq tSg/vqg0J7X4EKMP0FUTmaVEk/OBEZhXEm9obGJmZGlkZmxibmyMQ1hJnLfZIyVASCA9sSQ1 OzW1ILUIZhwTB6dUA6NEyq66VF73w1mruoty638xOGVVb/ivPTGF+XKwL8uLUMWab542LYrM IU1zmq9cyloeO2vp97+nVjm8jHU+t+P5qil/277u/HLYtKhYTDghtKa5vui9SHKH0/PXbFLf lFz55GQC21Q+lLLM9en8/3OrqZXnNQ6fWyXM08LePovpniGUO3PJeSWW4oxEQy3mouJEAJU6 0r+fAgAA X-CFilter-Loop: Reflected Cc: jy0.jeon@samsung.com, sw0312.kim@samsung.com, jaejoon.seo@samsung.com, kyungmin.park@samsung.com, jmock.shin@samsung.com, lsmin.lee@samsung.com, th908.kim@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 c640935..49eebe9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -24,6 +24,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 @@ -1771,10 +1772,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); @@ -1791,6 +1806,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); }