linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: nicolas.pitre@linaro.org (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
Date: Tue, 05 Jul 2011 22:30:33 -0400	[thread overview]
Message-ID: <1309919442-20451-1-git-send-email-nicolas.pitre@linaro.org> (raw)

Having this value defined at compile time prevents multiple machines with
conflicting definitions to coexist.  Move it to a variable in preparation
for having a per machine value selected at run time.  This is relevant
only when CONFIG_ZONE_DMA is selected.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/include/asm/dma.h    |    7 ++++---
 arch/arm/include/asm/memory.h |    7 +++++--
 arch/arm/mm/init.c            |   20 +++++++++++++-------
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 4200554..1d34c11 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -6,10 +6,11 @@
 /*
  * This is the maximum virtual address which can be DMA'd from.
  */
-#ifndef ARM_DMA_ZONE_SIZE
-#define MAX_DMA_ADDRESS	0xffffffff
+#ifndef CONFIG_ZONE_DMA
+#define MAX_DMA_ADDRESS	0xffffffffUL
 #else
-#define MAX_DMA_ADDRESS	(PAGE_OFFSET + ARM_DMA_ZONE_SIZE)
+extern unsigned long arm_dma_zone_size;
+#define MAX_DMA_ADDRESS	(PAGE_OFFSET + arm_dma_zone_size)
 #endif
 
 #ifdef CONFIG_ISA_DMA_API
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index af44a8f..deb2eaa 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -209,10 +209,13 @@ static inline unsigned long __phys_to_virt(unsigned long x)
  * allocations.  This must be the smallest DMA mask in the system,
  * so a successful GFP_DMA allocation will always satisfy this.
  */
-#ifndef ARM_DMA_ZONE_SIZE
+#ifndef CONFIG_ZONE_DMA
 #define ISA_DMA_THRESHOLD	(0xffffffffULL)
 #else
-#define ISA_DMA_THRESHOLD	(PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1)
+#define ISA_DMA_THRESHOLD	({ \
+	extern unsigned long arm_dma_zone_size; \
+	arm_dma_zone_size ? \
+		(PHYS_OFFSET + arm_dma_zone_size - 1) : 0xffffffffULL; })
 #endif
 
 /*
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c19571c..a14caff 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -34,6 +34,15 @@
 
 #include "mm.h"
 
+#ifdef CONFIG_ZONE_DMA
+#ifdef ARM_DMA_ZONE_SIZE
+unsigned long arm_dma_zone_size = ARM_DMA_ZONE_SIZE;
+#else
+unsigned long arm_dma_zone_size __read_mostly;
+#endif
+EXPORT_SYMBOL(arm_dma_zone_size);
+#endif
+
 static unsigned long phys_initrd_start __initdata = 0;
 static unsigned long phys_initrd_size __initdata = 0;
 
@@ -267,17 +276,14 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
 #endif
 	}
 
-#ifdef ARM_DMA_ZONE_SIZE
-#ifndef CONFIG_ZONE_DMA
-#error ARM_DMA_ZONE_SIZE set but no DMA zone to limit allocations
-#endif
-
+#ifdef CONFIG_ZONE_DMA
 	/*
 	 * Adjust the sizes according to any special requirements for
 	 * this machine type.
 	 */
-	arm_adjust_dma_zone(zone_size, zhole_size,
-		ARM_DMA_ZONE_SIZE >> PAGE_SHIFT);
+	if (arm_dma_zone_size)
+		arm_adjust_dma_zone(zone_size, zhole_size,
+			arm_dma_zone_size >> PAGE_SHIFT);
 #endif
 
 	free_area_init_node(0, zone_size, min, zhole_size);
-- 
1.7.4

             reply	other threads:[~2011-07-06  2:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-06  2:30 Nicolas Pitre [this message]
2011-07-06  2:30 ` [PATCH 02/10] ARM: add dma_zone_size to the machine_desc structure Nicolas Pitre
2011-07-06 23:10   ` Russell King - ARM Linux
2011-07-07  2:59     ` Nicolas Pitre
2011-07-06  2:30 ` [PATCH 03/10] ARM: mach-davinci: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size Nicolas Pitre
2011-07-06  2:30 ` [PATCH 04/10] ARM: mach-h720x: " Nicolas Pitre
2011-07-06  2:30 ` [PATCH 05/10] ARM: mach-ixp4xx: " Nicolas Pitre
2011-07-06 23:12   ` Russell King - ARM Linux
2011-07-07  3:31     ` Nicolas Pitre
2011-07-06  2:30 ` [PATCH 06/10] ARM: mach-pxa: " Nicolas Pitre
2011-07-06  2:30 ` [PATCH 07/10] ARM: mach-realview: " Nicolas Pitre
2011-07-06 23:15   ` Russell King - ARM Linux
2011-07-07  3:59     ` Nicolas Pitre
2011-07-06  2:30 ` [PATCH 08/10] ARM: mach-sa1100: move " Nicolas Pitre
2011-07-06  2:30 ` [PATCH 09/10] ARM: mach-shark: " Nicolas Pitre
2011-07-06  2:30 ` [PATCH 10/10] ARM: ARM_DMA_ZONE_SIZE is no more Nicolas Pitre
2011-07-06  2:48 ` [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Barry Song
2011-07-06  3:12   ` Nicolas Pitre
2011-07-06 23:09     ` Russell King - ARM Linux
2011-07-07  2:50       ` Nicolas Pitre
2011-07-07 16:17         ` Arnd Bergmann
2011-07-07 17:08           ` John Linn
2011-07-07 17:40             ` Arnd Bergmann
2011-07-08  8:59             ` Russell King - ARM Linux
2011-07-08 13:58               ` John Linn
2011-07-08 16:23                 ` Russell King - ARM Linux
2011-07-07 18:15           ` Grant Likely
2011-07-06 23:04 ` Russell King - ARM Linux
2011-07-07  2:46   ` Nicolas Pitre
2011-07-08 12:14     ` Russell King - ARM Linux
2011-07-08 20:30       ` Russell King - ARM Linux
2011-07-09  8:12         ` Russell King - ARM Linux
2011-07-09  8:13         ` Russell King - ARM Linux

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=1309919442-20451-1-git-send-email-nicolas.pitre@linaro.org \
    --to=nicolas.pitre@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 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).