RE: Calculating kernel logical address ..

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Mon Sep 09 2002 - 18:09:53 EST


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

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



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:19 EST