1MB alignment dma_alloc question

Scott Wood scottwood at freescale.com
Sat Sep 6 07:30:33 EST 2008


Russell McGuire wrote:
> Putting together a driver, IMA for ATM in a MPC83xx. Anyway the manual
> states that one of the data structures for the QE needs to be allocated on a
> 1MB boundary in external memory.
> 
> Normally these come in 128/64/32byte boundaries and are easy to self align,
> with some bit logic. However, after reading up on dma_alloc_coherent I see
> that a limitation is that dma cannot span 64K page boundaries.

That sounds like something related to legacy PC DMA.  I doubt there's 
any such limitation in the API itself.

> So this begs a question is their a better way to get a 1MB aligned table?
> Other than allocating almost 2MB of memory and then trying to mask off the
> LSBs? Seems like an awful waste of memory. I guess the real question is
> there a better kernel call that returns already aligned DMA memory?

It looks like allocations will be naturally aligned on powerpc (due to 
coming straight from alloc_pages), though it's probably not guaranteed 
by the API.

-Scott


More information about the Linuxppc-embedded mailing list