From patchwork Mon Jan 23 12:12: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: 9532417 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 B0AD46042F for ; Mon, 23 Jan 2017 12:20:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B332282EC for ; Mon, 23 Jan 2017 12:20:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F75D2831B; Mon, 23 Jan 2017 12:20: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=-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 31600282EC for ; Mon, 23 Jan 2017 12:20:51 +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 1cVdc7-0002FI-2E; Mon, 23 Jan 2017 12:20:47 +0000 Received: from mail-pg0-f65.google.com ([74.125.83.65]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cVdbK-0000fP-Ju for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2017 12:20:00 +0000 Received: by mail-pg0-f65.google.com with SMTP id t6so13651625pgt.1 for ; Mon, 23 Jan 2017 04:19:38 -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=Gn0jDt4i4sKny2MxLcSShvHAQGnMc+YsLKzATb3DTiA=; b=Ct3JtcqFn7SyQixEbWaB9d3qF91j6/3HnNY9DJic2Id8H0VQbVAlrdszWWHNVoZ40e W2Wp8vh0zeaYP4aWQhw27a7OJstS7LuIhIomvBaSWF5l20D+kDAb4cTwwtAjy1MiFVO6 5CwmFXJid8r6RLWaPU9FEPU1BrEUSEEnM7emPMimQR6tHiGgzZdfj+UMSvJ081gGKgiy QEfwCUy+Z1HUZM/3AkXmmtf5UwKSQUtIqebeBf9u6PIHVdZL9oP2a8xjYP1AYeF5TOhf Ilvnsjv2WvwO1XURQthW8rz33Yy1Ogh+ned9NmdB0Y99mSwz+GUGQ4+hrF4KuT5W2UVW hxbg== 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=Gn0jDt4i4sKny2MxLcSShvHAQGnMc+YsLKzATb3DTiA=; b=IjfwxMVioYUbSeyS5PixvDhJHo2x4M3CEI8Db/PuKGPogmUdQvBcvb9Ei73Lr9zBxh +M+muXv+w4Eha9UV/tYXTk6k8Wiuf/1OWhczjUBt4UJyT8ufXIUx8d85ogGyiS6qF5h+ 3AzAr2CB4AXOmdR71WeSeryVxhbMI9a+dhJVnYL8sqUjUb7uKbOXj5ym3TOTBUOqCHbX a9cjWWjLq7vNKNTnX/n2TkjWsGEF4wKO81zkrZra7rhyqamPDl5rNO0dlxBqFRDeK30H G3gKCGJ3VFj+dAM7V/IVSZD9aLgDZc8ODHQV6oduhWgwgwGAK8esQOdYBIhO4lzrjniz YTYg== X-Gm-Message-State: AIkVDXJKhvn4K8qu4EYAKqubU9lbeooBTC2BVOAevk192C/bHOs+PBmnqQIP+Gat0jgmpQ== X-Received: by 10.98.19.12 with SMTP id b12mr31658431pfj.150.1485173917559; Mon, 23 Jan 2017 04:18:37 -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 p2sm36932989pgd.17.2017.01.23.04.18.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 04:18:36 -0800 (PST) From: Magnus Damm To: iommu@lists.linux-foundation.org Date: Mon, 23 Jan 2017 21:12:16 +0900 Message-Id: <148517353630.18128.12799811817831597628.sendpatchset@little-apple> In-Reply-To: <148517349585.18128.10696161017872202809.sendpatchset@little-apple> References: <148517349585.18128.10696161017872202809.sendpatchset@little-apple> Subject: [PATCH/RFC 1/2] arm64: mm: Silently allow devices lacking IOMMU group X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170123_041958_730800_82C71B18 X-CRM114-Status: GOOD ( 11.61 ) 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 Consider failure of iommu_get_domain_for_dev() as non-critical and get rid of the warning printout. This allows IOMMU properties to be included in the DTB even though the kernel is configured with CONFIG_IOMMU_API=n or in case a particular IOMMU driver refuses to enable IOMMU support for a certain slave device and returns error from the ->add_device() callback. This is only a cosmetic change that removes console warning printouts. Signed-off-by: Magnus Damm --- arch/arm64/mm/dma-mapping.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- 0001/arch/arm64/mm/dma-mapping.c +++ work/arch/arm64/mm/dma-mapping.c 2017-01-23 20:54:40.060607110 +0900 @@ -827,11 +827,19 @@ static bool do_iommu_attach(struct devic struct iommu_domain *domain = iommu_get_domain_for_dev(dev); /* + * In case IOMMU support is excluded from the kernel or if the device + * is not hooked up to any IOMMU group then be silent and keep the + * old dma_ops. + */ + if (!domain) + return false; + + /* * If the IOMMU driver has the DMA domain support that we require, * then the IOMMU core will have already configured a group for this * device, and allocated the default domain for that group. */ - if (!domain || iommu_dma_init_domain(domain, dma_base, size, dev)) { + if (iommu_dma_init_domain(domain, dma_base, size, dev)) { pr_warn("Failed to set up IOMMU for device %s; retaining platform DMA ops\n", dev_name(dev)); return false;