All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] dma-mapping: Provide write-combine allocations
@ 2014-06-27  9:56 ` Thierry Reding
  0 siblings, 0 replies; 12+ messages in thread
From: Thierry Reding @ 2014-06-27  9:56 UTC (permalink / raw)
  To: Russell King, Arnd Bergmann, Marek Szyprowski
  Cc: linaro-mm-sig, linux-arm-kernel, linux-arch, linux-kernel

From: Thierry Reding <treding@nvidia.com>

Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
the architecture supports DMA attributes.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- Add a generic dma_mmap_writecombine() function

 arch/arm/include/asm/dma-mapping.h       | 16 ----------------
 include/asm-generic/dma-mapping-common.h |  8 --------
 include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index c45b61a4b4a5..85738b200023 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -265,22 +265,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 			void *cpu_addr, dma_addr_t dma_addr, size_t size,
 			struct dma_attrs *attrs);
 
-static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag)
-{
-	DEFINE_DMA_ATTRS(attrs);
-	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
-	return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
-}
-
-static inline void dma_free_writecombine(struct device *dev, size_t size,
-				     void *cpu_addr, dma_addr_t dma_handle)
-{
-	DEFINE_DMA_ATTRS(attrs);
-	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
-	return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
-}
-
 /*
  * This can be called during early boot to increase the size of the atomic
  * coherent DMA pool above the default value of 256KiB. It must be called
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index de8bf89940f8..d137431bf26f 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -205,14 +205,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
 
 #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
 
-static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
-		      void *cpu_addr, dma_addr_t dma_addr, size_t size)
-{
-	DEFINE_DMA_ATTRS(attrs);
-	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
-	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
-}
-
 int
 dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
 		       void *cpu_addr, dma_addr_t dma_addr, size_t size);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 931b70986272..d5d388160f42 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -263,6 +263,32 @@ struct dma_attrs;
 #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
 	dma_unmap_sg(dev, sgl, nents, dir)
 
+#else
+static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
+					   dma_addr_t *dma_addr, gfp_t gfp)
+{
+	DEFINE_DMA_ATTRS(attrs);
+	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
+	return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
+}
+
+static inline void dma_free_writecombine(struct device *dev, size_t size,
+					 void *cpu_addr, dma_addr_t dma_addr)
+{
+	DEFINE_DMA_ATTRS(attrs);
+	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
+	return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
+}
+
+static inline int dma_mmap_writecombine(struct device *dev,
+					struct vm_area_struct *vma,
+					void *cpu_addr, dma_addr_t dma_addr,
+					size_t size)
+{
+	DEFINE_DMA_ATTRS(attrs);
+	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
+	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
+}
 #endif /* CONFIG_HAVE_DMA_ATTRS */
 
 #ifdef CONFIG_NEED_DMA_MAP_STATE
-- 
2.0.0


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

* [PATCH v2] dma-mapping: Provide write-combine allocations
@ 2014-06-27  9:56 ` Thierry Reding
  0 siblings, 0 replies; 12+ messages in thread
From: Thierry Reding @ 2014-06-27  9:56 UTC (permalink / raw)
  To: linux-arm-kernel

From: Thierry Reding <treding@nvidia.com>

Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
the architecture supports DMA attributes.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- Add a generic dma_mmap_writecombine() function

 arch/arm/include/asm/dma-mapping.h       | 16 ----------------
 include/asm-generic/dma-mapping-common.h |  8 --------
 include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index c45b61a4b4a5..85738b200023 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -265,22 +265,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 			void *cpu_addr, dma_addr_t dma_addr, size_t size,
 			struct dma_attrs *attrs);
 
