linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* How to handle cache when I allocate phys memory?
@ 2011-10-12 21:08 Ayman El-Khashab
  2011-10-14  7:39 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Ayman El-Khashab @ 2011-10-12 21:08 UTC (permalink / raw)
  To: linuxppc-dev

I'm using the 460sx (440 core) so no snooping here.  What
I've done is reserved the top of memory for my driver.  My
driver can read/write the memory and I can mmap it just
fine.  The problem is I want to enable caching on the mmap
for performance but I don't know / can't figure out how to
tell the kernel to sync the cache after it gets dma data
from the device or after i put data into it from user space.
I know how to do it from regular devices, but not when I've
allocated the physical memory myself.  I suppose what I am
looking for is something akin to dma_sync_single cpu/device.

In my device driver, I am allocating the memory like this, 
in this case the buffer is about 512MB.

 vma->vm_flags |= VM_LOCKED | VM_RESERVED;

 /* map the physical area into one buffer */
 rc = remap_pfn_range(vma, vma->vm_start, 
                         (PHYS_MEM_ADDR)>>PAGE_SHIFT, 
                         len, vma->vm_page_prot);

Is this going to give me the best performance, or is there
something more I can do?

Failing that, what is the best way to do this (i need a very
large contiguous buffer).  it runs in batch mode, so it
DMAs, stops, cpu reads, cpu writes, repeat ...

thanks
ayman

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

end of thread, other threads:[~2012-02-24  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 21:08 How to handle cache when I allocate phys memory? Ayman El-Khashab
2011-10-14  7:39 ` Benjamin Herrenschmidt
2012-02-23 23:13   ` Ayman El-Khashab

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