From patchwork Tue Aug 5 10:47:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 34934 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A391020523 for ; Tue, 5 Aug 2014 10:51:04 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id j7sf2035782qaq.1 for ; Tue, 05 Aug 2014 03:51:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=+yKsP1T1kbcvkkhlp8Thxb4bxiCFxNnSdqw4sxosMX4=; b=bJOAxlmJyNtkxXZgpnW7d+HE5TAPv/YQ2r0/PF7eA962hqknntvmvKuSzeMerPD6AI BiQTlcUg53ys97YvBZNQ+156VGZE7o8kFy4JU38agI7n8QpSjRc4J3Mi5do+CGChGtjL tAj8TMA1WfJuV/sVlAxOuXxuuyj2UexrYFAkxuYZCPz4QWCXYCRLhHB6VInkLk6Nvvfy LDWaeGrUdEM1p2lzUfttBL6mqtfOxOKim5sHziZdcfoK3MNHN9IZuofkeBGYVq1KRzYP hynAqffJ7gAJKJCLAh0u/jcxs7plKMxzhxeVPa7LQKwv/jD4tyHHHqWTZNsfFyUbsuWX xREA== X-Gm-Message-State: ALoCoQklQOalJQuKVxtkx3jb6sLHG+UKvc5yisgSK2ofb/0m6MNoIzuk/Ywt399sXr6OOgYbxcZd X-Received: by 10.236.202.143 with SMTP id d15mr1540800yho.18.1407235864514; Tue, 05 Aug 2014 03:51:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.11 with SMTP id 11ls197070qgm.98.gmail; Tue, 05 Aug 2014 03:51:04 -0700 (PDT) X-Received: by 10.52.83.227 with SMTP id t3mr2060499vdy.20.1407235864448; Tue, 05 Aug 2014 03:51:04 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id d10si773797veg.93.2014.08.05.03.51.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:51:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hy4so1116502vcb.13 for ; Tue, 05 Aug 2014 03:51:04 -0700 (PDT) X-Received: by 10.220.122.132 with SMTP id l4mr2285713vcr.41.1407235864327; Tue, 05 Aug 2014 03:51:04 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp374700vcb; Tue, 5 Aug 2014 03:51:03 -0700 (PDT) X-Received: by 10.224.172.129 with SMTP id l1mr4281163qaz.90.1407235863282; Tue, 05 Aug 2014 03:51:03 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id z40si2169520qge.32.2014.08.05.03.51.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:51:03 -0700 (PDT) Received-SPF: none (google.com: linaro-mm-sig-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEcKb-0005Xi-KV; Tue, 05 Aug 2014 10:51:01 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEcIo-0005Fd-S6 for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 10:49:10 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) 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 <0N9T006J5Y1V5L00@mailout3.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 11:49:07 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-df-53e0b6a4a571 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id CF.1C.25543.4A6B0E35; Tue, 05 Aug 2014 11:49:08 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N9T0057MY17SE80@eusync3.samsung.com>; Tue, 05 Aug 2014 11:49:08 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 05 Aug 2014 12:47:50 +0200 Message-id: <1407235677-26324-23-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRmVeSWpSXmKPExsVy+t/xq7pLtj0INvj3gd3i76Rj7BbNi9ez WUy6P4HFYsF+a4vO2RvYLXoXXGWzONv0ht2ic+ISdosvVx4yWWx6fI3V4vKuOWwWM87vY7JY e+Quu8Wp65/ZLP71HmS0OHP6EqvF/z072C0Ov2lntTjycDe7xapdfxgtbv/mcxD1eHJwHpPH 71+TGD12zrrL7jG7Yyarx6ZVnWwe++euYffYvKTe4/a/x8wek28sZ/S4cqKJ1aO3+R2bx5ar 7SwefVtWMXp83iQXwBfFZZOSmpNZllqkb5fAldG0/j1jwSfBirf9PawNjNf4uhg5OSQETCT+ /b/CDGGLSVy4t56ti5GLQ0hgKaPE+11nWUASQgJ9TBJTPmaA2GwChhJdb7vAikQEehkl+pt+ MIE4zALrWCX2914H6xAWSJXY1LwQzGYRUJVYur2dHcTmFfCUmHu3lxVinZzE/5crmEBsTqD4 4ZsHWCG2eUj83LCGfQIj7wJGhlWMoqmlyQXFSem5hnrFibnFpXnpesn5uZsYIZHzZQfj4mNW hxgFOBiVeHgNTt8NFmJNLCuuzD3EKMHBrCTCK7HmQbAQb0piZVVqUX58UWlOavEhRiYOTqkG xhlu83WcuiUjEjQql2rVmRh1f2c8cOSq1zreadceMU5xq1J7ssaMx3jVy4PpL91sd++491zp 8CSF98yzWT2/efo+eeR8z95y1q2H/kZzDr/jO16u97bH5FGVga35808ra1493dtQk/8lxMDh 1WFGiQnT3DfmfEqwn9FrYvavxNvZcwbXS8cV1UosxRmJhlrMRcWJACi7Orp6AgAA Cc: Rob Herring , Thierry Reding , Shaik Ameer Basha , Arnd Bergmann , Inki Dae , Greg Kroah-Hartman , Joerg Roedel , "Rafael J. Wysocki" , Tomasz Figa , linaro-mm-sig@lists.linaro.org, Kyungmin Park , Kukjin Kim , Laurent Pinchart , Sylwester Nawrocki , Olof Johansson , Cho KyongHo Subject: [Linaro-mm-sig] [PATCH 22/29] iommu: exynos: add support for binding more than one sysmmu to master device X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-mm-sig-bounces@lists.linaro.org Sender: linaro-mm-sig-bounces@lists.linaro.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.220.182 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 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 674d1fb..46e0edc 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -187,7 +187,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 { @@ -208,6 +208,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; }; @@ -695,8 +696,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; @@ -724,7 +724,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; @@ -732,14 +732,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);