RE: Calculating kernel logical address ..

Alan Cox
2002-09-09T23:02:34Z

On Mon, 2002-09-09 at 23:52, Imran Badr wrote:
>
> But the buffer which I am concerned about was allocated my kmalloc() and
> mapped to the process space in mmap(). AFAIK, kmalloc'ed buffers are
> guaranteed to be mapped.

In which case its all nice and easy. You can safely use virt_to_bus on
the buffer in question (although for 2.5 you will need to use the pci
api). There is a nice clean worked example in each of the pci sound
drivers. Basically it goes

addr = kmalloc(blah)
phys_addr = virt_to_bus(addr)

and then use

remap_page_range(vma->vm_start, phys_addr, size, vma->vm_page_prot)

in the mmap function