-static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag)
-{
-	DEFINE_DMA_ATTRS(attrs);
-	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
-	return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
-}
-
-static inline void dma_free_writecombine(struct device *dev, size_t size,
-				     void *cpu_addr, dma_addr_t dma_handle)
-{
-	DEFINE_DMA_ATTRS(attrs);
-	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
-	return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
-}
-
 /*
  * This can be called during early boot to increase the size of the atomic
  * coherent DMA pool above the default value of 256KiB. It must be called
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
index de8bf89940f8..d137431bf26f 100644
--- a/include/asm-generic/dma-mapping-common.h
+++ b/include/asm-generic/dma-mapping-common.h
@@ -205,14 +205,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
 
 #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
 
-static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
-		      void *cpu_addr, dma_addr_t dma_addr, size_t size)
-{
-	DEFINE_DMA_ATTRS(attrs);
-	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
-	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
-}
-
 int
 dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
 		       void *cpu_addr, dma_addr_t dma_addr, size_t size);
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 931b70986272..d5d388160f42 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -263,6 +263,32 @@ struct dma_attrs;
 #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
 	dma_unmap_sg(dev, sgl, nents, dir)
 
+#else
+static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
+					   dma_addr_t *dma_addr, gfp_t gfp)
+{
+	DEFINE_DMA_ATTRS(attrs);
+	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
+	return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
+}
+
+static inline void dma_free_writecombine(struct device *dev, size_t size,
+					 void *cpu_addr, dma_addr_t dma_addr)
+{
+	DEFINE_DMA_ATTRS(attrs);
+	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
+	return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
+}
+
+static inline int dma_mmap_writecombine(struct device *dev,
+					struct vm_area_struct *vma,
+					void *cpu_addr, dma_addr_t dma_addr,
+					size_t size)
+{
+	DEFINE_DMA_ATTRS(attrs);
+	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
+	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
+}
 #endif /* CONFIG_HAVE_DMA_ATTRS */
 
 #ifdef CONFIG_NEED_DMA_MAP_STATE
-- 
2.0.0

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

* Re: [PATCH v2] dma-mapping: Provide write-combine allocations
  2014-06-27  9:56 ` Thierry Reding
@ 2014-08-01 12:40   ` Thierry Reding
  -1 siblings, 0 replies; 12+ messages in thread
From: Thierry Reding @ 2014-08-01 12:40 UTC (permalink / raw)
  To: Russell King, Arnd Bergmann, Marek Szyprowski
  Cc: linaro-mm-sig, linux-arm-kernel, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4071 bytes --]

On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> the architecture supports DMA attributes.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> Changes in v2:
> - Add a generic dma_mmap_writecombine() function
> 
>  arch/arm/include/asm/dma-mapping.h       | 16 ----------------
>  include/asm-generic/dma-mapping-common.h |  8 --------
>  include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
>  3 files changed, 26 insertions(+), 24 deletions(-)

Ping?

> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> index c45b61a4b4a5..85738b200023 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -265,22 +265,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>  			void *cpu_addr, dma_addr_t dma_addr, size_t size,
>  			struct dma_attrs *attrs);
>  
> -static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> -				       dma_addr_t *dma_handle, gfp_t flag)
> -{
> -	DEFINE_DMA_ATTRS(attrs);
> -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> -	return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
> -}
> -
> -static inline void dma_free_writecombine(struct device *dev, size_t size,
> -				     void *cpu_addr, dma_addr_t dma_handle)
> -{
> -	DEFINE_DMA_ATTRS(attrs);
> -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> -	return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
> -}
> -
>  /*
>   * This can be called during early boot to increase the size of the atomic
>   * coherent DMA pool above the default value of 256KiB. It must be called
> diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
> index de8bf89940f8..d137431bf26f 100644
> --- a/include/asm-generic/dma-mapping-common.h
> +++ b/include/asm-generic/dma-mapping-common.h
> @@ -205,14 +205,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
>  
>  #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
>  
> -static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
> -		      void *cpu_addr, dma_addr_t dma_addr, size_t size)
> -{
> -	DEFINE_DMA_ATTRS(attrs);
> -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> -	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> -}
> -
>  int
>  dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
>  		       void *cpu_addr, dma_addr_t dma_addr, size_t size);
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 931b70986272..d5d388160f42 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -263,6 +263,32 @@ struct dma_attrs;
>  #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
>  	dma_unmap_sg(dev, sgl, nents, dir)
>  
> +#else
> +static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> +					   dma_addr_t *dma_addr, gfp_t gfp)
> +{
> +	DEFINE_DMA_ATTRS(attrs);
> +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> +	return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
> +}
> +
> +static inline void dma_free_writecombine(struct device *dev, size_t size,
> +					 void *cpu_addr, dma_addr_t dma_addr)
> +{
> +	DEFINE_DMA_ATTRS(attrs);
> +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> +	return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
> +}
> +
> +static inline int dma_mmap_writecombine(struct device *dev,
> +					struct vm_area_struct *vma,
> +					void *cpu_addr, dma_addr_t dma_addr,
> +					size_t size)
> +{
> +	DEFINE_DMA_ATTRS(attrs);
> +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> +	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> +}
>  #endif /* CONFIG_HAVE_DMA_ATTRS */
>  
>  #ifdef CONFIG_NEED_DMA_MAP_STATE
> -- 
> 2.0.0
> 

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH v2] dma-mapping: Provide write-combine allocations
@ 2014-08-01 12:40   ` Thierry Reding
  0 siblings, 0 replies; 12+ messages in thread
From: Thierry Reding @ 2014-08-01 12:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> the architecture supports DMA attributes.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> Changes in v2:
> - Add a generic dma_mmap_writecombine() function
> 
>  arch/arm/include/asm/dma-mapping.h       | 16 ----------------
>  include/asm-generic/dma-mapping-common.h |  8 --------
>  include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
>  3 files changed, 26 insertions(+), 24 deletions(-)

Ping?

> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> index c45b61a4b4a5..85738b200023 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -265,22 +265,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>  			void *cpu_addr, dma_addr_t dma_addr, size_t size,
>  			struct dma_attrs *attrs);
>  
> -static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> -				       dma_addr_t *dma_handle, gfp_t flag)
> -{
> -	DEFINE_DMA_ATTRS(attrs);
> -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> -	return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
> -}
> -
> -static inline void dma_free_writecombine(struct device *dev, size_t size,
> -				     void *cpu_addr, dma_addr_t dma_handle)
> -{
> -	DEFINE_DMA_ATTRS(attrs);
> -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> -	return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
> -}
> -
>  /*
>   * This can be called during early boot to increase the size of the atomic
>   * coherent DMA pool above the default value of 256KiB. It must be called
> diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
> index de8bf89940f8..d137431bf26f 100644
> --- a/include/asm-generic/dma-mapping-common.h
> +++ b/include/asm-generic/dma-mapping-common.h
> @@ -205,14 +205,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
>  
>  #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
>  
> -static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
> -		      void *cpu_addr, dma_addr_t dma_addr, size_t size)
> -{
> -	DEFINE_DMA_ATTRS(attrs);
> -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> -	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> -}
> -
>  int
>  dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
>  		       void *cpu_addr, dma_addr_t dma_addr, size_t size);
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 931b70986272..d5d388160f42 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -263,6 +263,32 @@ struct dma_attrs;
>  #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
>  	dma_unmap_sg(dev, sgl, nents, dir)
>  
> +#else
> +static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> +					   dma_addr_t *dma_addr, gfp_t gfp)
> +{
> +	DEFINE_DMA_ATTRS(attrs);
> +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> +	return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
> +}
> +
> +static inline void dma_free_writecombine(struct device *dev, size_t size,
> +					 void *cpu_addr, dma_addr_t dma_addr)
> +{
> +	DEFINE_DMA_ATTRS(attrs);
> +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> +	return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
> +}
> +
> +static inline int dma_mmap_writecombine(struct device *dev,
> +					struct vm_area_struct *vma,
> +					void *cpu_addr, dma_addr_t dma_addr,
> +					size_t size)
> +{
> +	DEFINE_DMA_ATTRS(attrs);
> +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> +	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> +}
>  #endif /* CONFIG_HAVE_DMA_ATTRS */
>  
>  #ifdef CONFIG_NEED_DMA_MAP_STATE
> -- 
> 2.0.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140801/2b8ef231/attachment.sig>

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

* Re: [PATCH v2] dma-mapping: Provide write-combine allocations
  2014-06-27  9:56 ` Thierry Reding
@ 2014-08-01 12:55   ` Arnd Bergmann
  -1 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2014-08-01 12:55 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Russell King, Marek Szyprowski, linaro-mm-sig, linux-arm-kernel,
	linux-arch, linux-kernel

On Friday 27 June 2014, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> the architecture supports DMA attributes.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---

Acked-by: Arnd Bergmann <arnd@arndb.de>

I'd suggest this gets merged through Russell's tree. Please add to the
patch tracker with my Ack.

	Arnd

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

* [PATCH v2] dma-mapping: Provide write-combine allocations
@ 2014-08-01 12:55   ` Arnd Bergmann
  0 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2014-08-01 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 27 June 2014, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> the architecture supports DMA attributes.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---

