public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm•com>
To: Russell King - ARM Linux admin <linux@armlinux•org.uk>,
	Adrian Hunter <adrian.hunter@intel•com>,
	Will Deacon <will.deacon@arm•com>
Cc: linux-mmc@vger•kernel.org,
	Linux ARM <linux-arm-kernel@lists•infradead.org>
Subject: Re: [REGRESSION] sdhci no longer detects SD cards on LX2160A
Date: Tue, 17 Sep 2019 14:03:04 +0100	[thread overview]
Message-ID: <1406d22f-fd2e-f101-3efb-63cc52e9ac5f@arm.com> (raw)
In-Reply-To: <20190917123326.GN25745@shell.armlinux.org.uk>

On 17/09/2019 13:33, Russell King - ARM Linux admin wrote:
[...]
> Further debug shows:
> 
> coherent=0 - sdhci device is not cache coherent
> swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000081cac000
> [ffffff8010fd5200] pgd=000000237ffff003, pud=000000237ffff003,
> pmd=000000237fffb003, pte=00e800236d62270f
> 
> The mapping for the ADMA table seems to be using MAIR index 3, which is
> MT_MEMORY_NC, so should be non-cacheable.
> 
> vmallocinfo:
> 0xffffff8010fd5000-0xffffff8010fd7000    8192 dma_direct_alloc+0x4c/0x54
> user
> 
> So this memory has been remapped.  Could there be an alias that has
> cache lines still in the cache for the physical address, and could we
> be hitting those cache lines while accessing through a non-cacheable
> mapping?  (On 32-bit ARM, this is "unpredictable" and this problem
> definitely _feels_ like it has unpredictable attributes!)
> 
> Also, given that this memory is mapped NC, then surely
> __dma_flush_area() should have no effect?  However, it _does_ have the
> effect of reliably solving the problem, which to me implies that there
> _are_ cache lines in this NC mapping.

The non-cacheable mapping of the descriptor table will still have its 
cacheable linear map alias, so it's quite likely that the invalidate 
aspect of __dma_flush_area(), rather than the clean, is what's making 
the difference - if using __dma_clean_area() instead doesn't help, it 
would more or less confirm that.

One possibility in that case is that you might actually have the rare 
backwards coherency problem - if the device *is* actually snooping the 
cache, then it could hit lines which were speculatively prefetched via 
the cacheable alias before the descriptors were fully written, rather 
than the up-to-date data which went straight to RAM via the NC mapping. 
I'd try declaring the device as "dma-coherent" to see if that's actually 
true (and it should become pretty obvious if it isn't).

Robin.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-09-17 13:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16 17:15 [REGRESSION] sdhci no longer detects SD cards on LX2160A Russell King - ARM Linux admin
2019-09-16 22:57 ` Russell King - ARM Linux admin
2019-09-17  8:06 ` Marc Gonzalez
2019-09-17  8:19   ` Russell King - ARM Linux admin
2019-09-17 10:42     ` Russell King - ARM Linux admin
2019-09-17 11:16       ` Russell King - ARM Linux admin
2019-09-17 11:42         ` Russell King - ARM Linux admin
2019-09-17 12:33           ` Russell King - ARM Linux admin
2019-09-17 13:03             ` Robin Murphy [this message]
2019-09-17 13:28               ` Russell King - ARM Linux admin
2019-09-17 13:07             ` Russell King - ARM Linux admin
2019-09-17 13:24               ` Fabio Estevam
2019-09-17 13:33                 ` Russell King - ARM Linux admin
2019-09-17 13:43                   ` Fabio Estevam
2019-09-17 13:51                     ` Russell King - ARM Linux admin
2019-09-17 13:56                       ` Fabio Estevam
     [not found]                         ` <CADRPPNQ-WTY0QC7_bX=N0QeueKve=k0SaMvbjOrByyvzFojz2g@mail.gmail.com>
2019-09-19  4:13                           ` Y.b. Lu
2019-09-19  7:04                             ` Russell King - ARM Linux admin
2019-09-19  8:15                               ` Y.b. Lu
2019-09-19  8:38                                 ` Russell King - ARM Linux admin
2019-09-19  9:22                                   ` Russell King - ARM Linux admin
2019-09-17 13:38               ` Robin Murphy
2019-09-17 13:49                 ` Russell King - ARM Linux admin
2019-09-17 14:03                   ` Robin Murphy
2019-09-19  9:16                     ` Russell King - ARM Linux admin
2019-09-19 14:02                       ` Robin Murphy
2019-09-19 17:23                         ` Russell King - ARM Linux admin
2019-09-20  9:55                           ` Russell King - ARM Linux admin
2019-09-17 13:50                 ` Will Deacon
2019-09-17 13:55                   ` Robin Murphy
2019-09-17 14:12                     ` Russell King - ARM Linux admin

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=1406d22f-fd2e-f101-3efb-63cc52e9ac5f@arm.com \
    --to=robin.murphy@arm$(echo .)com \
    --cc=adrian.hunter@intel$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-mmc@vger$(echo .)kernel.org \
    --cc=linux@armlinux$(echo .)org.uk \
    --cc=will.deacon@arm$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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