mmap() of kernel space buffer problem

Juergen Hannappel (hannappe@lisa2.physik.uni-bonn.de)
07 Dec 1998 11:06:00 +0100


Hello,
in my VMEBus driver for the Universe PCI/VME Bridge i
encountered a strange problem:
I allocated (via __get_free_pages) a buffer in kernel space and
mmap()ed that into user space with the followin code in the mmap()
function of the driver:
retval = remap_page_range(vma->vm_start,
vma->vm_offset
+ virt_to_phys(p->DMA_buffer),
vma->vm_end - vma->vm_start,
vma->vm_page_prot);
Then i can do DMA transfers (PCI Busmaster DMA) from this buffer to
the VMEBus and in the other direction, from VME to the buffer.
If i transfer from VME to the buffer the data are in the buffer,
as a printk() in the driver shows --- but in the user space the
mmap()ed buffer still contains only zeroes, even if a mmap() after the
DMA transfer.
If i write from userspace into the mmap()ed buffer the data appear in
the kernel buffer and can also be transferred to the VMEBus. I am at
a loss about the cause, so please give a hint at what is wrong.

Thanks,
Juergen

-- 
$RCSfile: .signature,v $ $Revision: 1.14 $		 Phone: +49 228 73 2447
Dr. Juergen Hannappel		Office: W148		    FAX +49 228 73 7869
mailto:hannappe@lisa2.physik.uni-bonn.de   Physikalisches Institut der Uni Bonn
http://lisa2.physik.uni-bonn.de/~hannappe   Nussallee 12, D-53115 Bonn, Germany

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/