Acked-by: Arnd Bergmann <arnd@arndb.de>

I'd suggest this gets merged through Russell's tree. Please add to the
patch tracker with my Ack.

	Arnd

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

* Re: [PATCH v2] dma-mapping: Provide write-combine allocations
  2014-08-01 12:40   ` Thierry Reding
@ 2014-08-01 15:19     ` Russell King - ARM Linux
  -1 siblings, 0 replies; 12+ messages in thread
From: Russell King - ARM Linux @ 2014-08-01 15:19 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Arnd Bergmann, Marek Szyprowski, linaro-mm-sig, linux-arm-kernel,
	linux-arch, linux-kernel

On Fri, Aug 01, 2014 at 02:40:59PM +0200, Thierry Reding wrote:
> On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> > the architecture supports DMA attributes.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> > Changes in v2:
> > - Add a generic dma_mmap_writecombine() function
> > 
> >  arch/arm/include/asm/dma-mapping.h       | 16 ----------------
> >  include/asm-generic/dma-mapping-common.h |  8 --------
> >  include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
> >  3 files changed, 26 insertions(+), 24 deletions(-)
> 
> Ping?

I have no problem with this, but I don't think I can say yes to it; that
depends whether other people are happy for this to live in
include/linux/dma-mapping.h.

I guess consent for this change can only come by no one objecting to it
after several postings.

> > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> > index c45b61a4b4a5..85738b200023 100644
> > --- a/arch/arm/include/asm/dma-mapping.h
> > +++ b/arch/arm/include/asm/dma-mapping.h
> > @@ -265,22 +265,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
> >  			void *cpu_addr, dma_addr_t dma_addr, size_t size,
> >  			struct dma_attrs *attrs);
> >  
> > -static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> > -				       dma_addr_t *dma_handle, gfp_t flag)
> > -{
> > -	DEFINE_DMA_ATTRS(attrs);
> > -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > -	return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
> > -}
> > -
> > -static inline void dma_free_writecombine(struct device *dev, size_t size,
> > -				     void *cpu_addr, dma_addr_t dma_handle)
> > -{
> > -	DEFINE_DMA_ATTRS(attrs);
> > -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > -	return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
> > -}
> > -
> >  /*
> >   * This can be called during early boot to increase the size of the atomic
> >   * coherent DMA pool above the default value of 256KiB. It must be called
> > diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
> > index de8bf89940f8..d137431bf26f 100644
> > --- a/include/asm-generic/dma-mapping-common.h
> > +++ b/include/asm-generic/dma-mapping-common.h
> > @@ -205,14 +205,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
> >  
> >  #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
> >  
> > -static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
> > -		      void *cpu_addr, dma_addr_t dma_addr, size_t size)
> > -{
> > -	DEFINE_DMA_ATTRS(attrs);
> > -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > -	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> > -}
> > -
> >  int
> >  dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
> >  		       void *cpu_addr, dma_addr_t dma_addr, size_t size);
> > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> > index 931b70986272..d5d388160f42 100644
> > --- a/include/linux/dma-mapping.h
> > +++ b/include/linux/dma-mapping.h
> > @@ -263,6 +263,32 @@ struct dma_attrs;
> >  #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
> >  	dma_unmap_sg(dev, sgl, nents, dir)
> >  
> > +#else
> > +static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> > +					   dma_addr_t *dma_addr, gfp_t gfp)
> > +{
> > +	DEFINE_DMA_ATTRS(attrs);
> > +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > +	return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
> > +}
> > +
> > +static inline void dma_free_writecombine(struct device *dev, size_t size,
> > +					 void *cpu_addr, dma_addr_t dma_addr)
> > +{
> > +	DEFINE_DMA_ATTRS(attrs);
> > +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > +	return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
> > +}
> > +
> > +static inline int dma_mmap_writecombine(struct device *dev,
> > +					struct vm_area_struct *vma,
> > +					void *cpu_addr, dma_addr_t dma_addr,
> > +					size_t size)
> > +{
> > +	DEFINE_DMA_ATTRS(attrs);
> > +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > +	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> > +}
> >  #endif /* CONFIG_HAVE_DMA_ATTRS */
> >  
> >  #ifdef CONFIG_NEED_DMA_MAP_STATE
> > -- 
> > 2.0.0
> > 



