Kmalloc returns which address

Misbah khan misbah_khan at
Fri Jul 20 20:52:21 EST 2007

hi Suresh

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 

for eg :-
char *buf_tx =kmalloc(100,GFP_KERNEL); // Tx buffer
char *buf_rx=kmalloc(100,GFP_KERNEL); // Rx buffer

ptr_tx=ioremap( buf_tx,100);

To learn more about this go through Linux device driver by rubini 

I hope this will work for you 

suresh suresh wrote:
> Hi,
> I am porting MPC8280 driver from vxWorks to Linux.
> I want know the address return by kmalloc function? is it physical address
> or kernel virtual address.
> 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 it returns kernel virtual address, then how to convert into physical?
> Thanks & Regards-
> Suresh
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded at

View this message in context:
Sent from the linuxppc-embedded mailing list archive at

More information about the Linuxppc-embedded mailing list