All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
@ 2011-07-06  2:30 Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 02/10] ARM: add dma_zone_size to the machine_desc structure Nicolas Pitre
                   ` (10 more replies)
  0 siblings, 11 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 02/10] ARM: add dma_zone_size to the machine_desc structure
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06 23:10   ` Russell King - ARM Linux
  2011-07-06  2:30 ` [PATCH 03/10] ARM: mach-davinci: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size Nicolas Pitre
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/include/asm/mach/arch.h |    4 ++++
 arch/arm/kernel/setup.c          |    6 ++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 946f4d7..7b79a00 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -23,6 +23,10 @@ struct machine_desc {
 
 	unsigned int		nr_irqs;	/* number of IRQs */
 
+#ifdef CONFIG_ZONE_DMA
+	unsigned long dma_zone_size;		/* size of DMA-able area */
+#endif
+
 	unsigned int		video_start;	/* start of video RAM	*/
 	unsigned int		video_end;	/* end of video RAM	*/
 
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index ed11fb0..e0db84d 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -916,6 +916,12 @@ void __init setup_arch(char **cmdline_p)
 	cpu_init();
 	tcm_init();
 
+#ifdef CONFIG_ZONE_DMA
+	if (mdesc->dma_zone_size) {
+		extern unsigned long arm_dma_zone_size;
+		arm_dma_zone_size = mdesc->dma_zone_size;
+	}
+#endif
 #ifdef CONFIG_MULTI_IRQ_HANDLER
 	handle_arch_irq = mdesc->handle_irq;
 #endif
-- 
1.7.4

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

* [PATCH 03/10] ARM: mach-davinci: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 02/10] ARM: add dma_zone_size to the machine_desc structure Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 04/10] ARM: mach-h720x: " Nicolas Pitre
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-davinci/board-da830-evm.c     |    1 +
 arch/arm/mach-davinci/board-da850-evm.c     |    1 +
 arch/arm/mach-davinci/board-dm355-evm.c     |    1 +
 arch/arm/mach-davinci/board-dm355-leopard.c |    1 +
 arch/arm/mach-davinci/board-dm365-evm.c     |    1 +
 arch/arm/mach-davinci/board-dm644x-evm.c    |    1 +
 arch/arm/mach-davinci/board-dm646x-evm.c    |    2 ++
 arch/arm/mach-davinci/board-mityomapl138.c  |    1 +
 arch/arm/mach-davinci/board-neuros-osd2.c   |    1 +
 arch/arm/mach-davinci/board-omapl138-hawk.c |    1 +
 arch/arm/mach-davinci/board-sffsdr.c        |    1 +
 arch/arm/mach-davinci/board-tnetv107x-evm.c |    1 +
 arch/arm/mach-davinci/include/mach/memory.h |    7 -------
 13 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 8bc3701..84fd7868 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -681,4 +681,5 @@ MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM")
 	.init_irq	= cp_intc_init,
 	.timer		= &davinci_timer,
 	.init_machine	= da830_evm_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index a7b41bf..29671ef 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1261,4 +1261,5 @@ MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
 	.init_irq	= cp_intc_init,
 	.timer		= &davinci_timer,
 	.init_machine	= da850_evm_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 6e7cad13..241a6bd 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -356,4 +356,5 @@ MACHINE_START(DAVINCI_DM355_EVM, "DaVinci DM355 EVM")
 	.init_irq     = davinci_irq_init,
 	.timer	      = &davinci_timer,
 	.init_machine = dm355_evm_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 543f991..bee284c 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -275,4 +275,5 @@ MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard")
 	.init_irq     = davinci_irq_init,
 	.timer	      = &davinci_timer,
 	.init_machine = dm355_leopard_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index c67f684..9844fa4 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -617,5 +617,6 @@ MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")
 	.init_irq	= davinci_irq_init,
 	.timer		= &davinci_timer,
 	.init_machine	= dm365_evm_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
 
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 556bbd4..95607a1 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -717,4 +717,5 @@ MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM")
 	.init_irq     = davinci_irq_init,
 	.timer	      = &davinci_timer,
 	.init_machine = davinci_evm_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index f6ac9ba..6d03643 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -802,6 +802,7 @@ MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM")
 	.init_irq     = davinci_irq_init,
 	.timer        = &davinci_timer,
 	.init_machine = evm_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
 
 MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM")
@@ -810,5 +811,6 @@ MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM")
 	.init_irq     = davinci_irq_init,
 	.timer        = &davinci_timer,
 	.init_machine = evm_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
 
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index 606a6f2..b8d59ca 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -570,4 +570,5 @@ MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
 	.init_irq	= cp_intc_init,
 	.timer		= &davinci_timer,
 	.init_machine	= mityomapl138_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 3e7be2d..d60a800 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -277,4 +277,5 @@ MACHINE_START(NEUROS_OSD2, "Neuros OSD2")
 	.init_irq	= davinci_irq_init,
 	.timer		= &davinci_timer,
 	.init_machine = davinci_ntosd2_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index 67c38d0..237332a 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -343,4 +343,5 @@ MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
 	.init_irq	= cp_intc_init,
 	.timer		= &davinci_timer,
 	.init_machine	= omapl138_hawk_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index 61ac96d..5f4385c 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -156,4 +156,5 @@ MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
 	.init_irq     = davinci_irq_init,
 	.timer	      = &davinci_timer,
 	.init_machine = davinci_sffsdr_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index 1a656e8..7828920 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -282,4 +282,5 @@ MACHINE_START(TNETV107X, "TNETV107X EVM")
 	.init_irq	= cp_intc_init,
 	.timer		= &davinci_timer,
 	.init_machine	= tnetv107x_evm_board_init,
+	.dma_zone_size	= SZ_128M,
 MACHINE_END
diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h
index 491249e..7873194 100644
--- a/arch/arm/mach-davinci/include/mach/memory.h
+++ b/arch/arm/mach-davinci/include/mach/memory.h
@@ -41,11 +41,4 @@
  */
 #define CONSISTENT_DMA_SIZE (14<<20)
 
-/*
- * Restrict DMA-able region to workaround silicon bug.  The bug
- * restricts buffers available for DMA to video hardware to be
- * below 128M
- */
-#define ARM_DMA_ZONE_SIZE	SZ_128M
-
 #endif /* __ASM_ARCH_MEMORY_H */
-- 
1.7.4

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

* [PATCH 04/10] ARM: mach-h720x: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 02/10] ARM: add dma_zone_size to the machine_desc structure 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 ` Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 05/10] ARM: mach-ixp4xx: " Nicolas Pitre
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-h720x/h7201-eval.c          |    1 +
 arch/arm/mach-h720x/h7202-eval.c          |    1 +
 arch/arm/mach-h720x/include/mach/memory.h |    7 -------
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-h720x/h7201-eval.c b/arch/arm/mach-h720x/h7201-eval.c
index 629454d..65f1bea 100644
--- a/arch/arm/mach-h720x/h7201-eval.c
+++ b/arch/arm/mach-h720x/h7201-eval.c
@@ -33,4 +33,5 @@ MACHINE_START(H7201, "Hynix GMS30C7201")
 	.map_io		= h720x_map_io,
 	.init_irq	= h720x_init_irq,
 	.timer		= &h7201_timer,
