[Fwd: [parisc-linux] Problems with raw interface.]

Stephen C. Tweedie sct@redhat.com
22 Sep 2003 11:47:30 +0100


Hi,

On Mon, 2003-09-22 at 06:00, Grant Grundler wrote:

> BTW, I suspect the following code in 2.4.22 mm/memory.c:map_user_kiobuf()
> deals with this problem:
> 	...
>         while (pgcount--) {
> 	                /* FIXME: flush superflous for rw==READ,
> 			*  probably wrong function for rw==WRITE
> 			*/
> 			flush_dcache_page(iobuf->maplist[pgcount]);
> 	}
> 	...
> 
> [ I got here because rw_raw_dev() calls map_user_kiobuf().]

Well, it might do.  It depends on the architecture, and I know zip about
the parisc cache architecture.  

For writes, we may need to flush cache writes to ram before the IO to
ensure ram is up-to-date.  For reads. we may need to flush pending
writeback before the IO (to ensure that prior cache operations don't end
up being committed on top of the new IO), plus we need to flush the
entire region out of cache after the IO in order to make the new
contents visible.

Where that needs to be done will depend on whether your cache flush
instructions work from physical or virtual addresses.  brw_koivec() is
the place to deal with physical cache flushes and invalidations, as
that's where we do the low-level IO on the struct page.  But you'll need
to do it at a higher level within the raw.c driver itself if you need
access to the virtual addresses.

--Stephen