public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: bjornw@axis.com
Cc: linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Missing cache flush.
Date: Tue, 05 Jun 2001 00:16:47 +0100	[thread overview]
Message-ID: <13942.991696607@redhat.com> (raw)

The flash mapping driver arch/cris/drivers/axisflashmap.c uses a cached
mapping of the flash chips for bulk reads, but obviously an uncached mapping
for sending commands and reading status when we're actually writing to or
erasing parts of the chip.

However, it fails to flush the dcache for the range used when the flash is 
accessed through the uncached mapping. So after an erase or write, we may 
read old data from the cache for the changed area.

All the mapping driver needs to do is invalidate the dcache for the affected
area before the next copy_from() operation. No need to worry about writeback
in this case, because we never write to flash chips through the cached
mapping.

However, I can't see a cache operation which performs this function.
flush_dcache_page() is defined as a NOP on CRIS as, it seems, it is on most
architectures. On other architectures, there's dma_cache_wback_inv(), but
that also seems to be a NOP on i386, to pick a random example.

I'm aware that some architectures can't handle having both cached and
uncached mappings of the same physical range - so to prevent dismissal of
the question out of hand by people assuming all the world's a PeeCee -
consider the alternative situation where we have ROM or RAM chips in a paged
mapping such that only a 64K 'page' is visible by the CPU at a time
(remember XMS?). Using an uncached mapping is extremely suboptimal - all we
want to do is invalidate the cache when we change the page, or writeback 
and invalidate in the case of RAM.

I would have thought that's the function that dma_cache_wback_inv() is
supposed to perform - but it seems not to do so.

So how is this _supposed_ to be done?

I was pointed at Documentation/DMA-mapping.txt but that doesn't seem very
helpful - it's very PCI-specific, and a quick perusal of pci_dma_sync() on
i386 shows that it doesn't do what's required anyway.

--
dwmw2

             reply	other threads:[~2001-06-04 23:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-04 23:16 David Woodhouse [this message]
2001-06-04 23:23 ` Missing cache flush Jeff Garzik
2001-06-04 23:29   ` David Woodhouse
2001-06-05  2:04     ` David S. Miller
2001-06-05  2:03   ` David S. Miller
     [not found]     ` <20010605155550.C22741@metastasis.f00f.org>
2001-06-05  4:01       ` David S. Miller
2001-06-05  8:46         ` David Woodhouse
2001-06-05  8:50           ` David S. Miller
2001-06-05  9:05             ` David Woodhouse
2001-06-05  9:11               ` David S. Miller
2001-06-05 12:42                 ` David Woodhouse
2001-06-05 12:48                   ` David S. Miller
2001-06-05 12:52                     ` David Woodhouse
2001-06-06  8:32                     ` Albert D. Cahalan
2001-06-06 19:48               ` Pavel Machek
2001-06-05 17:01             ` Jamie Lokier
2001-06-05  9:29           ` kira brown
2001-06-05 17:16             ` Alan Cox
2001-06-06 19:44               ` Earyly Cyrix CPUs was " Pavel Machek
2001-06-08 16:00                 ` Alan Cox
2001-06-05  9:43           ` Johan Adolfsson
2001-06-05  9:17 ` Bjorn Wesen
2001-06-05 14:22   ` Vipin Malik
     [not found]   ` <20010606005703.A23758@metastasis.f00f.org>
2001-06-05 15:17     ` Ralf Baechle
     [not found] <20010606112419.A24800@metastasis.f00f.org>
2001-06-06  8:43 ` James Sutherland

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=13942.991696607@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=bjornw@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    /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