From patchwork Thu Jul 2 12:49:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonyoung Shim X-Patchwork-Id: 6708941 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5193BC05AC for ; Thu, 2 Jul 2015 12:49:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 416FB2079F for ; Thu, 2 Jul 2015 12:49:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2263B2070D for ; Thu, 2 Jul 2015 12:49:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 843F07A111; Thu, 2 Jul 2015 05:49:43 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTPS id B14897A10F for ; Thu, 2 Jul 2015 05:49:40 -0700 (PDT) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NQV00JMF2AQTIC0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 02 Jul 2015 21:49:38 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.115]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 56.10.28411.26335955; Thu, 2 Jul 2015 21:49:38 +0900 (KST) X-AuditID: cbfee68e-f79c56d000006efb-ce-559533624394 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D6.1D.05312.26335955; Thu, 2 Jul 2015 21:49:38 +0900 (KST) Received: from localhost.localdomain ([10.252.81.123]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NQV00ICU2AQT920@mmp1.samsung.com>; Thu, 02 Jul 2015 21:49:38 +0900 (KST) From: Joonyoung Shim To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/exynos: remove drm_iommu_attach_device_if_possible Date: Thu, 02 Jul 2015 21:49:39 +0900 Message-id: <1435841379-28286-3-git-send-email-jy0922.shim@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1435841379-28286-1-git-send-email-jy0922.shim@samsung.com> References: <1435841379-28286-1-git-send-email-jy0922.shim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsWyRsSkWDfJeGqowZqDehZXvr5ns1g6o4/V YtL9CSwWL+5dZLFYe+Quu8WMyS/ZHNg87ncfZ/Lo27KKMYApissmJTUnsyy1SN8ugStj3ZFb zAUHDSqW/znJ2MB4TbOLkYNDQsBEou2DchcjJ5ApJnHh3nq2LkYuDiGBpYwS2/+eZIdImEgc +zqZBcQWEljEKHFkTxVE0Q9GiQM/PoAVsQnoSdzZdpwJxBYRUJb4O3EVI4jNLFAncfjaL2YQ W1jAW+Lzq99g9SwCqhKnFr8Bq+EVcJc40fKYCWKZnMTJY5NZQWxOAQ+J7l2XWCEWu0s8W76G CWSxhMB/Nol57bNYIQYJSHybfIgF4htZiU0HmCHmSEocXHGDZQKj8AJGhlWMoqkFyQXFSelF RnrFibnFpXnpesn5uZsYgeF7+t+zvh2MNw9YH2IU4GBU4uFdUTMlVIg1say4MvcQoynQhonM UqLJ+cAoySuJNzQ2M7IwNTE1NjK3NFMS502Q+hksJJCeWJKanZpakFoUX1Sak1p8iJGJg1Oq gdFSM2zFhJiQ46tfztnkWdq98YrKqp3rpSewKzILRbXczZ5aKHDqFtt3jajjCwTf/mjzzZ25 buOdVwxndny1OxUuMePO8uru8ovvpGszHH7Y7+87r11crfJplnhdi92lzBJ7wWV9rkVbTx9V SjfdOTuq/tSj0KtrZKOt2n+r1ZpeTT7yu/Vu8xwlluKMREMt5qLiRAASW507WgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRmVeSWpSXmKPExsVy+t9jAd0k46mhBtOWalpc+fqezWLpjD5W i0n3J7BYvLh3kcVi7ZG77BYzJr9kc2DzuN99nMmjb8sqxgCmqAZGm4zUxJTUIoXUvOT8lMy8 dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zBygpUoKZYk5pUChgMTiYiV9O0wTQkPc dC1gGiN0fUOC4HqMDNBAwhrGjHVHbjEXHDSoWP7nJGMD4zXNLkZODgkBE4ljXyezQNhiEhfu rWcDsYUEFjFKHNlT1cXIBWT/YJQ48OMDO0iCTUBP4s6240wgtoiAssTfiasYQWxmgTqJw9d+ MYPYwgLeEp9f/QarZxFQlTi1+A1YDa+Au8SJlsdMEMvkJE4em8wKYnMKeEh077rECrHYXeLZ 8jVMExh5FzAyrGIUTS1ILihOSs810itOzC0uzUvXS87P3cQIjo9n0jsYVzVYHGIU4GBU4uFd UTMlVIg1say4MvcQowQHs5II72SuqaFCvCmJlVWpRfnxRaU5qcWHGE2BrprILCWanA+M3byS eENjEzMjSyNzQwsjY3Mlcd6T+T6hQgLpiSWp2ampBalFMH1MHJxSDYzpG64fu7Hgp2N/V2rV gcAZt7+XSMwuNnt3oOTgski98+4ls7ZUKEyI/XJ5a7hc+49MZZ6+eM+SxXLFgWJbj0esN/5v /NyK70RtrvTjl8K5fJO2Hwzu+ek8uyaIL9pUINpzV1jU4slbwjhy1C9efmGz5Mbnics6F/X0 9Fmo++la3PTs3cojxKDEUpyRaKjFXFScCACziAN7pQIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: sw0312.kim@samsung.com, m.szyprowski@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Already drm_iommu_attach_device checks whether support iommu internally. It should clear channels always regardless iommu support. We didn't know because we can detect the problem when iommu is enabled, so we don't have to use drm_iommu_attach_device_if_possible and then we can remove drm_iommu_attach_device_if_possible and clear_channels function pointer. Signed-off-by: Joonyoung Shim Tested-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 5 +++-- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 5 +++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 - drivers/gpu/drm/exynos/exynos_drm_fimd.c | 5 +++-- drivers/gpu/drm/exynos/exynos_drm_iommu.c | 11 ----------- drivers/gpu/drm/exynos/exynos_drm_iommu.h | 11 ----------- drivers/gpu/drm/exynos/exynos_mixer.c | 3 +-- 7 files changed, 10 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index ba43437..b2794f8 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c @@ -463,7 +463,6 @@ static struct exynos_drm_crtc_ops decon_crtc_ops = { .win_commit = decon_win_commit, .win_disable = decon_win_disable, .te_handler = decon_te_irq_handler, - .clear_channels = decon_clear_channels, }; static int decon_bind(struct device *dev, struct device *master, void *data) @@ -497,7 +496,9 @@ static int decon_bind(struct device *dev, struct device *master, void *data) goto err; } - ret = drm_iommu_attach_device_if_possible(ctx->crtc, drm_dev, dev); + decon_clear_channels(ctx->crtc); + + ret = drm_iommu_attach_device(drm_dev, dev); if (ret) goto err; diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 2c29635..a80b918 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -126,7 +126,9 @@ static int decon_ctx_initialize(struct decon_context *ctx, ctx->drm_dev = drm_dev; ctx->pipe = priv->pipe++; - ret = drm_iommu_attach_device_if_possible(ctx->crtc, drm_dev, ctx->dev); + decon_clear_channels(ctx->crtc); + + ret = drm_iommu_attach_device(drm_dev, ctx->dev); if (ret) priv->pipe--; @@ -622,7 +624,6 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { .wait_for_vblank = decon_wait_for_vblank, .win_commit = decon_win_commit, .win_disable = decon_win_disable, - .clear_channels = decon_clear_channels, }; diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index dd00f16..7da593f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -177,7 +177,6 @@ struct exynos_drm_crtc_ops { void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); void (*te_handler)(struct exynos_drm_crtc *crtc); void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); - void (*clear_channels)(struct exynos_drm_crtc *crtc); }; /* diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 300730c..8d362b9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -887,7 +887,6 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = { .win_disable = fimd_win_disable, .te_handler = fimd_te_handler, .clock_enable = fimd_dp_clock_enable, - .clear_channels = fimd_clear_channels, }; static irqreturn_t fimd_irq_handler(int irq, void *dev_id) @@ -957,7 +956,9 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) if (ctx->display) exynos_drm_create_enc_conn(drm_dev, ctx->display); - ret = drm_iommu_attach_device_if_possible(ctx->crtc, drm_dev, dev); + fimd_clear_channels(ctx->crtc); + + ret = drm_iommu_attach_device(drm_dev, dev); if (ret) priv->pipe--; diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/drivers/gpu/drm/exynos/exynos_drm_iommu.c index 4c2ec1b..055e8ec 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.c +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.c @@ -142,14 +142,3 @@ void drm_iommu_detach_device(struct drm_device *drm_dev, iommu_detach_device(mapping->domain, subdrv_dev); drm_release_iommu_mapping(drm_dev); } - -int drm_iommu_attach_device_if_possible(struct exynos_drm_crtc *exynos_crtc, - struct drm_device *drm_dev, struct device *subdrv_dev) -{ - if (is_drm_iommu_supported(drm_dev)) { - if (exynos_crtc->ops->clear_channels) - exynos_crtc->ops->clear_channels(exynos_crtc); - } - - return drm_iommu_attach_device(drm_dev, subdrv_dev); -} diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h b/drivers/gpu/drm/exynos/exynos_drm_iommu.h index a90357f..dc1b544 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h @@ -34,10 +34,6 @@ static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) return dev->archdata.mapping ? true : false; } -int drm_iommu_attach_device_if_possible( - struct exynos_drm_crtc *exynos_crtc, struct drm_device *drm_dev, - struct device *subdrv_dev); - #else static inline int drm_create_iommu_mapping(struct drm_device *drm_dev) @@ -65,12 +61,5 @@ static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) return false; } -static inline int drm_iommu_attach_device_if_possible( - struct exynos_drm_crtc *exynos_crtc, struct drm_device *drm_dev, - struct device *subdrv_dev) -{ - return 0; -} - #endif #endif diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 1a01c48..8c461b1 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -881,8 +881,7 @@ static int mixer_initialize(struct mixer_context *mixer_ctx, } } - ret = drm_iommu_attach_device_if_possible(mixer_ctx->crtc, drm_dev, - mixer_ctx->dev); + ret = drm_iommu_attach_device(drm_dev, mixer_ctx->dev); if (ret) priv->pipe--;