diff mbox

[2/6] ARM: move ARCH_HAS_DMA_SET_COHERENT_MASK into memory.h

Message ID 1309366019-24379-3-git-send-email-robherring2@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rob Herring June 29, 2011, 4:46 p.m. UTC
From: Rob Herring <rob.herring@calxeda.com>

On ixp4xx and pxa, ARCH_HAS_DMA_SET_COHERENT_MASK resides in hardware.h
which does not get directly included by dma-mapping.h. Move it into
mach/memory.h which is explicitly included.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/mach-ixp4xx/include/mach/hardware.h |    2 --
 arch/arm/mach-ixp4xx/include/mach/memory.h   |    1 +
 arch/arm/mach-pxa/include/mach/hardware.h    |    1 -
 arch/arm/mach-pxa/include/mach/memory.h      |    1 +
 4 files changed, 2 insertions(+), 3 deletions(-)

Comments

Rob Herring July 9, 2011, 2:33 p.m. UTC | #1
Nicolas,

On 06/29/2011 11:46 AM, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> On ixp4xx and pxa, ARCH_HAS_DMA_SET_COHERENT_MASK resides in hardware.h
> which does not get directly included by dma-mapping.h. Move it into
> mach/memory.h which is explicitly included.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
>  arch/arm/mach-ixp4xx/include/mach/hardware.h |    2 --
>  arch/arm/mach-ixp4xx/include/mach/memory.h   |    1 +
>  arch/arm/mach-pxa/include/mach/hardware.h    |    1 -
>  arch/arm/mach-pxa/include/mach/memory.h      |    1 +
>  4 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h
> index 8138371..f91ca6d 100644
> --- a/arch/arm/mach-ixp4xx/include/mach/hardware.h
> +++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h
> @@ -26,8 +26,6 @@
>  #define PCIBIOS_MAX_MEM		0x4BFFFFFF
>  #endif
>  
> -#define ARCH_HAS_DMA_SET_COHERENT_MASK
> -
>  #define pcibios_assign_all_busses()	1
>  
>  /* Register locations and bits */
> diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
> index 34e7940..d671f5c 100644
> --- a/arch/arm/mach-ixp4xx/include/mach/memory.h
> +++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
> @@ -16,6 +16,7 @@
>  
>  #ifdef CONFIG_PCI
>  #define ARM_DMA_ZONE_SIZE	SZ_64M
> +#define ARCH_HAS_DMA_SET_COHERENT_MASK
>  #endif
>  
>  #endif
> diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
> index 6957ba5..313051c 100644
> --- a/arch/arm/mach-pxa/include/mach/hardware.h
> +++ b/arch/arm/mach-pxa/include/mach/hardware.h
> @@ -340,7 +340,6 @@ extern unsigned long get_clock_tick_rate(void);
>  #define PCIBIOS_MIN_IO		0
>  #define PCIBIOS_MIN_MEM		0
>  #define pcibios_assign_all_busses()	1
> -#define ARCH_HAS_DMA_SET_COHERENT_MASK
>  #endif
>  
>  #endif  /* _ASM_ARCH_HARDWARE_H */
> diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
> index 07734f3..e697578 100644
> --- a/arch/arm/mach-pxa/include/mach/memory.h
> +++ b/arch/arm/mach-pxa/include/mach/memory.h
> @@ -19,6 +19,7 @@
>  
>  #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
>  #define ARM_DMA_ZONE_SIZE	SZ_64M
> +#define ARCH_HAS_DMA_SET_COHERENT_MASK
>  #endif
>  
>  #endif

I noticed this is going to have conflicts with your ARM_DMA_ZONE_SIZE
series. Can you add this into your series? This still presents another
issue to solve for single kernel binary, but hopefully the dma mapping
work will help.

Rob
Russell King - ARM Linux July 9, 2011, 2:58 p.m. UTC | #2
On Sat, Jul 09, 2011 at 09:33:06AM -0500, Rob Herring wrote:
> I noticed this is going to have conflicts with your ARM_DMA_ZONE_SIZE
> series. Can you add this into your series? This still presents another
> issue to solve for single kernel binary, but hopefully the dma mapping
> work will help.

That's a different problem - its about limiting the maximum DMA mask
which can be set, so that memory is sourced from the right place
even for drivers which use 32-bit masks.

