LinuxPPC-Dev Archive on
 help / color / Atom feed
From: Rob Herring <>
To: Russell King - ARM Linux admin <>
Cc: Ulf Hansson <>,
	mad skateman <>,
	linux-mmc <>,
	Paul Mackerras <>,
	"R.T.Dickinson" <>,
	Christian Zigotzky <>,
	"" <>,
	linuxppc-dev <>,
	Christian Zigotzky <>
Subject: Re: Onboard SD card doesn't work anymore after the 'mmc-v5.4-2' updates
Date: Fri, 25 Oct 2019 17:28:45 -0500
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, Oct 23, 2019 at 9:32 AM Russell King - ARM Linux admin
<> wrote:
> On Wed, Oct 23, 2019 at 08:52:33AM -0500, Rob Herring wrote:
> > > I think this should have been done the other way around and default to
> > > coherent since most traditional OF platforms are coherent, and you
> > > can't just require those DTs to change.
> >
> > You can blame me. This was really only intended for cases where
> > coherency is configurable on a per peripheral basis and can't be
> > determined in other ways.
> >
> > The simple solution here is simply to use the compatible string for
> > the device to determine coherent or not.
> It really isn't that simple.

This doesn't work?:

        if (IS_ENABLED(CONFIG_PPC) || of_dma_is_coherent(dev->of_node))
                value |= ESDHC_DMA_SNOOP;
                value &= ~ESDHC_DMA_SNOOP;

While I said use the compatibles, using the kconfig symbol is easier
than sorting out which compatibles are PPC SoCs. Though if that's
already done elsewhere in the driver, you could set a flag and use
that here. I'd be surprised if this was the only difference between
ARM and PPC SoCs for this block.

> There are two aspects to coherency, both of which must match:
> 1) The configuration of the device
> 2) The configuration of the kernel's DMA API
> (1) is controlled by the driver, which can make the decision any way
> it pleases.
> (2) on ARM64 is controlled depending on whether or not "dma-coherent"
> is specified in the device tree, since ARM64 can have a mixture of
> DMA coherent and non-coherent devices.
> A mismatch between (1) and (2) results in data corruption, potentially
> eating your filesystem.  So, it's very important that the two match.
> These didn't match for the LX2160A, but, due to the way CMA was working,
> we sort of got away with it, but it was very dangerous as far as data
> safety went.
> Then, a change to CMA happened which moved where it was located, which
> caused a regression.  Reverting the CMA changes didn't seem to be an
> option, so another solution had to be found.
> I started a discussion on how best to solve this:
> and the solution that the discussion came out with was the one that has
> been merged - which we now know caused a regression on PPC.
> Using compatible strings doesn't solve the issue: there is no way to
> tell the DMA API from the driver that the device is coherent.  The
> only way to do that is via the "dma-coherent" property in DT on ARM64.
> To say that this is a mess is an under-statement, but we seem to have
> ended up here because of a series of piece-meal changes that don't seem
> to have been thought through enough.
> So, what's the right way to solve this, and ensure that the DMA API and
> device match as far as their coherency expectations go?  Revert all the
> changes for sdhci-of-esdhc and CMA back to 5.0 or 5.1 state?

The other option is similar to earlier in the thread and just add to

/* Powerpc is normally cache coherent DMA */
    return true;

We could do the all the weak arch hooks, but that seems like overkill
to me at this point.


  reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
     [not found] ` <>
     [not found]   ` <>
     [not found]     ` <>
     [not found]       ` <>
2019-10-23  5:42         ` Michael Ellerman
2019-10-23  6:41           ` Benjamin Herrenschmidt
2019-10-23 13:52             ` Rob Herring
2019-10-23 14:12               ` Russell King - ARM Linux admin
2019-10-23 14:31               ` Russell King - ARM Linux admin
2019-10-25 22:28                 ` Rob Herring [this message]
2019-10-26  6:39                   ` Christoph Hellwig
2019-10-28  8:47                     ` Benjamin Herrenschmidt
2019-10-28  8:45                   ` Benjamin Herrenschmidt
2019-10-23 14:20           ` Christian Zigotzky
2019-11-04 14:44             ` Christian Zigotzky
2019-11-05  7:50               ` Bug 205201 - overflow of DMA mask and bus mask Christian Zigotzky

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LinuxPPC-Dev Archive on

Archives are clonable:
	git clone --mirror linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ \
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone