linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Missing cache flush.
@ 2001-06-04 23:16 David Woodhouse
  2001-06-04 23:23 ` Jeff Garzik
                   ` (4 more replies)
  0 siblings, 5 replies; 34+ messages in thread
From: David Woodhouse @ 2001-06-04 23:16 UTC (permalink / raw)
  To: bjornw; +Cc: linux-kernel, linux-mtd

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



^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2001-06-08 16:04 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-04 23:16 Missing cache flush David Woodhouse
2001-06-04 23:23 ` Jeff Garzik
2001-06-04 23:29 ` David Woodhouse
2001-06-05  2:03 ` David S. Miller
2001-06-05  3:55   ` Chris Wedgwood
2001-06-05  5:28     ` Linus Torvalds
2001-06-05  6:49       ` Alan Cox
2001-06-05  8:29       ` Ingo Molnar
2001-06-05 15:10         ` Ralf Baechle
2001-06-05  8:46     ` David Woodhouse
2001-06-05  9:05       ` David Woodhouse
2001-06-05 12:42         ` David Woodhouse
2001-06-05 12:52           ` David Woodhouse
2001-06-05 12:48         ` David S. Miller
2001-06-06  8:32           ` Albert D. Cahalan
2001-06-06 19:48         ` Pavel Machek
2001-06-05  9:11       ` David S. Miller
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  8:50     ` David S. Miller
2001-06-05 17:01       ` Jamie Lokier
2001-06-05 23:24         ` Chris Wedgwood
2001-06-06  8:43           ` James Sutherland
2001-06-05  4:01   ` David S. Miller
2001-06-05  2:04 ` David S. Miller
2001-06-05  9:17 ` Bjorn Wesen
2001-06-05 12:57   ` Chris Wedgwood
2001-06-05 15:17     ` Ralf Baechle
2001-06-05 17:41     ` Daniel Phillips
2001-06-05 14:22   ` Vipin Malik
2001-06-05 14:40     ` Chris Wedgwood

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