It's needed to ensure that dma_set_coherent_mask() can be overridden.
One solution to it would be to ensure that we always define
ARCH_HAS_DMA_SET_COHERENT_MASK, and handle the differences internally,
which is something I've been thinking about adding to my DMA bounce
series of patches.
Rob Herring July 10, 2011, 2:29 p.m. UTC | #3
On 07/09/2011 09:58 AM, Russell King - ARM Linux wrote:
> On Sat, Jul 09, 2011 at 09:33:06AM -0500, Rob Herring wrote:
>> I noticed this is going to have conflicts with your ARM_DMA_ZONE_SIZE
>> series. Can you add this into your series? This still presents another
>> issue to solve for single kernel binary, but hopefully the dma mapping
>> work will help.
> 
> That's a different problem - its about limiting the maximum DMA mask
> which can be set, so that memory is sourced from the right place
> even for drivers which use 32-bit masks.

Yes, I know that they are different.

> It's needed to ensure that dma_set_coherent_mask() can be overridden.
> One solution to it would be to ensure that we always define
> ARCH_HAS_DMA_SET_COHERENT_MASK, and handle the differences internally,
> which is something I've been thinking about adding to my DMA bounce
> series of patches.

asm/dma-mapping.h only includes asm/memory.h. We are getting lucky that
linux/dma-mapping.h is picking up ARCH_HAS_DMA_SET_COHERENT_MASK because
the include path looks like this for ixp4xx and pxa: linux/dma-mapping.h
-> linux/scatterlist.h -> asm/io.h -> mach/io.h -> mach/hardware.h.

I was previously thinking the define was getting picked up thru
asm/pci.h somehow. So I can just drop this from my series. It does need
to get fixed though or other header re-working could silently break this.

Rob
Russell King - ARM Linux July 10, 2011, 2:51 p.m. UTC | #4
On Sun, Jul 10, 2011 at 09:29:49AM -0500, Rob Herring wrote:
> asm/dma-mapping.h only includes asm/memory.h. We are getting lucky that
> linux/dma-mapping.h is picking up ARCH_HAS_DMA_SET_COHERENT_MASK because
> the include path looks like this for ixp4xx and pxa: linux/dma-mapping.h
> -> linux/scatterlist.h -> asm/io.h -> mach/io.h -> mach/hardware.h.

That's probably because of the way the code has changed over the last
year:

6fee48c dma-mapping: arm: use generic pci_set_dma_mask and pci_set_consistent_dma_mask

Removes HAVE_ARCH_PCI_SET_DMA_MASK from IXP4xx mach/hardware.h, thus
breaking IXP4xx machines.

5f3cd1e dma-mapping: pci: move pci_set_dma_mask and pci_set_consistent_dma_mask to pci-dma-compat.h

Removes HAVE_ARCH_PCI_SET_DMA_MASK support from drivers/pci/pci.c,
which includes linux/pci.h -> asm/pci.h -> mach/hardware.h and thus
the definition.

710224fa arm: fix "arm: fix pci_set_consistent_dma_mask for dmabounce devices"

Creates the current ARCH_HAS_DMA_SET_COHERENT_MASK stuff, placing it
into ixp4xx's and PXA's mach/hardware.h to fix the regression caused
by 6fee48c and 5f3cd1e.

So this really could do with being made more robust first, because
as you point out, the current solution is extremely fragile.
diff mbox

Patch

diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h
index 8138371..f91ca6d 100644
--- a/arch/arm/mach-ixp4xx/include/mach/hardware.h
+++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h
@@ -26,8 +26,6 @@ 
 #define PCIBIOS_MAX_MEM		0x4BFFFFFF
 #endif
 
-#define ARCH_HAS_DMA_SET_COHERENT_MASK
-
 #define pcibios_assign_all_busses()	1
 
 /* Register locations and bits */
diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
index 34e7940..d671f5c 100644
--- a/arch/arm/mach-ixp4xx/include/mach/memory.h
+++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
@@ -16,6 +16,7 @@ 
 
 #ifdef CONFIG_PCI
 #define ARM_DMA_ZONE_SIZE	SZ_64M
+#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index 6957ba5..313051c 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -340,7 +340,6 @@  extern unsigned long get_clock_tick_rate(void);
 #define PCIBIOS_MIN_IO		0
 #define PCIBIOS_MIN_MEM		0
 #define pcibios_assign_all_busses()	1
-#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif  /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
index 07734f3..e697578 100644
--- a/arch/arm/mach-pxa/include/mach/memory.h
+++ b/arch/arm/mach-pxa/include/mach/memory.h
@@ -19,6 +19,7 @@ 
 
 #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
 #define ARM_DMA_ZONE_SIZE	SZ_64M
+#define ARCH_HAS_DMA_SET_COHERENT_MASK
 #endif
 
 #endif