From patchwork Fri Oct 12 10:53:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10638459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 71E1569B4 for ; Fri, 12 Oct 2018 10:53:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61EB82BB2F for ; Fri, 12 Oct 2018 10:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5605E2BB49; Fri, 12 Oct 2018 10:53:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B802D2BB4D for ; Fri, 12 Oct 2018 10:53:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728086AbeJLSZq (ORCPT ); Fri, 12 Oct 2018 14:25:46 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:52646 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728108AbeJLSZp (ORCPT ); Fri, 12 Oct 2018 14:25:45 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181012105353euoutp02292343465eaac69ca4771b1657e1e0f9~c1w9eqrzy0750207502euoutp02R; Fri, 12 Oct 2018 10:53:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181012105353euoutp02292343465eaac69ca4771b1657e1e0f9~c1w9eqrzy0750207502euoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1539341633; bh=5n0hJ57zmVgnRbuguwGJjO+V+LpbBnEpfs4JfLk657I=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=siDFIcacWHQaHzoK7tcmv5yF8f9sBXr013D+cNKosiYjeHoc1G2F52VP2zjI8StU8 Nv6jcrBgWDceN85ODwDflXf1TROKaC3TMQMtfU0tgc+N36oWyqFrC0+hs+HWdrM9o/ 9vUzbUqJkeYBosv9PA98lY4lzZiGrtNx1ww7rm+M= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181012105353eucas1p100da4fc387c2e426d28d6ad8b415dd8c~c1w9E90Ki2595725957eucas1p1l; Fri, 12 Oct 2018 10:53:53 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 38.82.04806.04D70CB5; Fri, 12 Oct 2018 11:53:52 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181012105352eucas1p13627181190c88d0f295411082be12af2~c1w8YZkCn1532715327eucas1p10; Fri, 12 Oct 2018 10:53:52 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-eb-5bc07d403555 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E7.0B.04128.04D70CB5; Fri, 12 Oct 2018 11:53:52 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PGH00F8SFLQDI70@eusync3.samsung.com>; Fri, 12 Oct 2018 11:53:52 +0100 (BST) From: Andrzej Hajda To: Inki Dae Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 4/6] drm/exynos/iommu: move IOMMU specific stuff into exynos_drm_iommu.c Date: Fri, 12 Oct 2018 12:53:44 +0200 Message-id: <20181012105346.3754-5-a.hajda@samsung.com> X-Mailer: git-send-email 2.18.0 In-reply-to: <20181012105346.3754-1-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRmVeSWpSXmKPExsWy7djP87oOtQeiDR5eMLe4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3YHN4373cSaPvi2rGD0+b5ILYI7isklJzcksSy3St0vg ynj58DtTwWf1ivVX5zE3MP5U7GLk5JAQMJHofnSFtYuRi0NIYAWjxJuVfWwQzmdGiTMX97LD VD3+85UJIrGMUWLnjb+MEM5/Ronv7w6xgFSxCWhK/N18kw3EFhFQlli1r50dpIhZ4BKjxOuT 3YwgCWGBKIkvzSeYQGwWAVWJex2nWEFsXgFziUMLP7NBrJOXeHi8HayeU8BCYtm9gywggyQE vrJKfJkxjxWiyEVi++1WJghbWOLV8S1Qt8pIXJ7czQJh10s0zbzCDNHcwShxYvFyqA3WEoeP XwQbxCzAJzFp23SgIg6gOK9ER5sQhOkhsWxnBcSX3YwSW77uZ5nAKLmAkWEVo3hqaXFuemqx cV5quV5xYm5xaV66XnJ+7iZGYJSd/nf86w7GfX+SDjEKcDAq8fD+mLg/Wog1say4MvcQowQH s5II74KsA9FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeZfN2xgtJJCeWJKanZpakFoEk2Xi4JRq YOTo8RSdMGXehqqfvA7KH1itLAuf/khcOWGmYKe/jva+n5qyGqcKeibc3tgg8IXdzmDJF77L Mxa47Dg+falmEx+nXMPjzRqhcRZbOTJfxhYtLzfRE400D4v1cbNRPGCiEOnff2nuHRmfjJTs WP7/CtUFzsVJf+14rv+1aOX52zWhofXH8UYpJZbijERDLeai4kQAGqyfOq4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBJMWRmVeSWpSXmKPExsVy+t/xq7oOtQeiDT6eF7e4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3YHN4373cSaPvi2rGD0+b5ILYI7isklJzcksSy3St0vg ynj58DtTwWf1ivVX5zE3MP5U7GLk5JAQMJF4/OcrUxcjF4eQwBJGifcTH7KBJIQEGpkkrq4y A7HZBDQl/m6+CRYXEVCWWLWvnR2kgVngCqNE+7cudpCEsECUxJfmE0wgNouAqsS9jlOsIDav gLnEoYWf2SC2yUs8PN7OCGJzClhILLt3kAVimbnEwXmXWSYw8ixgZFjFKJJaWpybnltspFec mFtcmpeul5yfu4kRGB7bjv3csoOx613wIUYBDkYlHt4fE/dHC7EmlhVX5h5ilOBgVhLhXZB1 IFqINyWxsiq1KD++qDQntfgQozQHi5I473mDyighgfTEktTs1NSC1CKYLBMHp1QDo80UDunO Uuf3P8Vu+BYf+rS2YmLok+r7jOGVLx8nrry/7fd0LZfQA00z7lQ1XH1vOo1Bf3n0BrETr0rU 7JMi9z6SOb77/4O05xXKD2uiD955ovVhxV7R3DtHr3Iv2tSSuH9hj/+165OW6G/dJln7y2FZ 2TNlxcRjjq3l+a8d5nNLLY7zPcGyylyJpTgj0VCLuag4EQAO6yc8CwIAAA== X-CMS-MailID: 20181012105352eucas1p13627181190c88d0f295411082be12af2 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181012105352eucas1p13627181190c88d0f295411082be12af2 References: <20181012105346.3754-1-a.hajda@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since __exynos_iommu* functions are used only in exynos_drm_iommu.c we can move them there. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_iommu.c | 72 +++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_iommu.h | 72 ----------------------- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/drivers/gpu/drm/exynos/exynos_drm_iommu.c index 0f373702414e..564f1529d77e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.c +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.c @@ -18,6 +18,78 @@ #include "exynos_drm_drv.h" #include "exynos_drm_iommu.h" +#define EXYNOS_DEV_ADDR_START 0x20000000 +#define EXYNOS_DEV_ADDR_SIZE 0x40000000 + +#if defined(CONFIG_ARM_DMA_USE_IOMMU) +#include + +static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv, + unsigned long start, unsigned long size) +{ + priv->mapping = arm_iommu_create_mapping(&platform_bus_type, start, + size); + return IS_ERR(priv->mapping); +} + +static inline void +__exynos_iommu_release_mapping(struct exynos_drm_private *priv) +{ + arm_iommu_release_mapping(priv->mapping); +} + +static inline int __exynos_iommu_attach(struct exynos_drm_private *priv, + struct device *dev) +{ + if (dev->archdata.mapping) + arm_iommu_detach_device(dev); + + return arm_iommu_attach_device(dev, priv->mapping); +} + +static inline void __exynos_iommu_detach(struct exynos_drm_private *priv, + struct device *dev) +{ + arm_iommu_detach_device(dev); +} + +#elif defined(CONFIG_IOMMU_DMA) +#include + +static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv, + unsigned long start, unsigned long size) +{ + priv->mapping = iommu_get_domain_for_dev(priv->dma_dev); + return 0; +} + +static inline void __exynos_iommu_release_mapping(struct exynos_drm_private *priv) +{ + priv->mapping = NULL; +} + +static inline int __exynos_iommu_attach(struct exynos_drm_private *priv, + struct device *dev) +{ + struct iommu_domain *domain = priv->mapping; + + if (dev != priv->dma_dev) + return iommu_attach_device(domain, dev); + return 0; +} + +static inline void __exynos_iommu_detach(struct exynos_drm_private *priv, + struct device *dev) +{ + struct iommu_domain *domain = priv->mapping; + + if (dev != priv->dma_dev) + iommu_detach_device(domain, dev); +} +#else +#error Unsupported architecture and IOMMU/DMA-mapping glue code +#endif + static inline int configure_dma_max_seg_size(struct device *dev) { if (!dev->dma_parms) diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h b/drivers/gpu/drm/exynos/exynos_drm_iommu.h index 5aaece0a3a29..5eaec41514b4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h @@ -12,80 +12,8 @@ #ifndef _EXYNOS_DRM_IOMMU_H_ #define _EXYNOS_DRM_IOMMU_H_ -#define EXYNOS_DEV_ADDR_START 0x20000000 -#define EXYNOS_DEV_ADDR_SIZE 0x40000000 - #ifdef CONFIG_EXYNOS_IOMMU -#if defined(CONFIG_ARM_DMA_USE_IOMMU) -#include - -static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv, - unsigned long start, unsigned long size) -{ - priv->mapping = arm_iommu_create_mapping(&platform_bus_type, start, - size); - return IS_ERR(priv->mapping); -} - -static inline void -__exynos_iommu_release_mapping(struct exynos_drm_private *priv) -{ - arm_iommu_release_mapping(priv->mapping); -} - -static inline int __exynos_iommu_attach(struct exynos_drm_private *priv, - struct device *dev) -{ - if (dev->archdata.mapping) - arm_iommu_detach_device(dev); - - return arm_iommu_attach_device(dev, priv->mapping); -} - -static inline void __exynos_iommu_detach(struct exynos_drm_private *priv, - struct device *dev) -{ - arm_iommu_detach_device(dev); -} - -#elif defined(CONFIG_IOMMU_DMA) -#include - -static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv, - unsigned long start, unsigned long size) -{ - priv->mapping = iommu_get_domain_for_dev(priv->dma_dev); - return 0; -} - -static inline void __exynos_iommu_release_mapping(struct exynos_drm_private *priv) -{ - priv->mapping = NULL; -} - -static inline int __exynos_iommu_attach(struct exynos_drm_private *priv, - struct device *dev) -{ - struct iommu_domain *domain = priv->mapping; - - if (dev != priv->dma_dev) - return iommu_attach_device(domain, dev); - return 0; -} - -static inline void __exynos_iommu_detach(struct exynos_drm_private *priv, - struct device *dev) -{ - struct iommu_domain *domain = priv->mapping; - - if (dev != priv->dma_dev) - iommu_detach_device(domain, dev); -} -#else -#error Unsupported architecture and IOMMU/DMA-mapping glue code -#endif - int drm_create_iommu_mapping(struct drm_device *drm_dev); void drm_release_iommu_mapping(struct drm_device *drm_dev);