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: 9532401 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 A0C806042F for ; Mon, 23 Jan 2017 12:18:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81D5427C2D for ; Mon, 23 Jan 2017 12:18:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7599828304; Mon, 23 Jan 2017 12:18:50 +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 2E4CA27C2D for ; Mon, 23 Jan 2017 12:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751129AbdAWMSt (ORCPT ); Mon, 23 Jan 2017 07:18:49 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35388 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbdAWMSs (ORCPT ); Mon, 23 Jan 2017 07:18:48 -0500 Received: by mail-pg0-f68.google.com with SMTP id 204so13647658pge.2 for ; Mon, 23 Jan 2017 04:18:43 -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=CfT6uVkbJUIEZv0JOLIE69WWBYYOMshl1uUNPXO8DxBJ4DFDDHfDTyOie7dMTBn4oG YatfwpGKKdnmAL5HwPNwlcz460SYbDjazhr5SyHvV1p534hmc+Iklk2KnQ4OH4zi6DGl wqmUFJ6j8x6PrgVzDd4qYEkJNVIOgc0xCwPHq15NNedNFTcJjE99cz5bphj1iqdWd9nJ E/CqrqrW1QZBL9IbBZTliUjXP5evf0mgOL8+e8vXYiloRboBuwbDptEEzQ4eR/BjXWq7 7xfVPTTg7Bbdm4xGtMEkPhU1zNXb26wexkTN3OkE3HZpT4v4I/IH6PyFTSGakE3iLBL+ igBA== X-Gm-Message-State: AIkVDXLtL9lJ01ldYZJSprhJKM60X1DjtPdSFxPXEaoJ/34rfnutbOtZnlqkJ3jGGzNFbg== 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 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 , linux-arm-kernel@lists.infradead.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 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 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;