-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

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

* [PATCH v2] dma-mapping: Provide write-combine allocations
@ 2014-08-01 15:19     ` Russell King - ARM Linux
  0 siblings, 0 replies; 12+ messages in thread
From: Russell King - ARM Linux @ 2014-08-01 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 01, 2014 at 02:40:59PM +0200, Thierry Reding wrote:
> On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> > the architecture supports DMA attributes.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> > Changes in v2:
> > - Add a generic dma_mmap_writecombine() function
> > 
> >  arch/arm/include/asm/dma-mapping.h       | 16 ----------------
> >  include/asm-generic/dma-mapping-common.h |  8 --------
> >  include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
> >  3 files changed, 26 insertions(+), 24 deletions(-)
> 
> Ping?

I have no problem with this, but I don't think I can say yes to it; that
depends whether other people are happy for this to live in
include/linux/dma-mapping.h.

I guess consent for this change can only come by no one objecting to it
after several postings.

> > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> > index c45b61a4b4a5..85738b200023 100644
> > --- a/arch/arm/include/asm/dma-mapping.h
> > +++ b/arch/arm/include/asm/dma-mapping.h
> > @@ -265,22 +265,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
> >  			void *cpu_addr, dma_addr_t dma_addr, size_t size,
> >  			struct dma_attrs *attrs);
> >  
> > -static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> > -				       dma_addr_t *dma_handle, gfp_t flag)
> > -{
> > -	DEFINE_DMA_ATTRS(attrs);
> > -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > -	return dma_alloc_attrs(dev, size, dma_handle, flag, &attrs);
> > -}
> > -
> > -static inline void dma_free_writecombine(struct device *dev, size_t size,
> > -				     void *cpu_addr, dma_addr_t dma_handle)
> > -{
> > -	DEFINE_DMA_ATTRS(attrs);
> > -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > -	return dma_free_attrs(dev, size, cpu_addr, dma_handle, &attrs);
> > -}
> > -
> >  /*
> >   * This can be called during early boot to increase the size of the atomic
> >   * coherent DMA pool above the default value of 256KiB. It must be called
> > diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
> > index de8bf89940f8..d137431bf26f 100644
> > --- a/include/asm-generic/dma-mapping-common.h
> > +++ b/include/asm-generic/dma-mapping-common.h
> > @@ -205,14 +205,6 @@ dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void *cpu_addr,
> >  
> >  #define dma_mmap_coherent(d, v, c, h, s) dma_mmap_attrs(d, v, c, h, s, NULL)
> >  
> > -static inline int dma_mmap_writecombine(struct device *dev, struct vm_area_struct *vma,
> > -		      void *cpu_addr, dma_addr_t dma_addr, size_t size)
> > -{
> > -	DEFINE_DMA_ATTRS(attrs);
> > -	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > -	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> > -}
> > -
> >  int
> >  dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
> >  		       void *cpu_addr, dma_addr_t dma_addr, size_t size);
> > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> > index 931b70986272..d5d388160f42 100644
> > --- a/include/linux/dma-mapping.h
> > +++ b/include/linux/dma-mapping.h
> > @@ -263,6 +263,32 @@ struct dma_attrs;
> >  #define dma_unmap_sg_attrs(dev, sgl, nents, dir, attrs) \
> >  	dma_unmap_sg(dev, sgl, nents, dir)
> >  
> > +#else
> > +static inline void *dma_alloc_writecombine(struct device *dev, size_t size,
> > +					   dma_addr_t *dma_addr, gfp_t gfp)
> > +{
> > +	DEFINE_DMA_ATTRS(attrs);
> > +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > +	return dma_alloc_attrs(dev, size, dma_addr, gfp, &attrs);
> > +}
> > +
> > +static inline void dma_free_writecombine(struct device *dev, size_t size,
> > +					 void *cpu_addr, dma_addr_t dma_addr)
> > +{
> > +	DEFINE_DMA_ATTRS(attrs);
> > +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > +	return dma_free_attrs(dev, size, cpu_addr, dma_addr, &attrs);
> > +}
> > +
> > +static inline int dma_mmap_writecombine(struct device *dev,
> > +					struct vm_area_struct *vma,
> > +					void *cpu_addr, dma_addr_t dma_addr,
> > +					size_t size)
> > +{
> > +	DEFINE_DMA_ATTRS(attrs);
> > +	dma_set_attr(DMA_ATTR_WRITE_COMBINE, &attrs);
> > +	return dma_mmap_attrs(dev, vma, cpu_addr, dma_addr, size, &attrs);
> > +}
> >  #endif /* CONFIG_HAVE_DMA_ATTRS */
> >  
> >  #ifdef CONFIG_NEED_DMA_MAP_STATE
> > -- 
> > 2.0.0
> > 



-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

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

* Re: [PATCH v2] dma-mapping: Provide write-combine allocations
  2014-08-01 15:19     ` Russell King - ARM Linux
