From patchwork Fri Jan 27 06:14:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9540619 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 4881F60429 for ; Fri, 27 Jan 2017 06:24:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3810727F85 for ; Fri, 27 Jan 2017 06:24:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CDE428112; Fri, 27 Jan 2017 06:24:28 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,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 C0B3427F85 for ; Fri, 27 Jan 2017 06:24:27 +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 1cWzxJ-0004KP-HL; Fri, 27 Jan 2017 06:24:17 +0000 Received: from mail-pf0-f193.google.com ([209.85.192.193]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWzvU-0002ww-EL for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2017 06:22:26 +0000 Received: by mail-pf0-f193.google.com with SMTP id e4so17894223pfg.0 for ; Thu, 26 Jan 2017 22:22:04 -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=FYTHXrIA9/o0I/mk9J51fx1N4Ko50RaRDUtEFmUzrxQ=; b=mJxAVuoh5lv9eIPfjueNbmO/5U11EIiczGWLEbSslcHIEzOq0GFl6/XT6cYylucvj+ irvWTtrj9Qk2qMFz6YXMUna6iKB0+7qDG6Xtlng5r55ctXL3tVhOggyH3JU08YrGyU6Q 28OTkKRLr0yB6sgcp+kJB80unGDlGa1vibLI18Fw1NTxYG/BGuFqSaOPDBwoHcqKUIOM Kgjc71yKga2OUZpaUERyTgbGj/dNYWbfKr4lRmMUmokgDqKkHmOc5ux9ye0GNH7Xy8ox 2kTQHg9N9MSQtrkigf6P0/oYVT4ut9i2eSr0GwcOYhuO32hhu4+f6dWgAIYZybaLSFkF f2bg== 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=FYTHXrIA9/o0I/mk9J51fx1N4Ko50RaRDUtEFmUzrxQ=; b=Re0yuly+DdNAkLtlMVWiJoocQ/HWoeOtkOial5GDBNQKF9ksGkAftWF6wV8+4lmomx XTf3jOqrEuRE+7CqcqRe3Xi2rg1/1K0QptcWcu5Eyf0SKpfJm0DnNDpGpW3M3TP4r4Ou lc26ljCUvoRLWN2ABmYBBc0SgMAUpSRKfmQqef94wsdRTMffTfqXy+PoBoUmI55mgeE3 DvFugpgGMR0N+FVtTdO2gNSQxL3sXhIiEOe79DliAEFw6uMBD4qbxDkN2lUOsM1rhoJL tfGs/PJ4fhD2JxRsvw/4lnuo6qsFy9+SQhwiX45diqiFtzpXnnZkC2A1KwLs6MbRVgFH Xgcg== X-Gm-Message-State: AIkVDXKXIuuEpkfFF+192Xp3SdICQsNr5edjHrKB8bQzAGsbFj2PZMktOqsLdfvMRRMg4w== X-Received: by 10.84.254.74 with SMTP id a10mr9855668pln.57.1485498063697; Thu, 26 Jan 2017 22:21:03 -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 i82sm7762789pfk.52.2017.01.26.22.21.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jan 2017 22:21:02 -0800 (PST) From: Magnus Damm To: iommu@lists.linux-foundation.org Date: Fri, 27 Jan 2017 15:14:45 +0900 Message-Id: <148549768562.22203.6722636560743534786.sendpatchset@little-apple> In-Reply-To: <148549764733.22203.16459470412085471955.sendpatchset@little-apple> References: <148549764733.22203.16459470412085471955.sendpatchset@little-apple> Subject: [PATCH/RFC v2 3/4] 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-20170126_222224_628717_A4BF157A X-CRM114-Status: GOOD ( 12.05 ) 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, robin.murphy@arm.com, 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 --- Changes since V1: - Perform white list check in ->xlate() instead of ->add_device() drivers/iommu/ipmmu-vmsa.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) --- 0009/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-01-27 13:14:47.470607110 +0900 @@ -23,6 +23,7 @@ #include #include #include +#include #if defined(CONFIG_ARM) && !defined(CONFIG_IOMMU_DMA) #include @@ -1032,9 +1033,33 @@ static void ipmmu_remove_device_dma(stru iommu_group_remove_device(dev); } +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_of_xlate_dma(struct device *dev, struct of_phandle_args *spec) { + int ret; + + /* Opt-in devices based on SoC and ES version */ + ret = ipmmu_slave_whitelist(dev); + if (ret) + return ret; + /* For now only tested on R-Car Gen3 with ARM64 arch init order * TODO: Test R-Car Gen2 with ARM32 arch init order */