From patchwork Fri Jan 27 06:14:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9540613 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 7F7CB60429 for ; Fri, 27 Jan 2017 06:22:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EFD2280B0 for ; Fri, 27 Jan 2017 06:22:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63BE728174; Fri, 27 Jan 2017 06:22:45 +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 09981280B0 for ; Fri, 27 Jan 2017 06:22:45 +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 1cWzvl-0003BR-N0; Fri, 27 Jan 2017 06:22:41 +0000 Received: from mail-pg0-f68.google.com ([74.125.83.68]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWzv0-0002tL-FI for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2017 06:21:55 +0000 Received: by mail-pg0-f68.google.com with SMTP id 204so24230233pge.2 for ; Thu, 26 Jan 2017 22:21:34 -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=Aza4yrW7+t8iS2fqCJsZGOuqxAjZij7U/xcpenEeGYY=; b=nqBtn3Uo9JH83yB71CzzCh3sXL/eIuiFUivCW7o2aXnQ6avkNmnqQjBg6akWnTZrf8 3PgpAKRU7jrTAv7bLSlpruMbDGM5flk2u2nawC87pOgmNJwt6d18SJjxn4dq9S/GKWB5 gHWv0ks0F/kf8xIicIhSXHeW3EVPB0igoZowXB5Qnf7MIr9+fouqWEg7u4FbCqON4mcx crwyOQKkMKC8IFQBiZrJnhsGXoA6gnA50U2VbNWR0eku5PE/M3lRUZD4eliXsfS1FaeD lm61bGYWTABzzojPhhIrStRn7Wytkr8K0tu9c9hTMQiFf5bPwoDVQZ3KJeB4h5lgY9JT fyOQ== 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=Aza4yrW7+t8iS2fqCJsZGOuqxAjZij7U/xcpenEeGYY=; b=R0a0ukEqUO8QNw2rhIP4zRkt0/3d3To2h64OvSGdPpCOh2JX8do1fKK2kA7X3WM7xv 4iAsaeZQdrQtiDe0h3MB4WYHlCq++Ge/pZpQ/v9byR27y2ZiZKigQalxnGxXzD9r4Jyy /RIRZz4RdFcibYFPUndggYlyoVb8VNwRP2HXHbis7Ybp77EMG03KjtsiuFrMdfCErdA5 mYLDh6Lb2t112OH3z1MBlxDZUy6qWf1/sZ00YHT6JRH9VKiWTekCUtsWshnZKKqnzoJg JwB8PolSd9pfuuvtxW4qHKr0gkFmYpNPMUmmN5a7vOn25R0WqnhzUKIofaRXScJ2Vm2L i4SQ== X-Gm-Message-State: AIkVDXKaT4buhNSCgMBoeyLeGElrZ2dji3h56fa8vjbP2C2ovAsVdHhuhqxuTZqfD80eNw== X-Received: by 10.84.233.193 with SMTP id m1mr9967478pln.126.1485498033757; Thu, 26 Jan 2017 22:20:33 -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 i21sm7734468pfi.94.2017.01.26.22.20.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jan 2017 22:20:32 -0800 (PST) From: Magnus Damm To: iommu@lists.linux-foundation.org Date: Fri, 27 Jan 2017 15:14:16 +0900 Message-Id: <148549765644.22203.4025544332917256731.sendpatchset@little-apple> In-Reply-To: <148549764733.22203.16459470412085471955.sendpatchset@little-apple> References: <148549764733.22203.16459470412085471955.sendpatchset@little-apple> Subject: [PATCH/RFC v2 1/4] iommu/of: Skip IOMMU devices disabled in DT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170126_222154_558122_B6F78FF6 X-CRM114-Status: GOOD ( 10.17 ) 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 Extend the shared IOMMU code to skip over ->xlate() in case the IOMMU device pointed to by a slave device has been disabled in DT. Difficult to trigger in case a single IOMMU device is used, however when multiple IOMMUs are used and some of them are disabled in DT then this patch makes sure that ->xlate() only gets invoked for the enabled ones. Signed-off-by: Magnus Damm --- I used to keep this as a local check in the xlate() callback for the not-yet-merged-upstream R-Car Gen3 IPMMU driver stack. Since honoring DT disabled devices probably makes sense for most users it seems like a good plan to try to push it into the common subsystem level. Thanks to Geert for suggesting this ages ago. Developed on top of renesas-drivers-2017-01-24-v4.10-rc5 which includes a recent version of iommu/next. drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 0001/drivers/iommu/of_iommu.c +++ work/drivers/iommu/of_iommu.c 2017-01-27 13:19:22.540607110 +0900 @@ -159,7 +159,7 @@ const struct iommu_ops *of_iommu_configu np = iommu_spec.np; ops = of_iommu_get_ops(np); - if (!ops || !ops->of_xlate || + if (!ops || !ops->of_xlate || !of_device_is_available(np) || iommu_fwspec_init(dev, &np->fwnode, ops) || ops->of_xlate(dev, &iommu_spec)) goto err_put_node;