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: 9540605 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 D5E16604CC for ; Fri, 27 Jan 2017 06:21:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C648A280B0 for ; Fri, 27 Jan 2017 06:21:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD3C728174; Fri, 27 Jan 2017 06:21:51 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 5C9B527F85 for ; Fri, 27 Jan 2017 06:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753841AbdA0GVu (ORCPT ); Fri, 27 Jan 2017 01:21:50 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34234 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870AbdA0GVs (ORCPT ); Fri, 27 Jan 2017 01:21:48 -0500 Received: by mail-pg0-f67.google.com with SMTP id 3so6483725pgj.1 for ; Thu, 26 Jan 2017 22:20: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=kt9LC86IirGigCnrgheeoxfN6n3JqVLEnIyCe7NPAVWEt9+KcP8e6ZS5BXwvqu2HLY GKJiBZm/5o7Cbkky1Wc5HZJNgh+0Uuni+s5PRqn9r/uDh1Uj0vadsjU5GLWD0IYVQJwb FMNgG48TNuuCH8IA75GgmivrXDNl5LgGVm0rFg8T7aY+uI1bjXgI0rzQvFP7xcKlkMHg RerHLBNWIIFiGvHhS9cqderp6eLUL3aI0RfPZSFSxxG8qKad/PGXTquomWd+Wi813TBC vv94Uq2a+exWJsMERWd0IAfh9m1iMGRFWRUJuPVRudX6wMIZ2zpQ+ed3AxzcgZU5pOHr Ty+g== X-Gm-Message-State: AIkVDXLeAMAt8TeozUiqk1ug87bLquAGLIDWoJZEeefR0gVawuSVJqPinajs+Y4bbbG9gw== 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 Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, joro@8bytes.org, linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au, Magnus Damm , robin.murphy@arm.com, linux-arm-kernel@lists.infradead.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 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 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;