+	.dma_zone_size	= SZ_256M,
 MACHINE_END
diff --git a/arch/arm/mach-h720x/h7202-eval.c b/arch/arm/mach-h720x/h7202-eval.c
index e9f46b6..884584a 100644
--- a/arch/arm/mach-h720x/h7202-eval.c
+++ b/arch/arm/mach-h720x/h7202-eval.c
@@ -76,4 +76,5 @@ MACHINE_START(H7202, "Hynix HMS30C7202")
 	.init_irq	= h7202_init_irq,
 	.timer		= &h7202_timer,
 	.init_machine	= init_eval_h7202,
+	.dma_zone_size	= SZ_256M,
 MACHINE_END
diff --git a/arch/arm/mach-h720x/include/mach/memory.h b/arch/arm/mach-h720x/include/mach/memory.h
index b0b3bae..96dcf50 100644
--- a/arch/arm/mach-h720x/include/mach/memory.h
+++ b/arch/arm/mach-h720x/include/mach/memory.h
@@ -8,11 +8,4 @@
 #define __ASM_ARCH_MEMORY_H
 
 #define PLAT_PHYS_OFFSET	UL(0x40000000)
-/*
- * This is the maximum DMA address that can be DMAd to.
- * There should not be more than (0xd0000000 - 0xc0000000)
- * bytes of RAM.
- */
-#define ARM_DMA_ZONE_SIZE	SZ_256M
-
 #endif
-- 
1.7.4

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

* [PATCH 05/10] ARM: mach-ixp4xx: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (2 preceding siblings ...)
  2011-07-06  2:30 ` [PATCH 04/10] ARM: mach-h720x: " Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06 23:12   ` Russell King - ARM Linux
  2011-07-06  2:30 ` [PATCH 06/10] ARM: mach-pxa: " Nicolas Pitre
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-ixp4xx/avila-setup.c         |    6 ++++++
 arch/arm/mach-ixp4xx/coyote-setup.c        |    3 +++
 arch/arm/mach-ixp4xx/dsmg600-setup.c       |    3 +++
 arch/arm/mach-ixp4xx/fsg-setup.c           |    3 +++
 arch/arm/mach-ixp4xx/gateway7001-setup.c   |    3 +++
 arch/arm/mach-ixp4xx/goramo_mlr.c          |    3 +++
 arch/arm/mach-ixp4xx/gtwx5715-setup.c      |    3 +++
 arch/arm/mach-ixp4xx/include/mach/memory.h |    4 ----
 arch/arm/mach-ixp4xx/ixdp425-setup.c       |   12 ++++++++++++
 arch/arm/mach-ixp4xx/nas100d-setup.c       |    3 +++
 arch/arm/mach-ixp4xx/nslu2-setup.c         |    3 +++
 arch/arm/mach-ixp4xx/vulcan-setup.c        |    3 +++
 arch/arm/mach-ixp4xx/wg302v2-setup.c       |    3 +++
 13 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c
index 73745ff..05bf40d 100644
--- a/arch/arm/mach-ixp4xx/avila-setup.c
+++ b/arch/arm/mach-ixp4xx/avila-setup.c
@@ -169,6 +169,9 @@ MACHINE_START(AVILA, "Gateworks Avila Network Platform")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= avila_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 
  /*
@@ -184,6 +187,9 @@ MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= avila_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
 
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 355e3de..0adf01b 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -114,6 +114,9 @@ MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= coyote_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
 
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index d398229..3eb8861 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -284,4 +284,7 @@ MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
 	.init_irq	= ixp4xx_init_irq,
 	.timer          = &dsmg600_timer,
 	.init_machine	= dsmg600_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index 727ee39..d26bd4b 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -275,5 +275,8 @@ MACHINE_START(FSG, "Freecom FSG-3")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= fsg_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 
diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c
index 9dc0b4e..85e179e 100644
--- a/arch/arm/mach-ixp4xx/gateway7001-setup.c
+++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c
@@ -101,5 +101,8 @@ MACHINE_START(GATEWAY7001, "Gateway 7001 AP")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= gateway7001_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index 3e8c0e3..34955e8 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -501,4 +501,7 @@ MACHINE_START(GORAMO_MLR, "MultiLink")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= gmlr_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 77abead..283e128 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -169,6 +169,9 @@ MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= gtwx5715_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 
 
diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
index 34e7940..4caf176 100644
--- a/arch/arm/mach-ixp4xx/include/mach/memory.h
+++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
@@ -14,8 +14,4 @@
  */
 #define PLAT_PHYS_OFFSET	UL(0x00000000)
 
-#ifdef CONFIG_PCI
-#define ARM_DMA_ZONE_SIZE	SZ_64M
-#endif
-
 #endif
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index dca4f7f..d89e11f 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -258,6 +258,9 @@ MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= ixdp425_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
 
@@ -269,6 +272,9 @@ MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= ixdp425_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
 
@@ -280,6 +286,9 @@ MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= ixdp425_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
 
@@ -291,5 +300,8 @@ MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= ixdp425_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index f18fee7..5cb107b 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -319,4 +319,7 @@ MACHINE_START(NAS100D, "Iomega NAS 100d")
 	.init_irq	= ixp4xx_init_irq,
 	.timer          = &ixp4xx_timer,
 	.init_machine	= nas100d_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index f79b62e..446375d 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -305,4 +305,7 @@ MACHINE_START(NSLU2, "Linksys NSLU2")
 	.init_irq	= ixp4xx_init_irq,
 	.timer          = &nslu2_timer,
 	.init_machine	= nslu2_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c
index 4e72cfd..4a2d4e7 100644
--- a/arch/arm/mach-ixp4xx/vulcan-setup.c
+++ b/arch/arm/mach-ixp4xx/vulcan-setup.c
@@ -241,4 +241,7 @@ MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= vulcan_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c
index 5d148c7..5397237 100644
--- a/arch/arm/mach-ixp4xx/wg302v2-setup.c
+++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c
@@ -102,5 +102,8 @@ MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")
 	.timer		= &ixp4xx_timer,
 	.boot_params	= 0x0100,
 	.init_machine	= wg302v2_init,
+#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
 #endif
-- 
1.7.4

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

* [PATCH 06/10] ARM: mach-pxa: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (3 preceding siblings ...)
  2011-07-06  2:30 ` [PATCH 05/10] ARM: mach-ixp4xx: " Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 07/10] ARM: mach-realview: " Nicolas Pitre
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-pxa/cm-x2xx.c             |    3 +++
 arch/arm/mach-pxa/include/mach/memory.h |    4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index a109967..bc55d07 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -518,4 +518,7 @@ MACHINE_START(ARMCORE, "Compulab CM-X2XX")
 	.init_irq	= cmx2xx_init_irq,
 	.timer		= &pxa_timer,
 	.init_machine	= cmx2xx_init,
+#ifdef CONFIG_PCI
+	.dma_zone_size	= SZ_64M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
index 07734f3..d05a597 100644
--- a/arch/arm/mach-pxa/include/mach/memory.h
+++ b/arch/arm/mach-pxa/include/mach/memory.h
@@ -17,8 +17,4 @@
  */
 #define PLAT_PHYS_OFFSET	UL(0xa0000000)
 
