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: 37450 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 75C632057E for ; Tue, 16 Sep 2014 11:55:23 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id mc6sf3135370lab.6 for ; Tue, 16 Sep 2014 04:55:22 -0700 (PDT) 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=YpQosTTtPB9seNCDVAsui0Wx8XnX+Zse3f/RXvBzPL4=; b=A/3hCacNeSHXe91R9n16rdHEjcsJ5+WDK4/OMv+X22tzYE5ONrK1y2/HkHvpmJGNK3 4b0xRYg59Lc3Sm9M4JIDIb/zGDm9fKs1RgazuYSo7pBt5dCzKw9aPYgkylauZ7f0zqRd jyfwyJ+EV1FlVxbIqqbAD2c76EDO5mX+qUs4Cmk+XHM0nSqJgyi9uysi+RNeEZodLUKw jrp/8gnmwRawARnG5v9WiQeciPtRKN8m+1/iE7WENmfWW9bFcr9GeiN97dYIr4ycwcVR 0xNA5qMBJKmgOzeCVUxdiI4TSYuJ4cmid3zh91RtwHRgJ7fu/F3hGzwAvPqTR4pBFeed cwow== X-Gm-Message-State: ALoCoQl3uyX1mSspuRksEwfyoZwUUDAHYBQOnMiLYiokGYsJgtf0fkyIhhgxNGEWMgW7C4vwY99t X-Received: by 10.180.198.172 with SMTP id jd12mr6578122wic.6.1410868520958; Tue, 16 Sep 2014 04:55:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.34 with SMTP id kv2ls443080lac.76.gmail; Tue, 16 Sep 2014 04:55:20 -0700 (PDT) X-Received: by 10.152.29.1 with SMTP id f1mr35409350lah.47.1410868520669; Tue, 16 Sep 2014 04:55:20 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx.google.com with ESMTPS id ba3si23786457lbc.92.2014.09.16.04.55.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 04:55:18 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.215.48; Received: by mail-la0-f48.google.com with SMTP id ty20so6602302lab.7 for ; Tue, 16 Sep 2014 04:55:18 -0700 (PDT) X-Received: by 10.152.179.226 with SMTP id dj2mr36504091lac.40.1410868518333; Tue, 16 Sep 2014 04:55:18 -0700 (PDT) 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.130.169 with SMTP id of9csp374294lbb; Tue, 16 Sep 2014 04:55:17 -0700 (PDT) X-Received: by 10.67.12.175 with SMTP id er15mr15295096pad.143.1410868516667; Tue, 16 Sep 2014 04:55:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zp8si29178866pac.130.2014.09.16.04.55.15 for ; Tue, 16 Sep 2014 04:55:16 -0700 (PDT) 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 S1754325AbaIPLzK (ORCPT + 6 others); Tue, 16 Sep 2014 07:55:10 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:26235 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754320AbaIPLzE (ORCPT ); Tue, 16 Sep 2014 07:55:04 -0400 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-samsung-soc@vger.kernel.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 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 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== 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=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 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);