LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Joshua Thompson <funaho@jurai.org>,
	Greg Ungerer <gerg@linux-m68k.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] m68k: set dma and coherent masks for Macintosh SONIC based ethernet
Date: Sun, 27 May 2018 13:01:11 +1000 (AEST)	[thread overview]
Message-ID: <alpine.LNX.2.21.1805271212480.9@nippy.intranet> (raw)
In-Reply-To: <1527378785-13326-1-git-send-email-linux@roeck-us.net>

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 <linux@roeck-us.net>

Acked-by: Finn Thain <fthain@telegraphics.com.au>

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 
can't be said to be "coherent" or "non-coherent". Moreover, DMA (direct 
memory access) concerns an IO device and a memory, not a cache, so the 
term "coherent dma" is bogus IMHO.

-- 

>  arch/m68k/mac/config.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
> index 0c3275aa0197..8e0476daddb8 100644
> --- a/arch/m68k/mac/config.c
> +++ b/arch/m68k/mac/config.c
> @@ -17,6 +17,7 @@
>  #include <linux/tty.h>
>  #include <linux/console.h>
>  #include <linux/interrupt.h>
> +#include <linux/dma-mapping.h>
>  /* keyb */
>  #include <linux/random.h>
>  #include <linux/delay.h>
> @@ -971,6 +972,15 @@ static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
>  	},
>  };
>  
> +static struct platform_device macsonic_dev = {
> +	.name           = "macsonic",
> +	.id             = -1,
> +	.dev            = {
> +		.dma_mask = &macsonic_dev.dev.coherent_dma_mask,
> +		.coherent_dma_mask = DMA_BIT_MASK(32),
> +	},
> +};
> +
>  int __init mac_platform_init(void)
>  {
>  	u8 *swim_base;
> @@ -1088,7 +1098,7 @@ int __init mac_platform_init(void)
>  
>  	if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
>  	    macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
> -		platform_device_register_simple("macsonic", -1, NULL, 0);
> +		platform_device_register(&macsonic_dev);
>  
>  	if (macintosh_config->expansion_type == MAC_EXP_PDS ||
>  	    macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
> -- 
> 2.7.4
> 

  reply	other threads:[~2018-05-27  3:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 23:53 [RFC PATCH] m68k: set dma and coherent masks for Macintosh SONIC based ethernet Guenter Roeck
2018-05-27  3:01 ` Finn Thain [this message]
2018-05-27  4:15   ` Guenter Roeck
2018-05-28  5:33     ` Christoph Hellwig
2018-05-27  5:22   ` Michael Schmitz
2018-05-27  5:49     ` Finn Thain
2018-05-28  5:20       ` Michael Schmitz
2018-05-28  5:26         ` Finn Thain
2018-05-28 10:15           ` Geert Uytterhoeven
2018-05-28 19:59             ` Michael Schmitz
2018-05-29  7:08               ` Christoph Hellwig
2018-05-29  2:15             ` Finn Thain
2018-05-29  3:23               ` Michael Schmitz
2018-05-29  5:38                 ` Finn Thain
2018-05-29  7:11                   ` Christoph Hellwig
2018-05-29 11:59                     ` Finn Thain
2018-05-29 20:10                   ` Michael Schmitz
2018-05-29 12:04             ` Finn Thain
2018-05-30  0:28             ` Greg Ungerer
2018-05-30 19:55               ` Geert Uytterhoeven
2018-05-31  0:38                 ` Greg Ungerer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.21.1805271212480.9@nippy.intranet \
    --to=fthain@telegraphics.com.au \
    --cc=funaho@jurai.org \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).