minimum guaranteed alignment of dma_alloc_coherent?

Timur Tabi timur at
Tue Feb 8 02:13:44 EST 2011

Dan Malek wrote:

> So, I did a little research.  It appears in the case of PowerPC,
> the GFP_DMA can change the way the allocation operates.
> Since the coherent allocator works with pages of memory,
> in the case of a system with highmem, not using GFP_DMA
> could hand you a physical page out of the highmem pool.

I think that's true only if SWIOTLB is enabled.  dma_direct_alloc_coherent()
does this:

	/* ignore region specifiers */
	flag  &= ~(__GFP_HIGHMEM);

> This behavior is modified if you specify a restricted DMA
> mask for the device.  In this case, dma_alloc_coherent
> will force GFP_DMA on your behalf (on PowerPC).

Isn't it required for all callers of dma_alloc_coherent to specify a mask (via
dma_set_mask) first?

Timur Tabi
Linux kernel developer at Freescale

Timur Tabi
Linux kernel developer at Freescale

More information about the Linuxppc-dev mailing list