@ 2014-08-21 10:38       ` Marek Szyprowski
  -1 siblings, 0 replies; 12+ messages in thread
From: Marek Szyprowski @ 2014-08-21 10:38 UTC (permalink / raw)
  To: Russell King - ARM Linux, Thierry Reding
  Cc: Arnd Bergmann, linaro-mm-sig, linux-arm-kernel, linux-arch, linux-kernel

Hello,

On 2014-08-01 17:19, Russell King - ARM Linux wrote:
> On Fri, Aug 01, 2014 at 02:40:59PM +0200, Thierry Reding wrote:
>> On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
>>> From: Thierry Reding <treding@nvidia.com>
>>>
>>> Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
>>> the architecture supports DMA attributes.
>>>
>>> Signed-off-by: Thierry Reding <treding@nvidia.com>
>>> ---
>>> Changes in v2:
>>> - Add a generic dma_mmap_writecombine() function
>>>
>>>   arch/arm/include/asm/dma-mapping.h       | 16 ----------------
>>>   include/asm-generic/dma-mapping-common.h |  8 --------
>>>   include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
>>>   3 files changed, 26 insertions(+), 24 deletions(-)
>> Ping?
> I have no problem with this, but I don't think I can say yes to it; that
> depends whether other people are happy for this to live in
> include/linux/dma-mapping.h.
>
> I guess consent for this change can only come by no one objecting to it
> after several postings.

I will take this patch my dma-mapping-next tree and later send pull request
to Linus, so it will be handled in a similar way as all other changes to
generic dma-mapping subsystem done in last 2 years.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

* [PATCH v2] dma-mapping: Provide write-combine allocations
@ 2014-08-21 10:38       ` Marek Szyprowski
  0 siblings, 0 replies; 12+ messages in thread
From: Marek Szyprowski @ 2014-08-21 10:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On 2014-08-01 17:19, Russell King - ARM Linux wrote:
> On Fri, Aug 01, 2014 at 02:40:59PM +0200, Thierry Reding wrote:
>> On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
>>> From: Thierry Reding <treding@nvidia.com>
>>>
>>> Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
>>> the architecture supports DMA attributes.
>>>
>>> Signed-off-by: Thierry Reding <treding@nvidia.com>
>>> ---
>>> Changes in v2:
>>> - Add a generic dma_mmap_writecombine() function
>>>
>>>   arch/arm/include/asm/dma-mapping.h       | 16 ----------------
>>>   include/asm-generic/dma-mapping-common.h |  8 --------
>>>   include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
>>>   3 files changed, 26 insertions(+), 24 deletions(-)
>> Ping?
> I have no problem with this, but I don't think I can say yes to it; that
> depends whether other people are happy for this to live in
> include/linux/dma-mapping.h.
>
> I guess consent for this change can only come by no one objecting to it
> after several postings.

I will take this patch my dma-mapping-next tree and later send pull request
to Linus, so it will be handled in a similar way as all other changes to
generic dma-mapping subsystem done in last 2 years.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

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

* Re: [PATCH v2] dma-mapping: Provide write-combine allocations
  2014-08-21 10:38       ` Marek Szyprowski
@ 2014-08-21 13:24         ` Thierry Reding
  -1 siblings, 0 replies; 12+ messages in thread
