Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1097588imm; Sat, 26 May 2018 21:16:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp+QXF5b5hTxvXxyCAstFrRzQspggdC+25BumWjYU4mzXMK7MTL+AbZyBLCTK8O/CnmX7Dg X-Received: by 2002:a17:902:301:: with SMTP id 1-v6mr8743807pld.328.1527394567500; Sat, 26 May 2018 21:16:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527394567; cv=none; d=google.com; s=arc-20160816; b=uYJveaeKL5m/obYoyOldNzf3cgBABB+c7DexkLnzqnJ9YGlFpZzQAmkDozAHSl/N/m DNIanG4osgovibATbh7+N/UQeq58qHeUu5JW8uzve145fFmtdnfglk86YDBZtO5OZmZb zkYSUopISK1T5KzSyFvHz0X1rYd+6oYsK8dhVEhvMPWJtcAPbU/gbXG6qapaqFDgtinw BQp/fp51kbx4kyQiv5uQFSewx+qaQQh9Olmf7iRCduSdC++QUIMP5czVMaWdD9HQD9Iw jZJRQB7Dk8oRfHwjaPJuKK3quxK2yqM7w6zw9ZPDmzeIm7r7r32ckA/sG3f+rM3rgOj8 tcow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=MKWVGtkGBErEDIwPFVPFnHM0N/4aO2SbYfum1UZgJ9s=; b=AO5YX8d4Nh+jlpB+jlRP6aFU0W0TrTJKu8txHgKz106OK7cKJGanyTLllFweo5AbZk DJ3l29AH4tKTokN6Z+WSKonG2blNTzxGBEhPtxvQcf+ErVcq0aG2jfhRUUGE+y5lIIgD JXuGpHyBM1vUjSmo3iPcQ9T+uwD1/1SVvxdLaCk1XSyYqrOLMSLEpCWClesFPQbYg4Qj 3RwW56tKv125NSNneRrS1D8AhrvNGQ5eVZ8D044Np0eYUTtLTuRpI3lFAMaTCy5gWGdC A1/EAeyQ2cKQMLKULsIbOoeDA4lye5I/Sc2eIHu2Z+lWk/0mp8YbAVWBaM7r+ZeSAIPh Aj9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@roeck-us.net header.s=default header.b=c1MWUwse; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7-v6si21312286pga.473.2018.05.26.21.15.22; Sat, 26 May 2018 21:16:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@roeck-us.net header.s=default header.b=c1MWUwse; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755117AbeE0EPL (ORCPT + 99 others); Sun, 27 May 2018 00:15:11 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:43849 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbeE0EPJ (ORCPT ); Sun, 27 May 2018 00:15:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=In-Reply-To:Content-Type:MIME-Version:References :Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding :Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MKWVGtkGBErEDIwPFVPFnHM0N/4aO2SbYfum1UZgJ9s=; b=c1MWUwseGYfW9e+eSACEC+csLp EN0++SyCVyPQjvhvbDWyOPLELr09Pw5om6dnAfs+yHtejrn9xND62ZiZuhGFe55eOt5pFsK+QcJMm dJe5uK0Q37iQ9b1gsZqr/JT7erRmd3CJUZK6cASB3dN7k4InRs/cRfry3g+5MqrdcOLUQsycTpwea qCmpnwUm4+TdsHXl8V5UeqvSb/e/VhZF46L0T9Auj/Bklz2WfShnYiW/4Zph7wZ4JObKBiUjinjCo fRTgZ52vWJcZR5xolGscLvz5S5EFL0CWC7npTHIJ7cDVm+6ASEb74sRCPWpxTiKQM/wrklBModKbU KW0TSOdA==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:36588 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.89) (envelope-from ) id 1fMn5G-003uoX-7S; Sun, 27 May 2018 04:15:08 +0000 Date: Sat, 26 May 2018 21:15:05 -0700 From: Guenter Roeck To: Finn Thain Cc: Joshua Thompson , Greg Ungerer , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, Christoph Hellwig , iommu@lists.linux-foundation.org Subject: Re: [RFC PATCH] m68k: set dma and coherent masks for Macintosh SONIC based ethernet Message-ID: <20180527041505.GB31985@roeck-us.net> References: <1527378785-13326-1-git-send-email-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sun, May 27, 2018 at 01:01:11PM +1000, Finn Thain wrote: > On Sat, 26 May 2018, Guenter Roeck wrote: > > > As of commit 205e1b7f51e4 ("dma-mapping: warn when there is no > > coherent_dma_mask") the NatSemi SONIC Ethernet driver is issuing the > > following warning on driver initialization on Macintosh q800 systems. > > > > SONIC ethernet @50f0a000, MAC 08:00:07:12:34:56, IRQ 3 > > ------------[ cut here ]------------ > > WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 macsonic_init+0x6a/0x15a > > Modules linked in: > > CPU: 0 PID: 1 Comm: swapper Not tainted 4.17.0-rc6-mac-00286-g527f47c #1 > > Stack from 0781fdd8: > > 0781fdd8 003615b3 000181ba 000005c4 07a24cbc 00000000 00000000 000020e8 > > 07a24800 002c196c 0001824e 00334c06 00000204 001f782a 00000009 00000000 > > 00000000 003358d9 001f782a 00334c06 00000204 00000003 00000000 07a24800 > > 002b5cb6 000372ec 001f8b1a 07a24800 00359203 50f0a000 07a14a48 00000003 > > 00000000 07845c0a 0039dcca 003c835c 003c835c 0035b924 001c19de 07845c00 > > 07845c0a 0039dcca 001c06dc 07845c0a 0781fed8 00000007 0054d040 07845c0a > > Call Trace: [<000181ba>] __warn+0xc0/0xc2 > > [<000020e8>] do_one_initcall+0x0/0x140 > > [<0001824e>] warn_slowpath_null+0x26/0x2c > > [<001f782a>] macsonic_init+0x6a/0x15a > > [<001f782a>] macsonic_init+0x6a/0x15a > > [<002b5cb6>] memcmp+0x0/0x2a > > [<000372ec>] printk+0x0/0x18 > > [<001f8b1a>] mac_sonic_platform_probe+0x380/0x404 > > > > As per the warning the coherent_dma_mask is not set on this device. > > There is nothing special about the DMA memory coherency on this hardware > > so we can just set the mask to 32bits in the platform data for the FEC > > ethernet devices. > > > > Signed-off-by: Guenter Roeck > > Acked-by: Finn Thain > > Geert, assuming that Guenter's patch is acceptable, would you also accept > a similar patch for the "macmace" platform device? > > > --- > > Modeled after f61e64310b75 ("m68k: set dma and coherent masks for platform > > FEC ethernets"). > > > > RFC: Is "nothing special about the DMA memory coherency" correect ? > > > > As I understand it, "cache-coherence" is meaningless unless you have > multiple CPU cores and caches. If there's only one CPU core, its cache Good point. Maybe it would be better to limit the warning to SMP systems instead of (unnecessarily) fixing drivers all over the place ? Guenter --- From 9eea0e1b609b69094682757285fd7f89d3930a8e Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sat, 26 May 2018 21:08:39 -0700 Subject: [PATCH] dma-mapping: Warn about coherent_dma_mask only for SMP As of commit 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") is unconditional, even if the affected system is a single-CPU system where coherence is irrelevant. Limit the warning to SMP configurations to reduce the noise. Fixes: 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") Signed-off-by: Guenter Roeck --- include/linux/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index f8ab1c0f589e..ffbb39d84797 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -513,7 +513,7 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, void *cpu_addr; BUG_ON(!ops); - WARN_ON_ONCE(dev && !dev->coherent_dma_mask); + WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP) && dev && !dev->coherent_dma_mask); if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) return cpu_addr; -- 2.7.4