Thread (6 messages) 6 messages, 2 authors, 2011-02-22

allocating memory at boot

From: sk.syed2 <hidden>
Date: 2011-02-18 18:42:56

I have looked at the code for dma_alloc_coherent etc and it seems to me that
it's returning null because there isn't the space available to allocate the
requested memory.
You might have to increase the consistent(or dma) memory size. In
recent kernels its defined by  CONSISTENT_DMA_SIZE
(ach/arm/include/asm/memory.h). Which kernel version are you using?
You might have to override this value to match your needs. Are there
any other drivers that allocate using dma_alloc_coherent?
I was thinking that this might be the problem, but in order to do that I'd
have to put the alloc_bootmem in core kernel code wouldn't I? This doesn't
seem very appealing.
Yes. Nobody wants to do that. Best option is to use
dma_alloc_coherent. Alternatively you can use kmalloc in your driver
itself and then use dma_map_single/dma_unmap_single.
Yes, I was aware that dma uses physical addresses, isn't that what
alloc_bootmem returns? I'm not aware of dma_map_single etc I will look at
that soon.
No alloc_bootmem doesnt return physical addresses. It returns virtual
address. That is the reason you need to use dma_map_single and
dma_unmap_single. These apis return physical address(dma_addr_t) for
the corresponding virtual address. Also they flush/invalidate the
cache so there are no side effects.
  But dma_alloc_coherent gives you a memory whose cache lines are
disabled, so you wouldnt have to worry about caching side effects.

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