linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* mmap & no cache regions
@ 2001-11-13 21:41 Steve Rossi
  2001-11-16  5:39 ` Dan Malek
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Rossi @ 2001-11-13 21:41 UTC (permalink / raw)
  To: Embedded Linux PPC List


Hi All -

I'm writing a driver for custom hardware on an 8xx based system. I'm
using MontaVista's Journeyman 2.0 (2.4.2 kernel). The driver uses
consistent_alloc to allocate a region of memory which is used for DMA. I
mmap that region to user space (using remap_page_range) such that the
user-level application can directly access the data that has been DMA'd
from the device. I learned that consistent_alloc is not sufficent to
guarantee cache coherency on the mmaped region - in fact I had to mark
these pages PAGE_NO_CACHE in the user space application's memory map as
well. Having figured that out, it all works great now - but my question
is: do I need to pay attention to how I deallocate and unmap that
space? I use consistent_free in the driver so that takes care of marking
the pages cacheable again in the kernel level mapping - but is it safe
to assume that the application's memory map will be destroyed so I don't
have to worry about marking the pages in that map as cacheable again?

Thanks,
Steve

--
-------------------------------------------------------
Steven K. Rossi                     srossi@labs.mot.com
Staff Engineer
Multimedia Communications Research Laboratory
Motorola Labs
-------------------------------------------------------


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: mmap & no cache regions
  2001-11-13 21:41 mmap & no cache regions Steve Rossi
@ 2001-11-16  5:39 ` Dan Malek
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Malek @ 2001-11-16  5:39 UTC (permalink / raw)
  To: Steve Rossi; +Cc: Embedded Linux PPC List


Steve Rossi wrote:

> .....I learned that consistent_alloc is not sufficent to
> guarantee cache coherency on the mmaped region

Well, it has no clue about what you are doing.  It's purpose is to
ensure the kernel's mapping of that page is set properly.

> .... - in fact I had to mark
> these pages PAGE_NO_CACHE in the user space application's memory map as
> well.

Yep, that's because the kernel and applications have their own page
tables and page attributes.

> .....- but is it safe
> to assume that the application's memory map will be destroyed so I don't
> have to worry about marking the pages in that map as cacheable again?

I was about to write a couple of pages when it is best to answer this
with a simple "yes."  When the application releases this space, the page
tables are simply destroyed.  The kernel does it's weird attribute change
because it doesn't really "release" the page as an application does.  That's
all I'll say for now :-).

Thanks.


	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2001-11-16  5:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-13 21:41 mmap & no cache regions Steve Rossi
2001-11-16  5:39 ` Dan Malek

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