-#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
-#define ARM_DMA_ZONE_SIZE	SZ_64M
-#endif
-
 #endif
-- 
1.7.4

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

* [PATCH 07/10] ARM: mach-realview: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (4 preceding siblings ...)
  2011-07-06  2:30 ` [PATCH 06/10] ARM: mach-pxa: " Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06 23:15   ` Russell King - ARM Linux
  2011-07-06  2:30 ` [PATCH 08/10] ARM: mach-sa1100: move " Nicolas Pitre
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-realview/include/mach/memory.h |    4 ----
 arch/arm/mach-realview/realview_eb.c         |    3 +++
 arch/arm/mach-realview/realview_pb1176.c     |    3 +++
 arch/arm/mach-realview/realview_pb11mp.c     |    3 +++
 arch/arm/mach-realview/realview_pba8.c       |    3 +++
 arch/arm/mach-realview/realview_pbx.c        |    3 +++
 6 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h
index 1759fa6..2022e09 100644
--- a/arch/arm/mach-realview/include/mach/memory.h
+++ b/arch/arm/mach-realview/include/mach/memory.h
@@ -29,10 +29,6 @@
 #define PLAT_PHYS_OFFSET		UL(0x00000000)
 #endif
 
-#ifdef CONFIG_ZONE_DMA
-#define ARM_DMA_ZONE_SIZE	SZ_256M
-#endif
-
 #ifdef CONFIG_SPARSEMEM
 
 /*
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 10e75fa..006a11b 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -470,4 +470,7 @@ MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
 	.init_irq	= gic_init_irq,
 	.timer		= &realview_eb_timer,
 	.init_machine	= realview_eb_init,
+#ifdef CONFIG_ZONE_DMA
+	.dma_zone_size	= SZ_128M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index eab6070..a43ca35 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -365,4 +365,7 @@ MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176")
 	.init_irq	= gic_init_irq,
 	.timer		= &realview_pb1176_timer,
 	.init_machine	= realview_pb1176_init,
+#ifdef CONFIG_ZONE_DMA
+	.dma_zone_size	= SZ_128M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index b2985fc..1f56fef 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -367,4 +367,7 @@ MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore")
 	.init_irq	= gic_init_irq,
 	.timer		= &realview_pb11mp_timer,
 	.init_machine	= realview_pb11mp_init,
+#ifdef CONFIG_ZONE_DMA
+	.dma_zone_size	= SZ_128M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index fb68665..64374d7 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -317,4 +317,7 @@ MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8")
 	.init_irq	= gic_init_irq,
 	.timer		= &realview_pba8_timer,
 	.init_machine	= realview_pba8_init,
+#ifdef CONFIG_ZONE_DMA
+	.dma_zone_size	= SZ_128M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 92ace2c..1f9eae6 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -400,4 +400,7 @@ MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX")
 	.init_irq	= gic_init_irq,
 	.timer		= &realview_pbx_timer,
 	.init_machine	= realview_pbx_init,
+#ifdef CONFIG_ZONE_DMA
+	.dma_zone_size	= SZ_128M,
+#endif
 MACHINE_END
-- 
1.7.4

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

* [PATCH 08/10] ARM: mach-sa1100: move ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (5 preceding siblings ...)
  2011-07-06  2:30 ` [PATCH 07/10] ARM: mach-realview: " Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 09/10] ARM: mach-shark: " Nicolas Pitre
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-sa1100/assabet.c             |    3 +++
 arch/arm/mach-sa1100/badge4.c              |    3 +++
 arch/arm/mach-sa1100/include/mach/memory.h |    4 ----
 arch/arm/mach-sa1100/jornada720.c          |    3 +++
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 5778274..26257df 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -453,4 +453,7 @@ MACHINE_START(ASSABET, "Intel-Assabet")
 	.init_irq	= sa1100_init_irq,
 	.timer		= &sa1100_timer,
 	.init_machine	= assabet_init,
+#ifdef CONFIG_SA1111
+	.dma_zone_size	= SZ_1M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index 4f19ff8..b4311b0 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -306,4 +306,7 @@ MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
 	.map_io		= badge4_map_io,
 	.init_irq	= sa1100_init_irq,
 	.timer		= &sa1100_timer,
+#ifdef CONFIG_SA1111
+	.dma_zone_size	= SZ_1M,
+#endif
 MACHINE_END
diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h
index cff31ee..12d3767 100644
--- a/arch/arm/mach-sa1100/include/mach/memory.h
+++ b/arch/arm/mach-sa1100/include/mach/memory.h
@@ -14,10 +14,6 @@
  */
 #define PLAT_PHYS_OFFSET	UL(0xc0000000)
 
-#ifdef CONFIG_SA1111
-#define ARM_DMA_ZONE_SIZE	SZ_1M
-#endif
-
 /*
  * Because of the wide memory address space between physical RAM banks on the
  * SA1100, it's much convenient to use Linux's SparseMEM support to implement
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index 491ac9f..176c066 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -369,4 +369,7 @@ MACHINE_START(JORNADA720, "HP Jornada 720")
 	.init_irq	= sa1100_init_irq,
 	.timer		= &sa1100_timer,
 	.init_machine	= jornada720_mach_init,
+#ifdef CONFIG_SA1111
+	.dma_zone_size	= SZ_1M,
+#endif
 MACHINE_END
-- 
1.7.4

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

* [PATCH 09/10] ARM: mach-shark: move ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (6 preceding siblings ...)
  2011-07-06  2:30 ` [PATCH 08/10] ARM: mach-sa1100: move " Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06  2:30 ` [PATCH 10/10] ARM: ARM_DMA_ZONE_SIZE is no more Nicolas Pitre
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-shark/core.c                |    1 +
 arch/arm/mach-shark/include/mach/memory.h |    2 --
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index 5cf7f94..ac2873c 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -156,4 +156,5 @@ MACHINE_START(SHARK, "Shark")
 	.map_io		= shark_map_io,
 	.init_irq	= shark_init_irq,
 	.timer		= &shark_timer,
+	.dma_zone_size	= SZ_4M,
 MACHINE_END
diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h
index 4c0831f8..1cf8d69 100644
--- a/arch/arm/mach-shark/include/mach/memory.h
+++ b/arch/arm/mach-shark/include/mach/memory.h
@@ -17,8 +17,6 @@
  */
 #define PLAT_PHYS_OFFSET     UL(0x08000000)
 
-#define ARM_DMA_ZONE_SIZE	SZ_4M
-
 /*
  * Cache flushing area
  */
-- 
1.7.4

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

* [PATCH 10/10] ARM: ARM_DMA_ZONE_SIZE is no more
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (7 preceding siblings ...)
  2011-07-06  2:30 ` [PATCH 09/10] ARM: mach-shark: " Nicolas Pitre
@ 2011-07-06  2:30 ` Nicolas Pitre
  2011-07-06  2:48 ` [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Barry Song
  2011-07-06 23:04 ` Russell King - ARM Linux
  10 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  2:30 UTC (permalink / raw)
  To: linux-arm-kernel

One less dependency on mach/memory.h.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/include/asm/dma.h |    2 --
 arch/arm/mm/init.c         |    4 ----
 2 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 1d34c11..04c162f 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -1,8 +1,6 @@
 #ifndef __ASM_ARM_DMA_H
 #define __ASM_ARM_DMA_H
 
