Patchwork ARM: i.mx35 increase dma consistent region size

login
register
mail settings
Submitter Alex Gershgorin
Date April 11, 2012, 6:01 p.m.
Message ID <1334167274-29524-1-git-send-email-alexg@meprolight.com>
Download mbox | patch
Permalink /patch/151847/
State New
Headers show

Comments

Alex Gershgorin - April 11, 2012, 6:01 p.m.
The default size of the consistent DMA region is 2MB
without this patch, attempt to allocate more than 2MB
is causing allocation failure

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
---
 arch/arm/mach-imx/mm-imx3.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Sascha Hauer - April 13, 2012, 2:40 p.m.
On Wed, Apr 11, 2012 at 09:01:14PM +0300, Alex Gershgorin wrote:
> The default size of the consistent DMA region is 2MB
> without this patch, attempt to allocate more than 2MB
> is causing allocation failure
> 
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-imx/mm-imx3.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
> index 7412738..a2c0c7d 100644
> --- a/arch/arm/mach-imx/mm-imx3.c
> +++ b/arch/arm/mach-imx/mm-imx3.c
> @@ -201,6 +201,7 @@ static struct map_desc mx35_io_desc[] __initdata = {
>  void __init mx35_map_io(void)
>  {
>  	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
> +	init_consistent_dma_size(SZ_8M);

I don't know what to think about this. You probably have a board with
camera support and thus need bigger buffers, right? Nevertheless this
patch affects all i.MX35 users, even the ones without camera support.

Another possibility would be to make this board specific.

Sascha
Guennadi Liakhovetski - April 13, 2012, 3:11 p.m.
On Fri, 13 Apr 2012, Sascha Hauer wrote:

> On Wed, Apr 11, 2012 at 09:01:14PM +0300, Alex Gershgorin wrote:
> > The default size of the consistent DMA region is 2MB
> > without this patch, attempt to allocate more than 2MB
> > is causing allocation failure
> > 
> > Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> > ---
> >  arch/arm/mach-imx/mm-imx3.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
> > index 7412738..a2c0c7d 100644
> > --- a/arch/arm/mach-imx/mm-imx3.c
> > +++ b/arch/arm/mach-imx/mm-imx3.c
> > @@ -201,6 +201,7 @@ static struct map_desc mx35_io_desc[] __initdata = {
> >  void __init mx35_map_io(void)
> >  {
> >  	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
> > +	init_consistent_dma_size(SZ_8M);
> 
> I don't know what to think about this. You probably have a board with
> camera support and thus need bigger buffers, right? Nevertheless this
> patch affects all i.MX35 users, even the ones without camera support.
> 
> Another possibility would be to make this board specific.

Isn't this what other (including i.MX3*) boards use arm_memblock_steal() 
for?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Alex Gershgorin - April 15, 2012, 2:15 p.m.
Hi Sascha,

Sorry was not possible to respond to you earlier. 

On Wed, Apr 11, 2012 at 09:01:14PM +0300, Alex Gershgorin wrote:
> The default size of the consistent DMA region is 2MB
> without this patch, attempt to allocate more than 2MB
> is causing allocation failure
>
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-imx/mm-imx3.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
> index 7412738..a2c0c7d 100644
> --- a/arch/arm/mach-imx/mm-imx3.c
> +++ b/arch/arm/mach-imx/mm-imx3.c
> @@ -201,6 +201,7 @@ static struct map_desc mx35_io_desc[] __initdata = {
>  void __init mx35_map_io(void)
>  {
>       iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
> +     init_consistent_dma_size(SZ_8M);

> > I don't know what to think about this. You probably have a board with
> > camera support and thus need bigger buffers, right? Nevertheless this
> > patch affects all i.MX35 users, even the ones without camera support.

Camera support is not an issue, this patch belongs only to those I.MX35 drivers who are using 
the dma coherent/writecombine allocations.

For example,  mx3fb currently uses only once DMA allocation for the framebuffer,
In the case of adding overlay support, we need an additional allocation for the overlay 
buffer as a resulting in the total request more than 2 MB

I have already started work on the mx3fb overlay support, about this we spoke with Guennadi,
My current kernel mx3fb successfully registered with support overlay buffer allocation.

Please see my cat /proc/dma-mappings: 

btw as you can see below there is no allocation for the camera

0xffa00000-0xffb77000 1536000 __set_par+0xc8/0x7f8
0xffc00000-0xffd77000 1536000 __set_par+0xc8/0x7f8
0xffdfa000-0xffdfb000    4096 ehci_mxc_setup+0x194/0x574
0xffdfb000-0xffdfc000    4096 dma_pool_alloc+0x9c/0x1f0
0xffdfc000-0xffdfd000    4096 dma_pool_alloc+0x9c/0x1f0
0xffdfd000-0xffdfe000    4096 fec_probe+0x248/0x71c
0xffdfe000-0xffdff000    4096 sdma_request_channel+0x2c/0xd8
0xffdff000-0xffe00000    4096 sdma_probe+0x2cc/0x61c

> > Another possibility would be to make this board specific.

I think this needed adapted for all i.mx3x, maybe need to use. 
  
#ifdef CONFIG_FB_MX3
        init_consistent_dma_size(SZ_8M);
#endif

Regards,
Alex Gershgorin

Patch

diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 7412738..a2c0c7d 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -201,6 +201,7 @@  static struct map_desc mx35_io_desc[] __initdata = {
 void __init mx35_map_io(void)
 {
 	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
+	init_consistent_dma_size(SZ_8M);
 }
 
 void __init imx35_init_early(void)