Subject: Re: minimum guaranteed alignment of dma_alloc_coherent?

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 29 Mar 2011 11:32:39 +1100

On Mon, 2011-02-07 at 09:13 -0600, Timur Tabi wrote:
> > 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?

GFP_DMA historically means ISA DMA memory on x86 :-) Other platforms had
different "use" for it but basically it's old style drivers.

The problem with dma_set_mask() is that there's no way without an iommu
that the implementation of dma_alloc_coherent() can satisfy arbitrary
masks since you don't control where the page allocator gets you the
pages from ... unless you have zones. That's what ZONE_DMA and
ZONE_DMA32 are for.

Cheers,
Ben.