home | list info | list archive | date index | thread index

[OCLUG-Tech] how to set "nocache" for mmap through /dev/mem ... can that even be done?

  it's been a while since i've looked at this, so forgive me for asking what
i *know* is a simple question. looking at user code that wants to access memory
associated with a physical device and, since it's a physical device, I/O needs
to disable caching.

currently, user space access is via (oh, yuck) mmap() call on /dev/mem, which
will, of course, map to the aforementioned memory but, as i read the code in
drivers/char/mem.c, mmap'ed memory based on /dev/mem is not set as
non-cacheable; there is a distinct lack of the call:

  vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

in the kernel mmap routine when accessing /dev/mem.

  i just want to confirm that there is no way to disable caching via the
mmap() call from user space; that is, there is no option in any mmap()
arguments from user space that will effectively disable caching -- that
*must* be done within kernel code using a line like the above.

  do i remember that correctly?

rday