1
votes

My understand is kernel page size is 4K. I want to allocate 16K continuous memory as my buffer for my driver. I used kmalloc() and it returns me a pointer (I assume the allocation is successful).

Does that mean the 16K is continuous?

And is the address I get from kmalloc() a virtual address? If I need to pass that address to a HW register, do I use a virtual address or a physical address?

1

1 Answers

2
votes

Yes - memory allocated with kmalloc is physically continous and the address is virtual address. Try virt_to_phys() macro to obtain physical address.