linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator
@ 2012-08-20  6:16 Marek Szyprowski
  2012-08-20 11:29 ` Prabhakar Lad
  2012-08-20 20:01 ` Arnd Bergmann
  0 siblings, 2 replies; 6+ messages in thread
From: Marek Szyprowski @ 2012-08-20  6:16 UTC (permalink / raw)
  To: linux-arm-kernel

Contiguous Memory Allocator requires only paging and MMU enabled not
particular CPU architectures, so there is no need for strict dependency
on CPU type. This enables to use CMA on some older ARM v5 systems which
also might need large contiguous blocks for the multimedia processing hw
modules.

Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 arch/arm/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e91c7cd..6ef75e2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -6,7 +6,7 @@ config ARM
 	select HAVE_DMA_API_DEBUG
 	select HAVE_IDE if PCI || ISA || PCMCIA
 	select HAVE_DMA_ATTRS
-	select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7)
+	select HAVE_DMA_CONTIGUOUS if MMU
 	select HAVE_MEMBLOCK
 	select RTC_LIB
 	select SYS_SUPPORTS_APM_EMULATION
-- 
1.7.1.569.g6f426

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator
  2012-08-20  6:16 [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator Marek Szyprowski
@ 2012-08-20 11:29 ` Prabhakar Lad
  2012-08-20 20:01 ` Arnd Bergmann
  1 sibling, 0 replies; 6+ messages in thread
From: Prabhakar Lad @ 2012-08-20 11:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Marek,

Thanks for the patch.

On Monday 20 August 2012 11:46 AM, Marek Szyprowski wrote:
> Contiguous Memory Allocator requires only paging and MMU enabled not
> particular CPU architectures, so there is no need for strict dependency
> on CPU type. This enables to use CMA on some older ARM v5 systems which
> also might need large contiguous blocks for the multimedia processing hw
> modules.
> 
> Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>

  Reported-by: Prabhakar Lad <prabhakar.lad@ti.com>
  Tested-by: Prabhakar Lad <prabhakar.lad@ti.com>

Thx,
--Prabhakar

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  arch/arm/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index e91c7cd..6ef75e2 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -6,7 +6,7 @@ config ARM
>  	select HAVE_DMA_API_DEBUG
>  	select HAVE_IDE if PCI || ISA || PCMCIA
>  	select HAVE_DMA_ATTRS
> -	select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7)
> +	select HAVE_DMA_CONTIGUOUS if MMU
>  	select HAVE_MEMBLOCK
>  	select RTC_LIB
>  	select SYS_SUPPORTS_APM_EMULATION
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator
  2012-08-20  6:16 [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator Marek Szyprowski
  2012-08-20 11:29 ` Prabhakar Lad
@ 2012-08-20 20:01 ` Arnd Bergmann
  2012-08-21 12:12   ` Russell King - ARM Linux
  2012-08-21 14:46   ` Marek Szyprowski
  1 sibling, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2012-08-20 20:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 20 August 2012, Marek Szyprowski wrote:
> Contiguous Memory Allocator requires only paging and MMU enabled not
> particular CPU architectures, so there is no need for strict dependency
> on CPU type. This enables to use CMA on some older ARM v5 systems which
> also might need large contiguous blocks for the multimedia processing hw
> modules.
> 
> Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

The patch looks simple, but I want a better explanation for it.
When we went through all possible cases, we decided that:

* ARMv6+ need CMA to avoid the double mapping problem.
* ARMv4/v5 cannot generally use CMA because it doesn't work
  together with DMABOUNCE. I don't remember if it was the
  only problem, but I definitely remember this was intentional.
* We want a common kernel for all ARMv6+ eventually, and a
  separate kernel for all ARMv4/v5 ones.

If the reasoning has changed, please try to explain the full
situation. On a related topic, what happened to the idea that
ARMv6+ is broken without CMA? I noticed that it's optional
now.

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator
  2012-08-20 20:01 ` Arnd Bergmann
@ 2012-08-21 12:12   ` Russell King - ARM Linux
  2012-08-21 14:47     ` Marek Szyprowski
  2012-08-21 14:46   ` Marek Szyprowski
  1 sibling, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2012-08-21 12:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 20, 2012 at 08:01:23PM +0000, Arnd Bergmann wrote:
> The patch looks simple, but I want a better explanation for it.
> When we went through all possible cases, we decided that:
> 
> * ARMv6+ need CMA to avoid the double mapping problem.
> * ARMv4/v5 cannot generally use CMA because it doesn't work
>   together with DMABOUNCE. I don't remember if it was the
>   only problem, but I definitely remember this was intentional.
> * We want a common kernel for all ARMv6+ eventually, and a
>   separate kernel for all ARMv4/v5 ones.
> 
> If the reasoning has changed, please try to explain the full
> situation.

Indeed.

> On a related topic, what happened to the idea that
> ARMv6+ is broken without CMA? I noticed that it's optional
> now.

With Marek's patch, it's always selected for MMU-based builds (it can't
be disabled).  Before the patch, it was always selected for V6 and later
CPUs.

And the description doesn't make sense:

"Contiguous Memory Allocator requires only paging and MMU enabled not
particular CPU architectures,"

what does "only paging and MMU enabled" mean?  Are you trying to say that
CMA only requires a kernel with MMU support?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator
  2012-08-20 20:01 ` Arnd Bergmann
  2012-08-21 12:12   ` Russell King - ARM Linux
@ 2012-08-21 14:46   ` Marek Szyprowski
  1 sibling, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2012-08-21 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On Monday, August 20, 2012 10:01 PM Arnd Bergmann wrote:

> On Monday 20 August 2012, Marek Szyprowski wrote:
> > Contiguous Memory Allocator requires only paging and MMU enabled not
> > particular CPU architectures, so there is no need for strict dependency
> > on CPU type. This enables to use CMA on some older ARM v5 systems which
> > also might need large contiguous blocks for the multimedia processing hw
> > modules.
> >
> > Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> 
> The patch looks simple, but I want a better explanation for it.
> When we went through all possible cases, we decided that:
> 
> * ARMv6+ need CMA to avoid the double mapping problem.

Right. CMA can be used to avoid double mapping issues, but we also should keep in
mind that right now no one observed any issues with the real hw, so this discussion
is still a bit hypothetical.

> * ARMv4/v5 cannot generally use CMA because it doesn't work
>   together with DMABOUNCE. I don't remember if it was the
>   only problem, but I definitely remember this was intentional.

DMABOUNCE is used only by a few machines. I also tested and see no reason why it 
might cause problems with such machines. I've used DMABOUNCE code to test atomic 
allocations many times and found no problems. The only issue I might suspect is 
a very limited DMA zone. CMA needs 4Mib alignment of the contiguous area base and
size to meet requirements of the memory management core (mainly for migration and
page isolation purposes), so it might not fit into some small DMA zones.

> * We want a common kernel for all ARMv6+ eventually, and a
>   separate kernel for all ARMv4/v5 ones.

I see no problem here, if required why may have even a separate dma_map_ops for
CMA and use it only for selected devices.

> 
> If the reasoning has changed, please try to explain the full
> situation. On a related topic, what happened to the idea that
> ARMv6+ is broken without CMA? I noticed that it's optional
> now.

Right. I removed unconditional dependency on CMA on Russell's request. CMA is
still experimental and there are still some known issues with it, which we are 
investigating. It doesn't make sense to make the whole architecture depending
on the experimental stuff. The old method of allocating and managing coherent
buffers was stable and worked well enough for the drivers and platforms already
present in the mainline kernel, so if one want to use stable stuff I see no 
reason to disable it.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator
  2012-08-21 12:12   ` Russell King - ARM Linux
@ 2012-08-21 14:47     ` Marek Szyprowski
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Szyprowski @ 2012-08-21 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On Tuesday, August 21, 2012 2:13 PM Russell King - ARM Linux wrote:

> On Mon, Aug 20, 2012 at 08:01:23PM +0000, Arnd Bergmann wrote:
> > The patch looks simple, but I want a better explanation for it.
> > When we went through all possible cases, we decided that:
> >
> > * ARMv6+ need CMA to avoid the double mapping problem.
> > * ARMv4/v5 cannot generally use CMA because it doesn't work
> >   together with DMABOUNCE. I don't remember if it was the
> >   only problem, but I definitely remember this was intentional.
> > * We want a common kernel for all ARMv6+ eventually, and a
> >   separate kernel for all ARMv4/v5 ones.
> >
> > If the reasoning has changed, please try to explain the full
> > situation.
> 
> Indeed.
> 
> > On a related topic, what happened to the idea that
> > ARMv6+ is broken without CMA? I noticed that it's optional
> > now.
> 
> With Marek's patch, it's always selected for MMU-based builds (it can't
> be disabled).  Before the patch, it was always selected for V6 and later
> CPUs.

My patch only alters dependences of HAVE_DMA_CONTIGUOUS symbol, by changing
them from CPU_V6+ to MMU. It doesn't change or select CMA for any of the 
systems - this is done by the CONFIG_CMA symbol from drivers/base/KConfig 
which depends on HAVE_DMA_CONTIGUOUS. It is up to user to enable it or not.

> And the description doesn't make sense:
> 
> "Contiguous Memory Allocator requires only paging and MMU enabled not
> particular CPU architectures,"
> 
> what does "only paging and MMU enabled" mean?  Are you trying to say that
> CMA only requires a kernel with MMU support?

On ARM architecture CMA can be enabled on any system which has MMU support, 
MMU is required for page migration. The integration layer in dma-mapping is 
generic enough to work on any ARM architecture.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-21 14:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20  6:16 [PATCH] ARM: relax conditions required for enabling Contiguous Memory Allocator Marek Szyprowski
2012-08-20 11:29 ` Prabhakar Lad
2012-08-20 20:01 ` Arnd Bergmann
2012-08-21 12:12   ` Russell King - ARM Linux
2012-08-21 14:47     ` Marek Szyprowski
2012-08-21 14:46   ` Marek Szyprowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).