Thread (8 messages) flat view 8 messages, 4 authors, 2007-07-24

Re: Kmalloc returns which address

From: Alessandro Rubini <hidden>
Date: 2007-07-20 12:27:51

Hello.
In linux kmelloc returns the pointer to virtual address not the physical
address, to return to the physical address there is different function
called ioremap 
Not exactly. Both return virtual addresses. The kmalloc one is allocated
RAM memory, the ioremap is the virtual address built for you to
access a physical address you specified (i.e., a device memory area).
quoted
For Tx and Rx, hardware uses buffers, so I have to allocate buffers and
pass
the pointer to hardware. Can I pass the pointer returned kmalloc?  or  I
should convert it into physical address?
If you allocate with kmalloc, use __pa(addr) to turn the virtual
address addr into the physical address you need to pass to the device,
ad DMA access is outside of the virtual view of the address space.

However, please note that according to how your device is connected
and what bus it is using, the design can get more hairy, you may need
to study the consistent memory allocations.

Hope this helps
/alessandro
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help