From patchwork Mon Jan 23 12:12:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9532419 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 C74DB6042F for ; Mon, 23 Jan 2017 12:21:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0B4226E82 for ; Mon, 23 Jan 2017 12:21:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A406E2831B; Mon, 23 Jan 2017 12:21:22 +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=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E76926E82 for ; Mon, 23 Jan 2017 12:21:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cVdcc-0002gB-4I; Mon, 23 Jan 2017 12:21:18 +0000 Received: from mail-pf0-f195.google.com ([209.85.192.195]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cVdc6-0002Gl-FT for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2017 12:20:47 +0000 Received: by mail-pf0-f195.google.com with SMTP id 19so9948052pfo.3 for ; Mon, 23 Jan 2017 04:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=ibMz3g89x6xkTZaURgLO9753mOO5guP+h8H04cCckXU=; b=PqApHrU9+q5uEmf0K9G7YYvClGpIfkGaxEpxyaKmIaasv54nt4PMH9qWlQPscX7tYI Lk/p/jENrkHpw2ckGFk4ZzOHgNNoZs2IIi57o3X7q/rd2+1r4717KGYXaaiR0GrhxtR6 3cfVCR+WjOqcvzMtJc3p5xk3iLJRjuTRMiGT6r2RwTojl6XXle9lbCt/3yIxiE/SrWWC IJNbp9BakMmQN1pDTxt85HsgWcuL26NKVwclsZdr40YOYPDCB688BUO1aM4pTCHPqK6G 7TmwapCXVKpyi7FC/1eQr3bjV0fpZmcMXDT8PClM5qlqfcmLNNLLAR7OWpnPNeUtRE6O kvhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=ibMz3g89x6xkTZaURgLO9753mOO5guP+h8H04cCckXU=; b=CTe/+AD3j629do17bgev8eIo/ujyJNIlCB9PnTtU3LxxoStQmGNTfrEDoG8XzBdORi Q3aosYRWckLVJx0uGb193LhD8pRxVBDoAL6iHK9JTvAhsuKYCtC3A2OAksMSdRDS8TP2 nqT5ldeXmrXbmJixefUDDZIk5UifNPLN1gl9g9DZ2IPS++IoGdN2qfEz+b0q8hylB/SK nNMEsf6SceYRBQhBDzJ7iIBABrEdewRH2a4/B2jXxKLHp8215QFzQi/SG87y/UNhPzeK xaa67cuDzmIAaTb1BUX1V0pJ7uPREyt5b8i4zS5Cpv95OPJJL0PYaC1VyNi1CRlHJz18 z5OA== X-Gm-Message-State: AIkVDXLGymdPW6K0PBQRaQmkRdTNFqJnlj3AZR6AjdCsRJMZ/+tCxAJr2he/CcfZTjx6aw== X-Received: by 10.84.168.131 with SMTP id f3mr2402088plb.163.1485173965517; Mon, 23 Jan 2017 04:19:25 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id c15sm36668255pfd.36.2017.01.23.04.18.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 04:18:46 -0800 (PST) From: Magnus Damm To: iommu@lists.linux-foundation.org Date: Mon, 23 Jan 2017 21:12:25 +0900 Message-Id: <148517354599.18128.1970642879780864733.sendpatchset@little-apple> In-Reply-To: <148517349585.18128.10696161017872202809.sendpatchset@little-apple> References: <148517349585.18128.10696161017872202809.sendpatchset@little-apple> Subject: [PATCH/RFC 2/2] iommu/ipmmu-vmsa: Opt-in slave devices based on ES version X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170123_042046_552193_944F7515 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, joro@8bytes.org, Magnus Damm , linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Match on r8a7795 ES2 and enable a certain DMA controller. In other cases the IPMMU driver remains disabled. Signed-off-by: Magnus Damm --- drivers/iommu/ipmmu-vmsa.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- 0001/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-01-23 20:57:02.620607110 +0900 @@ -23,6 +23,7 @@ #include #include #include +#include #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA) #include @@ -1002,16 +1003,39 @@ static void ipmmu_domain_free_dma(struct } } +static const struct soc_device_attribute r8a7795es2[] = { + { .soc_id = "r8a7795", .revision = "ES2.*" }, + { /* sentinel */ } +}; + +static int ipmmu_slave_whitelist(struct device *dev) +{ + /* Opt-in slave devices based on SoC and ES version */ + if (soc_device_match(r8a7795es2)) { + if (!strcmp(dev_name(dev), "e7310000.dma-controller")) + return 0; + } + + /* By default, do not allow use of IPMMU */ + return -ENODEV; +} + static int ipmmu_add_device_dma(struct device *dev) { struct ipmmu_vmsa_archdata *archdata = dev->archdata.iommu; struct iommu_group *group; + int ret; /* only accept devices with iommus property */ if (of_count_phandle_with_args(dev->of_node, "iommus", "#iommu-cells") < 0) return -ENODEV; + /* opt-in devices based on SoC and ES version */ + ret = ipmmu_slave_whitelist(dev); + if (ret) + return ret; + group = iommu_group_get_for_dev(dev); if (IS_ERR(group)) return PTR_ERR(group);