From patchwork Wed Nov 19 11:15:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 41139 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA70020CBB for ; Wed, 19 Nov 2014 11:16:45 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id l15sf549138wiw.0 for ; Wed, 19 Nov 2014 03:16:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=WOyXKLPBp+zEFtmZs80y8IoC/WEt5hTfAFHAAkK8LBc=; b=G8sP4aXZCkBd5Y3I3msMKJp676X8e3SfOfhcPkBTyuyS0N8jUhmN6brzUYsrP9qQS+ m7qbVJxCQ2xD1mjIAS3OGSgty21TQkv52XbutHJz4fJ79z16/qe/U/gwktcSZVtPgZaV 9vzE1qvS0+/5QnKWPqkWltAtUxhrMz1WPOnXGVfgkoRwXajU489fWdR4GJ72k8nzl6VF CgyE8IP9R+NZ/A/yGbnkD3MLckv8VI1GDrwVJ7AbwxzvrSkzeRyrWIzVO1YcEPKAFRxP DXZmXdZQDOYTbBxBpV+rUUZoZIES+mYBSErT1IWlYrg0yz7D8qnIvzRYpzjQsYpW2g7v 4SiA== X-Gm-Message-State: ALoCoQmWaQaH39+l/1ghhHLRCD82ATGDFZQzkBzuTzuDQmObmFK9xpHAhDXzHjGwMbJwmQ0fVyuk X-Received: by 10.112.125.6 with SMTP id mm6mr937984lbb.8.1416395805092; Wed, 19 Nov 2014 03:16:45 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.202.166 with SMTP id kj6ls1197030lac.73.gmail; Wed, 19 Nov 2014 03:16:44 -0800 (PST) X-Received: by 10.112.159.129 with SMTP id xc1mr41962095lbb.24.1416395804939; Wed, 19 Nov 2014 03:16:44 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id jj7si1459128lbc.65.2014.11.19.03.16.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 03:16:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so302029lbv.12 for ; Wed, 19 Nov 2014 03:16:44 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr4730578lbo.32.1416395804846; Wed, 19 Nov 2014 03:16:44 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp64308lbc; Wed, 19 Nov 2014 03:16:43 -0800 (PST) X-Received: by 10.68.98.196 with SMTP id ek4mr19485819pbb.150.1416395800658; Wed, 19 Nov 2014 03:16:40 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xo9si2087857pbc.210.2014.11.19.03.16.39 for ; Wed, 19 Nov 2014 03:16:40 -0800 (PST) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754559AbaKSLQe (ORCPT + 4 others); Wed, 19 Nov 2014 06:16:34 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:23349 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754508AbaKSLQd (ORCPT ); Wed, 19 Nov 2014 06:16:33 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFA00LJMA4CZ340@mailout3.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 19 Nov 2014 11:19:24 +0000 (GMT) X-AuditID: cbfec7f5-b7f956d000005ed7-da-546c7c0f4ca2 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id D5.B2.24279.F0C7C645; Wed, 19 Nov 2014 11:16:31 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NFA00GC59YMTL30@eusync1.samsung.com>; Wed, 19 Nov 2014 11:16:31 +0000 (GMT) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , Will Deacon , David Wodhouse , Inki Dae , Kukjin Kim , Tomasz Figa , Kyungmin Park Subject: [PATCH v3 13/19] iommu: exynos: add support for binding more than one sysmmu to master device Date: Wed, 19 Nov 2014 12:15:42 +0100 Message-id: <1416395748-10731-14-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> References: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xy7r8NTkhBleXGVv8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK+PckbmMBX8EK1bc6GdqYHzA18XIySEhYCKx/fUZFghbTOLCvfVs XYxcHEICSxklLiy5yA7h9DFJfDi7nRmkik3AUKLrbRcbiC0ikC/xYu9fsG5mgTcsEvc2GYLY wgIZEis+TwGrYRFQlfh74wRYL6+Ap0TTzA9Q2+Qk/r9cwdTFyMHBCRS//gIsLCTgIdE0fR3r BEbeBYwMqxhFU0uTC4qT0nON9IoTc4tL89L1kvNzNzFC4uPrDsalx6wOMQpwMCrx8DYU54QI sSaWFVfmHmKU4GBWEuEtLgQK8aYkVlalFuXHF5XmpBYfYmTi4JRqYFwyZe+uytzg5wnX+z43 n1/t2L9n3rXL+ZZ5Njf2v3D+7lzktMb2wpX+ePnZGt+vPsgo1Qvg3ZK9cEp73JaYbe1RBom/ VjZ0uBt8Zny5Y1LRbBu2eCehP1vuSZ7Jrb0oklh0Puu28YOnRQ9X/TE5t87gpwRD9auz2lrr d+Rd3XbAr9jj6KrinUlKLMUZiYZazEXFiQAeOk/SbQIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 93b97df772f1..77dec32c59ef 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);