LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Christoph Hellwig <hch@lst.de>,
	Michael Schmitz <schmitzmic@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Joshua Thompson <funaho@jurai.org>,
	Greg Ungerer <gerg@linux-m68k.org>,
	linux-m68k <linux-m68k@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] m68k: set dma and coherent masks for Macintosh SONIC based ethernet
Date: Tue, 29 May 2018 12:15:05 +1000 (AEST)	[thread overview]
Message-ID: <alpine.LNX.2.21.1805291047230.13@nippy.intranet> (raw)
In-Reply-To: <CAMuHMdWXnP96p9swox6FXg2-2doeNGK+G9eQyZ-td+xWGSKKoQ@mail.gmail.com>

On Mon, 28 May 2018, Geert Uytterhoeven wrote:

> 
> Do we have a consensus on the way forward?

My prefered solution remains the two driver patches that I originally 
submitted, which you objected to:

https://lkml.org/lkml/2018/5/3/10
https://lkml.org/lkml/2018/5/3/9

So there is no consensus yet.

To my mind, the existing code is pretty clear: drivers should set the 
(default) mask. See also,

$ egrep -r -A1 "coherent_dma_mask.*expected" */
drivers/of/device.c:     * Set default coherent_dma_mask to 32 bit.  Drivers are expected to
drivers/of/device.c-     * setup the correct supported mask.
--
drivers/acpi/arm64/iort.c:       * Set default coherent_dma_mask to 32 bit.  Drivers are expected to
drivers/acpi/arm64/iort.c-       * setup the correct supported mask.
$ 

And drivers/usb/dwc2/platform.c:

        /*
         * Use reasonable defaults so platforms don't have to provide these.
         */
        if (!dev->dev.dma_mask)
                dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
        retval = dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32));

And FWIW,

$ egrep -wlr "dma_set_mask_and_coherent|dma_set_coherent_mask|dma_coerce_mask_and_coherent" drivers/ | wc -l
196

I suppose that a driver should avoid lengthening an existing device mask.

Since an arch gets to apply limits in the dma ops it implements, why would 
arch code also have to set a limit in the form of default platform device 
masks? Powerpc seems to be the only arch that does this.

The same line of reasoning suggests that the problematic WARN_ON should 
not appear in include/linux/ in the first place. If it is needed by 
certain architectures, it should be in arch/x.

I would send a patch to revert commit 205e1b7f51e4 ("dma-mapping: warn 
when there is no coherent_dma_mask") if I thought that arch code was not 
somehow relying on it. But I'll leave that up to Chrisoph.

-- 

  parent reply	other threads:[~2018-05-29  2:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 23:53 Guenter Roeck
2018-05-27  3:01 ` Finn Thain
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 [this message]
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.1805291047230.13@nippy.intranet \
    --to=fthain@telegraphics.com.au \
    --cc=funaho@jurai.org \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=schmitzmic@gmail.com \
    --subject='Re: [RFC PATCH] m68k: set dma and coherent masks for Macintosh SONIC based ethernet' \
    /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

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).