Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Russell King - ARM Linux
On Mon, Jun 29, 2015 at 12:05:33PM +0100, Catalin Marinas wrote: > On Mon, Jun 29, 2015 at 11:46:04AM +0100, Russell King - ARM Linux wrote: > > The reason we always clear the buffer is that we can't be sure that a > > driver will not map a buffer allocated by dma_alloc_coherent() into > >

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Catalin Marinas
On Mon, Jun 29, 2015 at 11:46:04AM +0100, Russell King - ARM Linux wrote: > On Mon, Jun 29, 2015 at 11:37:37AM +0100, Catalin Marinas wrote: > > I forgot about the arm_dma_mmap fix here: > > > > https://lkml.org/lkml/2015/5/7/512 > > > > So we either fix both cases by changing __get_dma_pgprot()

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Russell King - ARM Linux
On Mon, Jun 29, 2015 at 11:37:37AM +0100, Catalin Marinas wrote: > I forgot about the arm_dma_mmap fix here: > > https://lkml.org/lkml/2015/5/7/512 > > So we either fix both cases by changing __get_dma_pgprot() or just go > for Mike's and your patches as above. It's up to Russell. I'd prefer

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Catalin Marinas
On Sun, Jun 28, 2015 at 10:14:43PM +0200, Lorenzo Nava wrote: > On Fri, Jun 26, 2015 at 6:25 PM, Catalin Marinas > wrote: > > On Thu, Jun 18, 2015 at 11:44:22PM +0200, Lorenzo Nava wrote: > >> @@ -680,9 +694,14 @@ void *arm_dma_alloc(struct device *dev, size_t size, > >> dma_addr_t *handle, > >>

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Catalin Marinas
On Sun, Jun 28, 2015 at 10:14:43PM +0200, Lorenzo Nava wrote: On Fri, Jun 26, 2015 at 6:25 PM, Catalin Marinas catalin.mari...@arm.com wrote: On Thu, Jun 18, 2015 at 11:44:22PM +0200, Lorenzo Nava wrote: @@ -680,9 +694,14 @@ void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Catalin Marinas
On Mon, Jun 29, 2015 at 11:46:04AM +0100, Russell King - ARM Linux wrote: On Mon, Jun 29, 2015 at 11:37:37AM +0100, Catalin Marinas wrote: I forgot about the arm_dma_mmap fix here: https://lkml.org/lkml/2015/5/7/512 So we either fix both cases by changing __get_dma_pgprot() or just go

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Russell King - ARM Linux
On Mon, Jun 29, 2015 at 12:05:33PM +0100, Catalin Marinas wrote: On Mon, Jun 29, 2015 at 11:46:04AM +0100, Russell King - ARM Linux wrote: The reason we always clear the buffer is that we can't be sure that a driver will not map a buffer allocated by dma_alloc_coherent() into userspace

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-29 Thread Russell King - ARM Linux
On Mon, Jun 29, 2015 at 11:37:37AM +0100, Catalin Marinas wrote: I forgot about the arm_dma_mmap fix here: https://lkml.org/lkml/2015/5/7/512 So we either fix both cases by changing __get_dma_pgprot() or just go for Mike's and your patches as above. It's up to Russell. I'd prefer the

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-28 Thread Lorenzo Nava
On Fri, Jun 26, 2015 at 6:25 PM, Catalin Marinas wrote: > On Thu, Jun 18, 2015 at 11:44:22PM +0200, Lorenzo Nava wrote: >> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c >> index 7e7583d..8e7f402 100644 >> --- a/arch/arm/mm/dma-mapping.c >> +++ b/arch/arm/mm/dma-mapping.c >>

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-28 Thread Lorenzo Nava
On Fri, Jun 26, 2015 at 6:25 PM, Catalin Marinas catalin.mari...@arm.com wrote: On Thu, Jun 18, 2015 at 11:44:22PM +0200, Lorenzo Nava wrote: diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 7e7583d..8e7f402 100644 --- a/arch/arm/mm/dma-mapping.c +++

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-26 Thread Catalin Marinas
On Thu, Jun 18, 2015 at 11:44:22PM +0200, Lorenzo Nava wrote: > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index 7e7583d..8e7f402 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -645,15 +645,29 @@ static void *__dma_alloc(struct device

Re: [RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-26 Thread Catalin Marinas
On Thu, Jun 18, 2015 at 11:44:22PM +0200, Lorenzo Nava wrote: diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 7e7583d..8e7f402 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -645,15 +645,29 @@ static void *__dma_alloc(struct device *dev,

[RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-18 Thread Lorenzo Nava
This patch allows the use of CMA for DMA coherent memory allocation. At the moment if the input parameter "is_coherent" is set to true the allocation is not made using the CMA, which I think is not the desired behaviour. Signed-off-by: Lorenzo Nava --- Changes in v2: correct __arm_dma_free()

[RFC PATCH v3] arm DMA: Fix allocation from CMA for coherent DMA

2015-06-18 Thread Lorenzo Nava
This patch allows the use of CMA for DMA coherent memory allocation. At the moment if the input parameter is_coherent is set to true the allocation is not made using the CMA, which I think is not the desired behaviour. Signed-off-by: Lorenzo Nava lorenx4@ --- Changes in v2: correct