-#include <asm/memory.h>
-
 /*
  * This is the maximum virtual address which can be DMA'd from.
  */
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index a14caff..d7d9011 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -35,11 +35,7 @@
 #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
 
-- 
1.7.4

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (8 preceding siblings ...)
  2011-07-06  2:30 ` [PATCH 10/10] ARM: ARM_DMA_ZONE_SIZE is no more Nicolas Pitre
@ 2011-07-06  2:48 ` Barry Song
  2011-07-06  3:12   ` Nicolas Pitre
  2011-07-06 23:04 ` Russell King - ARM Linux
  10 siblings, 1 reply; 33+ messages in thread
From: Barry Song @ 2011-07-06  2:48 UTC (permalink / raw)
  To: linux-arm-kernel

2011/7/6 Nicolas Pitre <nicolas.pitre@linaro.org>:
> 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>

that is definitely good. i am not sure whether it will be better if
dma zone becomes a property in memory node of DT.

        memory {
                reg = <0x00000000 0x20000000>;
                dma_zone = <0x00000000 0x10000000>;
        };

> ---
> ?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
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  0 siblings, 1 reply; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-06  3:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 6 Jul 2011, Barry Song wrote:

> 2011/7/6 Nicolas Pitre <nicolas.pitre@linaro.org>:
> > 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>
> 
> that is definitely good. i am not sure whether it will be better if
> dma zone becomes a property in memory node of DT.

Certainly.  But one thing at a time.  This is the first step. Then, 
those machines that are converted to DT could more easily provide the 
information via this mechanism if they so desire.


