From patchwork Tue Sep 16 11:54:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 4917511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 475449F2EC for ; Tue, 16 Sep 2014 11:56:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA6BB200CC for ; Tue, 16 Sep 2014 11:58:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 32561200E8 for ; Tue, 16 Sep 2014 11:58:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTrMv-00061h-A9; Tue, 16 Sep 2014 11:56:25 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTrLr-000414-20 for linux-arm-kernel@lists.infradead.org; Tue, 16 Sep 2014 11:55:21 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBZ00NUIT8L5080@mailout1.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 16 Sep 2014 12:57:58 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-01-54182516db5d Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 76.9C.15956.61528145; Tue, 16 Sep 2014 12:55:02 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBZ00CMIT3CL960@eusync2.samsung.com>; Tue, 16 Sep 2014 12:55:02 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 12/18] iommu: exynos: add support for binding more than one sysmmu to master device Date: Tue, 16 Sep 2014 13:54:39 +0200 Message-id: <1410868485-4143-13-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> References: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xK7piqhIhBl2rtCz+TjrGbjFx5WRm i0n3J7BYLNhvbdE5ewO7Re+Cq2wWZ5vesFt0TlzCbvHlykMmi02Pr7FazDi/j8li7ZG77Ban rn9ms/jXe5DR4v+eHewWRx7uZrdYtesPo8Xt33wWLz+eYHEQ9nhycB6Tx5p5axg9fv+axOix c9Zddo/ZHTNZPTav0PLYtKqTzWPzknqP2/8eM3tMvrGc0ePKiSZWj97md2wefVtWMXp83iQX wBfFZZOSmpNZllqkb5fAlXFzzw+2gj+CFbdvn2JsYHzA18XIySEhYCLxfv5XdghbTOLCvfVs XYxcHEICSxkljq5uYoRw+pgklh56yQpSxSZgKNH1tosNxBYRyJd4sfcvC4jNLPCGReLeJsMu Rg4OYYEMiTMbw0HCLAKqEs+PngEr5xXwkDg/6xQTxDI5if8vV4DZnEDxyW1PmEFsIQF3iY/f TjFNYORdwMiwilE0tTS5oDgpPddIrzgxt7g0L10vOT93EyMkPr7uYFx6zOoQowAHoxIPb8Y/ 8RAh1sSy4srcQ4wSHMxKIrwaihIhQrwpiZVVqUX58UWlOanFhxiZODilGhjnpFYWHs3iDS+9 kLku5vF53jchIVNt2vmEFa6tzstZ9qTuR+/decUrVPiVjc8FdoRtilVsrGTNP/h7o1D3m5lb n3B0uW9UXNYmYnr/3Tn/Hb1p0gs83KY01S+9+1GHd7Ei7+SzP+OafmfLWfVo/uO6K3TtaIts 84o8ttv+31QL1jodtZIyYFViKc5INNRiLipOBACvOhrcbQIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140916_045519_296248_701696B9 X-CRM114-Status: GOOD ( 13.60 ) X-Spam-Score: -5.7 (-----) Cc: Rob Herring , Thierry Reding , Shaik Ameer Basha , Arnd Bergmann , Inki Dae , Joerg Roedel , Will Deacon , Tomasz Figa , linaro-mm-sig@lists.linaro.org, Kyungmin Park , Kukjin Kim , Laurent Pinchart , Olof Johansson , Cho KyongHo , David Wodhouse , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 This patch adds support for assigning more than one SYSMMU controller to the master device. This has been achieved simply by chaning the struct device pointer in struct exynos_iommu_owner into the list of struct sysmmu_drvdata of all controllers assigned to the given master device. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 1b3f00726cd4..cf36cdecf335 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -186,7 +186,7 @@ static char *sysmmu_fault_name[SYSMMU_FAULTS_NUM] = { /* attached to dev.archdata.iommu of the master device */ struct exynos_iommu_owner { - struct device *sysmmu; + struct list_head clients; }; struct exynos_iommu_domain { @@ -207,6 +207,7 @@ struct sysmmu_drvdata { spinlock_t lock; struct iommu_domain *domain; struct list_head domain_node; + struct list_head owner_node; phys_addr_t pgtable; int version; }; @@ -694,8 +695,7 @@ static int exynos_iommu_attach_device(struct iommu_domain *domain, if (!has_sysmmu(dev)) return -ENODEV; - data = dev_get_drvdata(owner->sysmmu); - if (data) { + list_for_each_entry(data, &owner->clients, owner_node) { ret = __sysmmu_enable(data, pagetable, domain); if (ret >= 0) { data->master = dev; @@ -723,7 +723,7 @@ static void exynos_iommu_detach_device(struct iommu_domain *domain, { struct exynos_iommu_domain *priv = domain->priv; phys_addr_t pagetable = virt_to_phys(priv->pgtable); - struct sysmmu_drvdata *data; + struct sysmmu_drvdata *data, *next; unsigned long flags; int found = 0; @@ -731,14 +731,13 @@ static void exynos_iommu_detach_device(struct iommu_domain *domain, return; spin_lock_irqsave(&priv->lock, flags); - list_for_each_entry(data, &priv->clients, domain_node) { + list_for_each_entry_safe(data, next, &priv->clients, domain_node) { if (data->master == dev) { if (__sysmmu_disable(data)) { data->master = NULL; list_del_init(&data->domain_node); } found = true; - break; } } spin_unlock_irqrestore(&priv->lock, flags);