Re: [PATCH v2] staging: ion: Add a default struct device for cma heap

From: Feng Tang
Date: Sun Aug 09 2015 - 05:03:23 EST


On Sat, Aug 08, 2015 at 12:39:48PM +0200, Michal Nazarewicz wrote:
> On Fri, Aug 07 2015, Feng Tang wrote:
> > For ion cma heap, the buffer allocation func ion_cma_allocate() will
> > call dma_alloc_coherent(dev, ...). And dma_alloc_coherent() is
> > implemented by each architeture(arm/m68k/x86 etc), and many Arch's
> > implementation doesn't use cma, but use alloc_pages() like APIs.
>
> So what youâre saying is that âION CMA heapâ is a misnomer since it has
> to do with CMA only if given architecture implements dma_alloc_coherent
> using CMA. It should rather be called âION DMA coherent heapâ.

> This leads to realisation that the code should be oblivious to CMA areas
> and never operate on them directly (e.g. never accept struct cma * or
> use dev_set_cma_area). In the current form, if architecture does not
> use CMA, the whole dev_set_cma_area shenanigans are pointless.

I'm not very familiar with the history of ion cma code, my guess is
there are quite a few Arch's are using ion/cma actually, but their
drivers are off mainline tree.

Like currently, many android devices are using ion (checking the
products on current market or reading code in Android AOSP code),
but the only ion platform driver sits in mainline is tegra_ion.c

And if a architecture doesn't use cma, then their ion platform
driver just simply does't set the "struct cma *"

Thanks,
Feng
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/