dma_alloc_coherent fails in framebuffer

Bob Liu lliubbo at gmail.com
Tue Oct 16 22:26:07 EDT 2012


On Tue, Oct 16, 2012 at 10:41 PM, James Bottomley
<James.Bottomley at hansenpartnership.com> wrote:
> On Tue, 2012-10-16 at 10:17 +0800, Bob Liu wrote:
>> I think you need to declare that memory using
>> dma_declare_coherent_memory() before
>> alloc_from_coherent.
>
> This isn't true.  Almost every platform has a mechanism for
> manufacturing coherent memory (in the worst case, they just turn off the
> CPU cache on a page and hand it out).  The purpose of
> dma_declare_coherent_memory() is to allow a per device declaration of
> preferred regions ... usually because they reside either on the fast
> path to the device or sometimes on the device itself.  There are only a
> handful of devices which need it, so in the ordinary course of events,
> dma_alloc_coherent() is used without any memory declaration.
>

Sorry for my ambiguity.
It obviously true we can use dma_alloc_coherent() without any memory
declaration.

I thought Tony's original idea was want to make
dma_alloc_from_coherent() return success.
But the dev->dma_mem check can't pass, so i suggested him using
dma_declare_coherent_memory()
to declare per-device area first.

Thanks,
--Bob



More information about the linux-arm-kernel mailing list