All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [RFC PATCH] Avoid aliasing mappings in DMA coherent allocator
Date: Sun, 9 Jan 2011 02:06:32 +0100	[thread overview]
Message-ID: <201101090206.34096.jkrzyszt@tis.icnet.pl> (raw)
In-Reply-To: <201101031928.37091.jkrzyszt@tis.icnet.pl>

(Cc linux-omap, please refere to a copy of Russell's initial message:
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-December/036463.html)

Monday 03 January 2011 19:28:36 Janusz Krzysztofik wrote:
> I'll try to prepare for review a followup patch that updates those
> <{mach,plat}/memory.h> and similiar include files which provided
> their own non-default CONSISTENT_DMA_SIZE values.

Below is an example of how a build time configuration for OMAP could 
be updated.

However, more looking at this, I think that a finer control of reserved 
memory area sizes, yet better selected at run time for a specific 
machine or board type, could be benefitial in case of kernels intended 
to run on multiple board types, like those built with omap1_defconfig, 
or even on multiple machine types, like in omap2plus_defconfig case.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---

--- linux-2.6.37-rc7/arch/arm/plat-omap/include/plat/memory.h.orig	2011-01-07 02:37:44.000000000 +0100
+++ linux-2.6.37-rc7/arch/arm/plat-omap/include/plat/memory.h	2011-01-07 03:01:25.000000000 +0100
@@ -86,17 +86,21 @@
 #endif	/* CONFIG_ARCH_OMAP15XX */
 
 /* Override the ARM default */
-#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
+#ifndef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
+#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 0
+#endif
 
-#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0)
+#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0) && \
+	(defined(CONFIG_SND_OMAP_SOC) || defined(CONFIG_SND_OMAP_SOC_MODULE))
 #undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
-#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2
+#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 1
 #endif
 
-#define CONSISTENT_DMA_SIZE \
-	(((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
+#define CONSISTENT_WC_SIZE \
+	(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE * 1024 * 1024)
 
-#endif
+#define CONSISTENT_DMA_SIZE \
+	((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE % 2 ? 1 : 2) * 1024 * 1024)
 
 #endif
 
--- linux-2.6.37-rc7/drivers/video/omap/Kconfig.orig	2010-12-24 13:42:46.000000000 +0100
+++ linux-2.6.37-rc7/drivers/video/omap/Kconfig	2011-01-07 01:56:45.000000000 +0100
@@ -85,9 +85,10 @@ config FB_OMAP_CONSISTENT_DMA_SIZE
	range 1 14
	default 2
 	help
- 	  Increase the DMA consistent memory size according to your video
+ 	  Increase the DMA writecombine memory size according to your video
 	  memory needs, for example if you want to use multiple planes.
-	  The size must be 2MB aligned.
+	  Note that 256kB can be consumed by OMAP sound driver if active.
+	  Specifying an odd number reduces DMA coherent memory from 2 to 1MB.
 	  If unsure say 1.
 
 config FB_OMAP_DMA_TUNE

WARNING: multiple messages have this Message-ID (diff)
From: jkrzyszt@tis.icnet.pl (Janusz Krzysztofik)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] Avoid aliasing mappings in DMA coherent allocator
Date: Sun, 9 Jan 2011 02:06:32 +0100	[thread overview]
Message-ID: <201101090206.34096.jkrzyszt@tis.icnet.pl> (raw)
In-Reply-To: <201101031928.37091.jkrzyszt@tis.icnet.pl>

(Cc linux-omap, please refere to a copy of Russell's initial message:
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-December/036463.html)

Monday 03 January 2011 19:28:36 Janusz Krzysztofik wrote:
> I'll try to prepare for review a followup patch that updates those
> <{mach,plat}/memory.h> and similiar include files which provided
> their own non-default CONSISTENT_DMA_SIZE values.

Below is an example of how a build time configuration for OMAP could 
be updated.

However, more looking at this, I think that a finer control of reserved 
memory area sizes, yet better selected at run time for a specific 
machine or board type, could be benefitial in case of kernels intended 
to run on multiple board types, like those built with omap1_defconfig, 
or even on multiple machine types, like in omap2plus_defconfig case.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---

--- linux-2.6.37-rc7/arch/arm/plat-omap/include/plat/memory.h.orig	2011-01-07 02:37:44.000000000 +0100
+++ linux-2.6.37-rc7/arch/arm/plat-omap/include/plat/memory.h	2011-01-07 03:01:25.000000000 +0100
@@ -86,17 +86,21 @@
 #endif	/* CONFIG_ARCH_OMAP15XX */
 
 /* Override the ARM default */
-#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
+#ifndef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
+#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 0
+#endif
 
-#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0)
+#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0) && \
+	(defined(CONFIG_SND_OMAP_SOC) || defined(CONFIG_SND_OMAP_SOC_MODULE))
 #undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
-#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2
+#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 1
 #endif
 
-#define CONSISTENT_DMA_SIZE \
-	(((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
+#define CONSISTENT_WC_SIZE \
+	(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE * 1024 * 1024)
 
-#endif
+#define CONSISTENT_DMA_SIZE \
+	((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE % 2 ? 1 : 2) * 1024 * 1024)
 
 #endif
 
--- linux-2.6.37-rc7/drivers/video/omap/Kconfig.orig	2010-12-24 13:42:46.000000000 +0100
+++ linux-2.6.37-rc7/drivers/video/omap/Kconfig	2011-01-07 01:56:45.000000000 +0100
@@ -85,9 +85,10 @@ config FB_OMAP_CONSISTENT_DMA_SIZE
	range 1 14
	default 2
 	help
- 	  Increase the DMA consistent memory size according to your video
+ 	  Increase the DMA writecombine memory size according to your video
 	  memory needs, for example if you want to use multiple planes.
-	  The size must be 2MB aligned.
+	  Note that 256kB can be consumed by OMAP sound driver if active.
+	  Specifying an odd number reduces DMA coherent memory from 2 to 1MB.
 	  If unsure say 1.
 
 config FB_OMAP_DMA_TUNE

  reply	other threads:[~2011-01-09  1:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-24 11:11 [PATCH] Replace page_to_dma()/dma_to_page() with pfn_to_dma()/dma_to_pfn() Russell King - ARM Linux
2010-12-24 11:24 ` [RFC PATCH] Avoid aliasing mappings in DMA coherent allocator Russell King - ARM Linux
2010-12-28 21:29   ` Janusz Krzysztofik
2011-01-03  9:57     ` Russell King - ARM Linux
2011-01-03 18:28       ` Janusz Krzysztofik
2011-01-09  1:06         ` Janusz Krzysztofik [this message]
2011-01-09  1:06           ` Janusz Krzysztofik
2012-06-29 11:38   ` Hiroshi Doyu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201101090206.34096.jkrzyszt@tis.icnet.pl \
    --to=jkrzyszt@tis.icnet.pl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.