From patchwork Mon Jun 6 03:58:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9157195 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2A1C360467 for ; Mon, 6 Jun 2016 04:10:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E78D27B13 for ; Mon, 6 Jun 2016 04:10:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10198281D2; Mon, 6 Jun 2016 04:10:03 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 C1B8027B13 for ; Mon, 6 Jun 2016 04:10:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753326AbcFFEJA (ORCPT ); Mon, 6 Jun 2016 00:09:00 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35762 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150AbcFFEIe (ORCPT ); Mon, 6 Jun 2016 00:08:34 -0400 Received: by mail-pf0-f193.google.com with SMTP id z187so2593924pfz.2; Sun, 05 Jun 2016 21:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=MLXOmsLk9/hZf0WzOxH545IKtr+bV3QFMYSJ+GIOOgE=; b=oprhbmHxwRhat8BXGBXFkHxy01ECmotyZHvV4/OyJihfRakaX8tsBYr92h4byRZux0 aYySmQlfJuns/AOTtxpGY/N/IAKL5tp48X1ocHxQC64ZO+X//4tqe9vVuju171chDE3E t+6RgArYBRve/wp0UcyMPgbagi3JP+Y7kqzi9mvcmoeUU4eRZNlQwP7GdPNfinRNOsXk /zxn7FTrMwHSqidx8Al54jcCb9ZkgUzPlKbyza8yfVEyRSDsISsoCiLqqrXERu9WOZ2G UQ5gA22eQxyfdrE+XeFztxXWw0sp0IZ6I84uSk4L3Vh2c/Ob1NVvLoLM2XGM4UMKT56e 2Nvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=MLXOmsLk9/hZf0WzOxH545IKtr+bV3QFMYSJ+GIOOgE=; b=cSzBX6TPDa09d7S3rdA/fE/uPSbHmJ0vkIiV+7zmHgmDxwKQPDn0C1358kt2Z1yitL iT+C96Ww5n6MmJ2rCQuijRlBaWGho7OTWFGVKUxPv/4w5++a4rQ666Pg3b7Al5IYkFaR nVygT5Bv51wI+HVncWfv30L8xePqB6p2CZRZy9ch7sw2HXnmcfT6pH7MaNaq/2Uk4WRk h8hCYBl7iK2qD0QcfAS63pWsyLdE2IfmGGNtzs3Ou2vLZZ65nx+3Bk/ESU1qveAJsHze SB2KN2YJRxA0R/+my+9vAnUsddxLXxD7ZY1G0k0PMcll1qpndml3Lb2nGnJqNk1Vaaz7 KqDg== X-Gm-Message-State: ALyK8tKcEsU2NDw4V+kYrRX4NvoSBi39VKk79qkrDwAmO5dNihgCZuBz+U0U69PU0ZEU1Q== X-Received: by 10.98.149.20 with SMTP id p20mr23055794pfd.95.1465186113537; Sun, 05 Jun 2016 21:08:33 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id 189sm19666579pfd.18.2016.06.05.21.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jun 2016 21:08:29 -0700 (PDT) From: Magnus Damm To: iommu@lists.linux-foundation.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, joro@8bytes.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm Date: Mon, 06 Jun 2016 12:58:10 +0900 Message-Id: <20160606035810.31763.53611.sendpatchset@little-apple> In-Reply-To: <20160606035723.31763.66500.sendpatchset@little-apple> References: <20160606035723.31763.66500.sendpatchset@little-apple> Subject: [PATCH v2 05/11] iommu/ipmmu-vmsa: Make use of IOMMU_OF_DECLARE() Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Hook up IOMMU_OF_DECLARE() support in case CONFIG_IOMMU_DMA is enabled. The only current supported case for 32-bit ARM is disabled, however for 64-bit ARM this is required. Signed-off-by: Magnus Damm --- Changes since V1: - Reworked slightly to fit updated patch order and [PATCH v3 00/06] iommu/ipmmu-vmsa: IPMMU multi-arch update V3 drivers/iommu/ipmmu-vmsa.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) --- 0015/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-06 10:57:26.790607110 +0900 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1178,15 +1179,22 @@ static struct platform_driver ipmmu_driv static int __init ipmmu_init(void) { + static bool setup_done; int ret; + if (setup_done) + return 0; + ret = platform_driver_register(&ipmmu_driver); if (ret < 0) return ret; +#if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA) if (!iommu_present(&platform_bus_type)) bus_set_iommu(&platform_bus_type, &ipmmu_ops); +#endif + setup_done = true; return 0; } @@ -1198,6 +1206,24 @@ static void __exit ipmmu_exit(void) subsys_initcall(ipmmu_init); module_exit(ipmmu_exit); +#ifdef CONFIG_IOMMU_DMA +static int __init ipmmu_vmsa_iommu_of_setup(struct device_node *np) +{ + static const struct iommu_ops *ops = &ipmmu_ops; + + ipmmu_init(); + + of_iommu_set_ops(np, (struct iommu_ops *)ops); + if (!iommu_present(&platform_bus_type)) + bus_set_iommu(&platform_bus_type, ops); + + return 0; +} + +IOMMU_OF_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa", + ipmmu_vmsa_iommu_of_setup); +#endif + MODULE_DESCRIPTION("IOMMU API for Renesas VMSA-compatible IPMMU"); MODULE_AUTHOR("Laurent Pinchart "); MODULE_LICENSE("GPL v2");