Nicolas

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
                   ` (9 preceding siblings ...)
  2011-07-06  2:48 ` [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Barry Song
@ 2011-07-06 23:04 ` Russell King - ARM Linux
  2011-07-07  2:46   ` Nicolas Pitre
  10 siblings, 1 reply; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-06 23:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 05, 2011 at 10:30:33PM -0400, Nicolas Pitre wrote:
> +extern unsigned long arm_dma_zone_size;
> +#define MAX_DMA_ADDRESS	(PAGE_OFFSET + arm_dma_zone_size)
...
> -#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; })

These two usages do not agree.  With unrestricted DMA, both
MAX_DMA_ADDRESS and ISA_DMA_THRESHOLD should be 0xffffffff.  However,
you get that with arm_dma_zone_size=0 for ISA_DMA_THRESHOLD, which
then gives a MAX_DMA_ADDRESS of PAGE_OFFSET.  So this potentially
changes the behaviour of these macros.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-06  3:12   ` Nicolas Pitre
@ 2011-07-06 23:09     ` Russell King - ARM Linux
  2011-07-07  2:50       ` Nicolas Pitre
  0 siblings, 1 reply; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-06 23:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 05, 2011 at 11:12:16PM -0400, Nicolas Pitre wrote:
> On Wed, 6 Jul 2011, Barry Song wrote:
> 
> > 2011/7/6 Nicolas Pitre <nicolas.pitre@linaro.org>:
> > > 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>
> > 
> > that is definitely good. i am not sure whether it will be better if
> > dma zone becomes a property in memory node of DT.
> 
> Certainly.  But one thing at a time.  This is the first step. Then, 
> those machines that are converted to DT could more easily provide the 
> information via this mechanism if they so desire.

Actually, putting that information into DT is probably not right -
you're describing something which is specific to Linux, not something
which is due to hardware.

What I mean is that the DMA zone is a Linux specific thing.  Another OS
could have a different way of dealing with the DMA restrictions (it
may be possible to allocate memory within a certain set of bounds.)

What is hardware specific is that the DMA devices can only address a
limited range of memory.  IMHO it's that which should be described in
DT, not that we'll have a DMA zone of X bytes in size.

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

* [PATCH 02/10] ARM: add dma_zone_size to the machine_desc structure
  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
  0 siblings, 1 reply; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-06 23:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 05, 2011 at 10:30:34PM -0400, Nicolas Pitre wrote:
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> ---
>  arch/arm/include/asm/mach/arch.h |    4 ++++
>  arch/arm/kernel/setup.c          |    6 ++++++
>  2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
> index 946f4d7..7b79a00 100644
> --- a/arch/arm/include/asm/mach/arch.h
> +++ b/arch/arm/include/asm/mach/arch.h
> @@ -23,6 +23,10 @@ struct machine_desc {
>  
>  	unsigned int		nr_irqs;	/* number of IRQs */
>  
> +#ifdef CONFIG_ZONE_DMA
> +	unsigned long dma_zone_size;		/* size of DMA-able area */

Please try to keep the formatting the same.

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

* [PATCH 05/10] ARM: mach-ixp4xx: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  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
  0 siblings, 1 reply; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-06 23:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 05, 2011 at 10:30:37PM -0400, Nicolas Pitre wrote:
> +#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)

This won't fly.  CONFIG has to be upper case.  Multiple instances of
that in this patch.

> diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
> index 34e7940..4caf176 100644
> --- a/arch/arm/mach-ixp4xx/include/mach/memory.h
> +++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
> @@ -14,8 +14,4 @@
>   */
>  #define PLAT_PHYS_OFFSET	UL(0x00000000)
>  
> -#ifdef CONFIG_PCI
> -#define ARM_DMA_ZONE_SIZE	SZ_64M
> -#endif

And the addition of dependence on CONFIG_IXP4XX_INDIRECT_PCI needs someone
from the IXP4xx folk to ACK as that's a functional change.

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

* [PATCH 07/10] ARM: mach-realview: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  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
  0 siblings, 1 reply; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-06 23:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 05, 2011 at 10:30:39PM -0400, Nicolas Pitre wrote:
> -#ifdef CONFIG_ZONE_DMA
> -#define ARM_DMA_ZONE_SIZE	SZ_256M
> -#endif
...
> +	.dma_zone_size	= SZ_128M,
> +	.dma_zone_size	= SZ_128M,
> +	.dma_zone_size	= SZ_128M,
> +	.dma_zone_size	= SZ_128M,
> +	.dma_zone_size	= SZ_128M,

Too small...

I think you're rushing to get these patches ready for the 3.1 merge
window...

Given that these patches have only just appeared, and the number of
sillies in them, they should wait for the next merge window _unless_
they get a thorough review and test.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  0 siblings, 1 reply; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-07  2:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 7 Jul 2011, Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 10:30:33PM -0400, Nicolas Pitre wrote:
> > +extern unsigned long arm_dma_zone_size;
> > +#define MAX_DMA_ADDRESS	(PAGE_OFFSET + arm_dma_zone_size)
> ...
> > -#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; })
> 
> These two usages do not agree.  With unrestricted DMA, both
> MAX_DMA_ADDRESS and ISA_DMA_THRESHOLD should be 0xffffffff.  However,
> you get that with arm_dma_zone_size=0 for ISA_DMA_THRESHOLD, which
> then gives a MAX_DMA_ADDRESS of PAGE_OFFSET.  So this potentially
> changes the behaviour of these macros.

Looking at what other architectures do, we have:

avr32, parisc, powerpc, sparc -> 0xffffffff

cris, frv, h8300, m68k, mips -> PAGE_OFFSET

microblaze, score, xtensa -> 0

So I wonder if this macro makes any sense when there is no DMA zone.  

OTOH, since it is almost never used, it is best to make it behave 
like the original. Fixed tusly in my tree:

diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 1d34c11..fcf15de 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -9,8 +9,10 @@
 #ifndef CONFIG_ZONE_DMA
 #define MAX_DMA_ADDRESS	0xffffffffUL
 #else
-extern unsigned long arm_dma_zone_size;
-#define MAX_DMA_ADDRESS	(PAGE_OFFSET + arm_dma_zone_size)
+#define MAX_DMA_ADDRESS	({ \
+	extern unsigned long arm_dma_zone_size; \
+	arm_dma_zone_size ? \
+		(PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
 #endif
 
 #ifdef CONFIG_ISA_DMA_API

Yet, excluding sound/oss/dmabuf.c, this is used by only 6 drivers in the 
whole tree which appear to be old ISA based drivers which would use a a 
DMA zone already.  The exception is cs89x0.c, however MAX_DMA_ADDRESS is 
only used in the context of ISA DMA.

What is more worrisome is its usage in a few places in the mm code where 
it is always passed to __pa().  Certainly __pa(0xffffffff) is not going 
to produce sensible results.

One thing is for sure: ISA_DMA_THRESHOLD is not used anywhere in the 
whole tree except in arch/arm/mm/dma-mapping.c:get_coherent_dma_mask() 
and arch/arm/include/asm/dma-mapping.h:dma_supported() where its usage 
is certainly not ISA specific.  Maybe this should be renamed?


Nicolas

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-06 23:09     ` Russell King - ARM Linux
@ 2011-07-07  2:50       ` Nicolas Pitre
  2011-07-07 16:17         ` Arnd Bergmann
  0 siblings, 1 reply; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-07  2:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 7 Jul 2011, Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 11:12:16PM -0400, Nicolas Pitre wrote:
> > On Wed, 6 Jul 2011, Barry Song wrote:
> > 
> > > 2011/7/6 Nicolas Pitre <nicolas.pitre@linaro.org>:
> > > > 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>
> > > 
> > > that is definitely good. i am not sure whether it will be better if
> > > dma zone becomes a property in memory node of DT.
> > 
> > Certainly.  But one thing at a time.  This is the first step. Then, 
> > those machines that are converted to DT could more easily provide the 
> > information via this mechanism if they so desire.
> 
> Actually, putting that information into DT is probably not right -
> you're describing something which is specific to Linux, not something
> which is due to hardware.
> 
> What I mean is that the DMA zone is a Linux specific thing.  Another OS
> could have a different way of dealing with the DMA restrictions (it
> may be possible to allocate memory within a certain set of bounds.)
> 
> What is hardware specific is that the DMA devices can only address a
> limited range of memory.  IMHO it's that which should be described in
> DT, not that we'll have a DMA zone of X bytes in size.

I think that we all agree on the principle.  I certainly never intended 
to suggest that the DMA zone size be stored as is in the device tree.


Nicolas

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

* [PATCH 02/10] ARM: add dma_zone_size to the machine_desc structure
  2011-07-06 23:10   ` Russell King - ARM Linux
@ 2011-07-07  2:59     ` Nicolas Pitre
  0 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-07  2:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 7 Jul 2011, Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 10:30:34PM -0400, Nicolas Pitre wrote:
> > Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> > ---
> >  arch/arm/include/asm/mach/arch.h |    4 ++++
> >  arch/arm/kernel/setup.c          |    6 ++++++
> >  2 files changed, 10 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
> > index 946f4d7..7b79a00 100644
> > --- a/arch/arm/include/asm/mach/arch.h
> > +++ b/arch/arm/include/asm/mach/arch.h
> > @@ -23,6 +23,10 @@ struct machine_desc {
> >  
> >  	unsigned int		nr_irqs;	/* number of IRQs */
> >  
> > +#ifdef CONFIG_ZONE_DMA
> > +	unsigned long dma_zone_size;		/* size of DMA-able area */
> 
> Please try to keep the formatting the same.

Oops, sure.  That's what might happens when your "screen" is effectively 
a unidimensional 40x1 character display. Fixed.


Nicolas

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

* [PATCH 05/10] ARM: mach-ixp4xx: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06 23:12   ` Russell King - ARM Linux
@ 2011-07-07  3:31     ` Nicolas Pitre
  0 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-07  3:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 7 Jul 2011, Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 10:30:37PM -0400, Nicolas Pitre wrote:
> > +#if defined(config_PCI) && !defined(CONFIG_IXP4XX_INDIRECT_PCI)
> 
> This won't fly.  CONFIG has to be upper case.  Multiple instances of
> that in this patch.

Okay... Obviously the fact that one's unidimensional 40x1 display made 
of mechanically raised pixels might have some of those pixels stuck in 
their set position is enough to confuse lower and upper case braille 
characters (yes I should have it fixed).

Fixed the code in the mean time, and compile tested it.  turns out that 
an unrelated file doesn't compile:

arch/arm/mach-ixp4xx/common.c: In function 'ixp4xx_clocksource_init':
arch/arm/mach-ixp4xx/common.c:428:2: error: lvalue required as unary '&' operand

> > diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
> > index 34e7940..4caf176 100644
> > --- a/arch/arm/mach-ixp4xx/include/mach/memory.h
> > +++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
> > @@ -14,8 +14,4 @@
> >   */
> >  #define PLAT_PHYS_OFFSET	UL(0x00000000)
> >  
> > -#ifdef CONFIG_PCI
> > -#define ARM_DMA_ZONE_SIZE	SZ_64M
> > -#endif
> 
> And the addition of dependence on CONFIG_IXP4XX_INDIRECT_PCI needs someone
> from the IXP4xx folk to ACK as that's a functional change.

The motivation for this change can be found in the Kconfig help text for 
IXP4XX_INDIRECT_PCI which looked pretty clear.  But this would be best 
if done in a separate patch so I've reverted this patch to the single 
CONFIG_PCI dependency.


Nicolas

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

* [PATCH 07/10] ARM: mach-realview: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  2011-07-06 23:15   ` Russell King - ARM Linux
@ 2011-07-07  3:59     ` Nicolas Pitre
  0 siblings, 0 replies; 33+ messages in thread
From: Nicolas Pitre @ 2011-07-07  3:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 7 Jul 2011, Russell King - ARM Linux wrote:

> On Tue, Jul 05, 2011 at 10:30:39PM -0400, Nicolas Pitre wrote:
> > -#ifdef CONFIG_ZONE_DMA
> > -#define ARM_DMA_ZONE_SIZE	SZ_256M
> > -#endif
> ...
> > +	.dma_zone_size	= SZ_128M,
> > +	.dma_zone_size	= SZ_128M,
> > +	.dma_zone_size	= SZ_128M,
> > +	.dma_zone_size	= SZ_128M,
> > +	.dma_zone_size	= SZ_128M,
> 
> Too small...

OK, fixed.

> I think you're rushing to get these patches ready for the 3.1 merge
> window...

I'm not rushing anything.  I've been working on and off on this series 
for over a month and simply just completed it now.  Mechanical changes 
like this might sometimes have mistakes but they are usually pretty easy 
to spot by someone with a fresh look.

> Given that these patches have only just appeared, and the number of
> sillies in them, they should wait for the next merge window _unless_
> they get a thorough review and test.

I don't mind waiting for the next merge window.  It is not like this is 
going to be the last of such patch series in order to enable a single 
zImage anyway.  However the next merge window is probably going to see 
even more of those patches as a Linaro concerted effort is being 
organized to accelerate that work.  Hence I was hoping to spread the 
patch load by submitting those ones now in order to reduce the size of 
the next windo's submission.


Nicolas

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-07  2:50       ` Nicolas Pitre
@ 2011-07-07 16:17         ` Arnd Bergmann
  2011-07-07 17:08           ` John Linn
  2011-07-07 18:15           ` Grant Likely
  0 siblings, 2 replies; 33+ messages in thread
From: Arnd Bergmann @ 2011-07-07 16:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 07 July 2011, Nicolas Pitre wrote:
> > What is hardware specific is that the DMA devices can only address a
> > limited range of memory.  IMHO it's that which should be described in
> > DT, not that we'll have a DMA zone of X bytes in size.
> 
> I think that we all agree on the principle.  I certainly never intended 
> to suggest that the DMA zone size be stored as is in the device tree.

There is a way to specify DMA address ranges in the device tree, though
I forgot the exact format. It comes down to saying the device sees
memory range XXX to YYY as its local address AAA to BBB. We could use
that information at boot time to determine what the largest range
of memory is that is visible by all devices (and hope that it's at
the start of physical memory).

	Arnd

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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-07 18:15           ` Grant Likely
  1 sibling, 2 replies; 33+ messages in thread
From: John Linn @ 2011-07-07 17:08 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-
> kernel-bounces at lists.infradead.org] On Behalf Of Arnd Bergmann
> Sent: Thursday, July 07, 2011 10:17 AM
> To: linux-arm-kernel at lists.infradead.org
> Cc: Nicolas Pitre; grant.likely at secretlab.ca; Russell King - ARM
Linux;
> Barry Song
> Subject: Re: [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a
> variable
> 
> On Thursday 07 July 2011, Nicolas Pitre wrote:
> > > What is hardware specific is that the DMA devices can only address
> a
> > > limited range of memory.  IMHO it's that which should be described
> in
> > > DT, not that we'll have a DMA zone of X bytes in size.
> >
> > I think that we all agree on the principle.  I certainly never
> intended
> > to suggest that the DMA zone size be stored as is in the device
tree.
> 
> There is a way to specify DMA address ranges in the device tree,
though
> I forgot the exact format. It comes down to saying the device sees
> memory range XXX to YYY as its local address AAA to BBB. We could use
> that information at boot time to determine what the largest range
> of memory is that is visible by all devices (and hope that it's at
> the start of physical memory).

If I'm following this right....

We have a hole at the start of physical memory (when it's at 0) so that
DMA can't DMA into it.  Sounds like that won't work for us?

Thanks,
John

> 
> 	Arnd
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-07 17:08           ` John Linn
@ 2011-07-07 17:40             ` Arnd Bergmann
  2011-07-08  8:59             ` Russell King - ARM Linux
  1 sibling, 0 replies; 33+ messages in thread
From: Arnd Bergmann @ 2011-07-07 17:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 07 July 2011 19:08:38 John Linn wrote:
> > There is a way to specify DMA address ranges in the device tree,
> though
> > I forgot the exact format. It comes down to saying the device sees
> > memory range XXX to YYY as its local address AAA to BBB. We could use
> > that information at boot time to determine what the largest range
> > of memory is that is visible by all devices (and hope that it's at
> > the start of physical memory).
> 
> If I'm following this right....
> 
> We have a hole at the start of physical memory (when it's at 0) so that
> DMA can't DMA into it.  Sounds like that won't work for us?

A whole in physical memory should not be a problem. It's only a problem
if you have a device that can do DMA only to to some memory range that
is not the start of your RAM, e.g. only the second 256MB but not the first.

	Arnd

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-07 16:17         ` Arnd Bergmann
  2011-07-07 17:08           ` John Linn
@ 2011-07-07 18:15           ` Grant Likely
  1 sibling, 0 replies; 33+ messages in thread
From: Grant Likely @ 2011-07-07 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 07, 2011 at 06:17:11PM +0200, Arnd Bergmann wrote:
> On Thursday 07 July 2011, Nicolas Pitre wrote:
> > > What is hardware specific is that the DMA devices can only address a
> > > limited range of memory.  IMHO it's that which should be described in
> > > DT, not that we'll have a DMA zone of X bytes in size.
> > 
> > I think that we all agree on the principle.  I certainly never intended 
> > to suggest that the DMA zone size be stored as is in the device tree.
> 
> There is a way to specify DMA address ranges in the device tree, though
> I forgot the exact format. It comes down to saying the device sees
> memory range XXX to YYY as its local address AAA to BBB. We could use
> that information at boot time to determine what the largest range
> of memory is that is visible by all devices (and hope that it's at
> the start of physical memory).

It's called dma-ranges, and it has the same syntax as the ranges
property.  See section 2.3.9 on page 30 in ePAPR:

http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf

This describes the hardware constraints, not the DMA zone size or
any software decisions like that.

g.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  1 sibling, 1 reply; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-08  8:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 07, 2011 at 11:08:38AM -0600, John Linn wrote:
> If I'm following this right....
> 
> We have a hole at the start of physical memory (when it's at 0) so that
> DMA can't DMA into it.  Sounds like that won't work for us?

That depends what you mean by that.

If you're saying that your physical RAM starts at some non-zero address,
then that isn't a problem.  We have lots of ARM platforms where that is
true.

If you're saying that the first N MB of RAM can't be DMA'd to, then that
is a problem as the kernel has no way to be told about that restriction.
The best we can manage is to avoid freeing that memory into the normal
allocation pools.

We do have a very small number of platforms where that's true, but we
'work around' that by having the kernel occupy that space.  If N MB is
less than sizeof(kernel) + 32K then you haven't lost much.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  0 siblings, 1 reply; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-08 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 06, 2011 at 10:46:03PM -0400, Nicolas Pitre wrote:
> On Thu, 7 Jul 2011, Russell King - ARM Linux wrote:
> 
> > On Tue, Jul 05, 2011 at 10:30:33PM -0400, Nicolas Pitre wrote:
> > > +extern unsigned long arm_dma_zone_size;
> > > +#define MAX_DMA_ADDRESS	(PAGE_OFFSET + arm_dma_zone_size)
> > ...
> > > -#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; })
> > 
> > These two usages do not agree.  With unrestricted DMA, both
> > MAX_DMA_ADDRESS and ISA_DMA_THRESHOLD should be 0xffffffff.  However,
> > you get that with arm_dma_zone_size=0 for ISA_DMA_THRESHOLD, which
> > then gives a MAX_DMA_ADDRESS of PAGE_OFFSET.  So this potentially
> > changes the behaviour of these macros.
> 
> Looking at what other architectures do, we have:
> 
> avr32, parisc, powerpc, sparc -> 0xffffffff
> 
> cris, frv, h8300, m68k, mips -> PAGE_OFFSET
> 
> microblaze, score, xtensa -> 0
> 
> So I wonder if this macro makes any sense when there is no DMA zone.  
> 
> OTOH, since it is almost never used, it is best to make it behave 
> like the original. Fixed tusly in my tree:
> 
> diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
> index 1d34c11..fcf15de 100644
> --- a/arch/arm/include/asm/dma.h
> +++ b/arch/arm/include/asm/dma.h
> @@ -9,8 +9,10 @@
>  #ifndef CONFIG_ZONE_DMA
>  #define MAX_DMA_ADDRESS	0xffffffffUL
>  #else
> -extern unsigned long arm_dma_zone_size;
> -#define MAX_DMA_ADDRESS	(PAGE_OFFSET + arm_dma_zone_size)
> +#define MAX_DMA_ADDRESS	({ \
> +	extern unsigned long arm_dma_zone_size; \
> +	arm_dma_zone_size ? \
> +		(PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
>  #endif
>  
>  #ifdef CONFIG_ISA_DMA_API
> 
> Yet, excluding sound/oss/dmabuf.c, this is used by only 6 drivers in the 
> whole tree which appear to be old ISA based drivers which would use a a 
> DMA zone already.  The exception is cs89x0.c, however MAX_DMA_ADDRESS is 
> only used in the context of ISA DMA.

Most drivers treat it as a virtual address, and it's used to determine
whether a driver private bounce buffer needs to be used.  Setting it
to PAGE_OFFSET means that the bounce buffer will always be used.  Setting
it to all-ones means that the bounce buffer will never be used and some
code will be optimized away.  Intermediate settings means that we get
run-time checks which aren't required on ARM platforms.

> What is more worrisome is its usage in a few places in the mm code where 
> it is always passed to __pa().  Certainly __pa(0xffffffff) is not going 
> to produce sensible results.

The only real user there is bootmem, which hopefully will be killed
off on ARM soon.  In any case, I wouldn't worry about that at the
moment because it's been that way for a long time and we haven't had
any reports of badness from it.

> One thing is for sure: ISA_DMA_THRESHOLD is not used anywhere in the 
> whole tree except in arch/arm/mm/dma-mapping.c:get_coherent_dma_mask() 
> and arch/arm/include/asm/dma-mapping.h:dma_supported() where its usage 
> is certainly not ISA specific.  Maybe this should be renamed?

It looks like ISA_DMA_THRESHOLD has become unused by most of the kernel,
so yes, renaming it to "dma_zone_limit" would be more descriptive.  We
should probably make dma_supported() be out-of-line anyway (which then
means that dma_zone_limit doesn't have to be exported to drivers) - and
I think the DMA bounce stuff needs cleaning up in dma_set_mask().

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  0 siblings, 1 reply; 33+ messages in thread
From: John Linn @ 2011-07-08 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

> -----Original Message-----
> From: Russell King - ARM Linux [mailto:linux at arm.linux.org.uk]
> Sent: Friday, July 08, 2011 3:00 AM
> To: John Linn
> Cc: Arnd Bergmann; linux-arm-kernel at lists.infradead.org; Nicolas
Pitre;
> grant.likely at secretlab.ca; Barry Song
> Subject: Re: [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a
> variable
> 
> On Thu, Jul 07, 2011 at 11:08:38AM -0600, John Linn wrote:
> > If I'm following this right....
> >
> > We have a hole at the start of physical memory (when it's at 0) so
> that
> > DMA can't DMA into it.  Sounds like that won't work for us?
> 
> That depends what you mean by that.
> 
> If you're saying that your physical RAM starts at some non-zero
> address,
> then that isn't a problem.  We have lots of ARM platforms where that
is
> true.
> 
> If you're saying that the first N MB of RAM can't be DMA'd to, then
> that
> is a problem as the kernel has no way to be told about that
> restriction.
> The best we can manage is to avoid freeing that memory into the normal
> allocation pools.

Yes that is what I'm saying. Catalin and I had some conversation about
this
previously (my apologies if I just didn't get it Catalin).

> 
> We do have a very small number of platforms where that's true, but we
> 'work around' that by having the kernel occupy that space.  If N MB is
> less than sizeof(kernel) + 32K then you haven't lost much.

It's only at addresses 0 - 512K that's not DMA-able.  I am using a DMA
zone (with a hole at the front) to avoid this problem right now but
maybe I'm not really understanding it and it's not working correctly.
Testing looks good with the DMA zone.

I didn't like the other solution since we had to add another exception
where the kernel frees it's memory (not to free it).  But maybe this is
really the right solution as Catalin had tried to explain to me.

Thanks for the input,
John


Please ignore any legal footer at the bottom of this email, this problem
is still being worked.


  

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  2011-07-08 13:58               ` John Linn
@ 2011-07-08 16:23                 ` Russell King - ARM Linux
  0 siblings, 0 replies; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-08 16:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 08, 2011 at 07:58:03AM -0600, John Linn wrote:
> It's only at addresses 0 - 512K that's not DMA-able.  I am using a DMA
> zone (with a hole at the front) to avoid this problem right now but
> maybe I'm not really understanding it and it's not working correctly.
> Testing looks good with the DMA zone.

That's more or less what we do with Integrator platforms.  It's very
unlikely that a kernel will ever be smaller than 512K, so if you place
it at 32K as normal, avoid freeing the .init text/data, and keep the
first 32K reserved (the second 16K will be reserved for the swapper
page table in any case) then you'll keep that memory away from anything
that might hand it out for DMA purposes.

See free_initmem() for the integrator stuff avoiding .init freeing, and
integrator_reserve() to keep the first 16K reserved.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  0 siblings, 2 replies; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-08 20:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 08, 2011 at 01:14:41PM +0100, Russell King - ARM Linux wrote:
> It looks like ISA_DMA_THRESHOLD has become unused by most of the kernel,
> so yes, renaming it to "dma_zone_limit" would be more descriptive.  We
> should probably make dma_supported() be out-of-line anyway (which then
> means that dma_zone_limit doesn't have to be exported to drivers) - and
> I think the DMA bounce stuff needs cleaning up in dma_set_mask().

... and I now have a patch which does this, pending testing.  Once
I've tested it I'll send it out.

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  1 sibling, 0 replies; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-09  8:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 08, 2011 at 09:30:45PM +0100, Russell King - ARM Linux wrote:
> On Fri, Jul 08, 2011 at 01:14:41PM +0100, Russell King - ARM Linux wrote:
> > It looks like ISA_DMA_THRESHOLD has become unused by most of the kernel,
> > so yes, renaming it to "dma_zone_limit" would be more descriptive.  We
> > should probably make dma_supported() be out-of-line anyway (which then
> > means that dma_zone_limit doesn't have to be exported to drivers) - and
> > I think the DMA bounce stuff needs cleaning up in dma_set_mask().
> 
> ... and I now have a patch which does this, pending testing.  Once
> I've tested it I'll send it out.

8<-----
From: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: simplify dma_set_mask()

Simplify the dmabounce specific code in dma_set_mask().  We can just
omit setting the dma mask if dmabounce is enabled (we will have already
set dma mask via callbacks when the device is created in that case.)

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/include/asm/dma-mapping.h |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 4ad2533..94662f4 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -133,18 +133,12 @@ static inline int dma_supported(struct device *dev, u64 mask)
 
 static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 {
-#ifdef CONFIG_DMABOUNCE
-	if (dev->archdata.dmabounce) {
-		if (dma_mask >= ISA_DMA_THRESHOLD)
-			return 0;
-		else
-			return -EIO;
-	}
-#endif
 	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
 		return -EIO;
 
+#ifndef CONFIG_DMABOUNCE
 	*dev->dma_mask = dma_mask;
+#endif
 
 	return 0;
 }
-- 
1.7.4.4

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

* [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable
  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
  1 sibling, 0 replies; 33+ messages in thread
From: Russell King - ARM Linux @ 2011-07-09  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 08, 2011 at 09:30:45PM +0100, Russell King - ARM Linux wrote:
> On Fri, Jul 08, 2011 at 01:14:41PM +0100, Russell King - ARM Linux wrote:
> > It looks like ISA_DMA_THRESHOLD has become unused by most of the kernel,
> > so yes, renaming it to "dma_zone_limit" would be more descriptive.  We
> > should probably make dma_supported() be out-of-line anyway (which then
> > means that dma_zone_limit doesn't have to be exported to drivers) - and
> > I think the DMA bounce stuff needs cleaning up in dma_set_mask().
> 
> ... and I now have a patch which does this, pending testing.  Once
> I've tested it I'll send it out.

8<--------
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
ARM: dma: replace ISA_DMA_THRESHOLD with a variable

ISA_DMA_THRESHOLD has been unused by non-arch code, so lets now get
rid of it from ARM by replacing it with arm_dma_zone_mask.  Move
dma_supported() and dma_set_mask() out of line, and have
dma_supported() check this new variable instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/include/asm/dma-mapping.h |   29 ++---------------------------
 arch/arm/include/asm/memory.h      |   12 ------------
 arch/arm/mm/dma-mapping.c          |   35 ++++++++++++++++++++++++++++++++---
 arch/arm/mm/init.c                 |   10 ++++++++++
 arch/arm/mm/mm.h                   |    6 ++++++
 5 files changed, 50 insertions(+), 42 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 94662f4..7a21d0b 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -115,33 +115,8 @@ static inline void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
 		___dma_page_dev_to_cpu(page, off, size, dir);
 }
 
-/*
- * Return whether the given device DMA address mask can be supported
- * properly.  For example, if your device can only drive the low 24-bits
- * during bus mastering, then you would pass 0x00ffffff as the mask
- * to this function.
- *
- * FIXME: This should really be a platform specific issue - we should
- * return false if GFP_DMA allocations may not satisfy the supplied 'mask'.
- */
-static inline int dma_supported(struct device *dev, u64 mask)
-{
-	if (mask < ISA_DMA_THRESHOLD)
-		return 0;
-	return 1;
-}
-
-static inline int dma_set_mask(struct device *dev, u64 dma_mask)
-{
-	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
-		return -EIO;
-
-#ifndef CONFIG_DMABOUNCE
-	*dev->dma_mask = dma_mask;
-#endif
-
-	return 0;
-}
+extern int dma_supported(struct device *, u64);
+extern int dma_set_mask(struct device *, u64);
 
 /*
  * DMA errors are defined by all-bits-set in the DMA address.
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index af44a8f..b8de516 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -204,18 +204,6 @@ static inline unsigned long __phys_to_virt(unsigned long x)
 #endif
 
 /*
- * The DMA mask corresponding to the maximum bus address allocatable
- * using GFP_DMA.  The default here places no restriction on DMA
- * 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
-#define ISA_DMA_THRESHOLD	(0xffffffffULL)
-#else
-#define ISA_DMA_THRESHOLD	(PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1)
-#endif
-
-/*
  * PFNs are used to describe any physical page; this means
  * PFN 0 == physical address 0.
  *
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 82a093c..0a0a1e7 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -25,9 +25,11 @@
 #include <asm/tlbflush.h>
 #include <asm/sizes.h>
 
+#include "mm.h"
+
 static u64 get_coherent_dma_mask(struct device *dev)
 {
-	u64 mask = ISA_DMA_THRESHOLD;
+	u64 mask = (u64)arm_dma_limit;
 
 	if (dev) {
 		mask = dev->coherent_dma_mask;
@@ -41,10 +43,10 @@ static u64 get_coherent_dma_mask(struct device *dev)
 			return 0;
 		}
 
-		if ((~mask) & ISA_DMA_THRESHOLD) {
+		if ((~mask) & (u64)arm_dma_limit) {
 			dev_warn(dev, "coherent DMA mask %#llx is smaller "
 				 "than system GFP_DMA mask %#llx\n",
-				 mask, (unsigned long long)ISA_DMA_THRESHOLD);
+				 mask, (u64)arm_dma_limit);
 			return 0;
 		}
 	}
@@ -657,6 +659,33 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 }
 EXPORT_SYMBOL(dma_sync_sg_for_device);
 
+/*
+ * Return whether the given device DMA address mask can be supported
+ * properly.  For example, if your device can only drive the low 24-bits
+ * during bus mastering, then you would pass 0x00ffffff as the mask
+ * to this function.
+ */
+int dma_supported(struct device *dev, u64 mask)
+{
+	if (mask < (u64)arm_dma_limit)
+		return 0;
+	return 1;
+}
+EXPORT_SYMBOL(dma_supported);
+
+int dma_set_mask(struct device *dev, u64 dma_mask)
+{
+	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
+		return -EIO;
+
+#ifndef CONFIG_DMABOUNCE
+	*dev->dma_mask = dma_mask;
+#endif
+
+	return 0;
+}
+EXPORT_SYMBOL(dma_set_mask);
+
 #define PREALLOC_DMA_DEBUG_ENTRIES	4096
 
 static int __init dma_debug_do_init(void)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c19571c..b9efa18 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -212,6 +212,14 @@ static void __init arm_bootmem_init(unsigned long start_pfn,
 }
 
 #ifdef CONFIG_ZONE_DMA
+/*
+ * The DMA mask corresponding to the maximum bus address allocatable
+ * using GFP_DMA.  The default here places no restriction on DMA
+ * allocations.  This must be the smallest DMA mask in the system,
+ * so a successful GFP_DMA allocation will always satisfy this.
+ */
+u32 arm_dma_zone_size;
+
 static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole,
 	unsigned long dma_size)
 {
@@ -278,6 +286,8 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
 	 */
 	arm_adjust_dma_zone(zone_size, zhole_size,
 		ARM_DMA_ZONE_SIZE >> PAGE_SHIFT);
+
+	arm_dma_limit = PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1;
 #endif
 
 	free_area_init_node(0, zone_size, min, zhole_size);
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 5b3d7d5..0105667 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -23,5 +23,11 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
 
 #endif
 
+#ifdef CONFIG_ZONE_DMA
+extern u32 arm_dma_limit;
+#else
+#define arm_dma_limit ((u32)~0)
+#endif
+
 void __init bootmem_init(void);
 void arm_mm_memblock_reserve(void);
-- 
1.7.4.4

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

end of thread, other threads:[~2011-07-09  8:13 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-06  2:30 [PATCH 01/10] ARM: change ARM_DMA_ZONE_SIZE into a variable Nicolas Pitre
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

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.