From: Thierry Reding @ 2014-08-21 13:24 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Russell King - ARM Linux, Arnd Bergmann, linaro-mm-sig,
	linux-arm-kernel, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]

On Thu, Aug 21, 2014 at 12:38:48PM +0200, Marek Szyprowski wrote:
> Hello,
> 
> On 2014-08-01 17:19, Russell King - ARM Linux wrote:
> >On Fri, Aug 01, 2014 at 02:40:59PM +0200, Thierry Reding wrote:
> >>On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
> >>>From: Thierry Reding <treding@nvidia.com>
> >>>
> >>>Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> >>>the architecture supports DMA attributes.
> >>>
> >>>Signed-off-by: Thierry Reding <treding@nvidia.com>
> >>>---
> >>>Changes in v2:
> >>>- Add a generic dma_mmap_writecombine() function
> >>>
> >>>  arch/arm/include/asm/dma-mapping.h       | 16 ----------------
> >>>  include/asm-generic/dma-mapping-common.h |  8 --------
> >>>  include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
> >>>  3 files changed, 26 insertions(+), 24 deletions(-)
> >>Ping?
> >I have no problem with this, but I don't think I can say yes to it; that
> >depends whether other people are happy for this to live in
> >include/linux/dma-mapping.h.
> >
> >I guess consent for this change can only come by no one objecting to it
> >after several postings.
> 
> I will take this patch my dma-mapping-next tree and later send pull request
> to Linus, so it will be handled in a similar way as all other changes to
> generic dma-mapping subsystem done in last 2 years.

Okay, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

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

* [PATCH v2] dma-mapping: Provide write-combine allocations
@ 2014-08-21 13:24         ` Thierry Reding
  0 siblings, 0 replies; 12+ messages in thread
From: Thierry Reding @ 2014-08-21 13:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Aug 21, 2014 at 12:38:48PM +0200, Marek Szyprowski wrote:
> Hello,
> 
> On 2014-08-01 17:19, Russell King - ARM Linux wrote:
> >On Fri, Aug 01, 2014 at 02:40:59PM +0200, Thierry Reding wrote:
> >>On Fri, Jun 27, 2014 at 11:56:58AM +0200, Thierry Reding wrote:
> >>>From: Thierry Reding <treding@nvidia.com>
> >>>
> >>>Provide an implementation for dma_{alloc,free,mmap}_writecombine() when
> >>>the architecture supports DMA attributes.
> >>>
> >>>Signed-off-by: Thierry Reding <treding@nvidia.com>
> >>>---
> >>>Changes in v2:
> >>>- Add a generic dma_mmap_writecombine() function
> >>>
> >>>  arch/arm/include/asm/dma-mapping.h       | 16 ----------------
> >>>  include/asm-generic/dma-mapping-common.h |  8 --------
> >>>  include/linux/dma-mapping.h              | 26 ++++++++++++++++++++++++++
> >>>  3 files changed, 26 insertions(+), 24 deletions(-)
> >>Ping?
> >I have no problem with this, but I don't think I can say yes to it; that
> >depends whether other people are happy for this to live in
> >include/linux/dma-mapping.h.
> >
> >I guess consent for this change can only come by no one objecting to it
> >after several postings.
> 
> I will take this patch my dma-mapping-next tree and later send pull request
> to Linus, so it will be handled in a similar way as all other changes to
> generic dma-mapping subsystem done in last 2 years.

Okay, thanks.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140821/03c9969d/attachment.sig>

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

end of thread, other threads:[~2014-08-21 13:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-27  9:56 [PATCH v2] dma-mapping: Provide write-combine allocations Thierry Reding
2014-06-27  9:56 ` Thierry Reding
2014-08-01 12:40 ` Thierry Reding
2014-08-01 12:40   ` Thierry Reding
2014-08-01 15:19   ` Russell King - ARM Linux
2014-08-01 15:19     ` Russell King - ARM Linux
2014-08-21 10:38     ` Marek Szyprowski
2014-08-21 10:38       ` Marek Szyprowski
2014-08-21 13:24       ` Thierry Reding
2014-08-21 13:24         ` Thierry Reding
2014-08-01 12:55 ` Arnd Bergmann
2014-08-01 12:55   ` Arnd Bergmann

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.