All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo()
@ 2017-08-14  8:50 Vladimir Murzin
  2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Mark atomic_pool as __ro_after_init Vladimir Murzin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Vladimir Murzin @ 2017-08-14  8:50 UTC (permalink / raw)
  To: linux-arm-kernel

gen_pool_first_fit_order_align() does not make use of additional data,
so pass plain NULL there.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/mm/dma-mapping.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index fcf1473..785606e 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -443,7 +443,7 @@ static int __init atomic_pool_init(void)
 
 		gen_pool_set_algo(atomic_pool,
 				gen_pool_first_fit_order_align,
-				(void *)PAGE_SHIFT);
+				NULL);
 		pr_info("DMA: preallocated %zu KiB pool for atomic coherent allocations\n",
 		       atomic_pool_size / 1024);
 		return 0;
-- 
2.0.0

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

* [PATCH] ARM: dma-mapping: Mark atomic_pool as __ro_after_init
  2017-08-14  8:50 [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo() Vladimir Murzin
@ 2017-08-14  8:50 ` Vladimir Murzin
  2017-09-04  8:20   ` Vladimir Murzin
  2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Remove init_dma_coherent_pool_size() Vladimir Murzin
  2017-09-04  8:20 ` [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo() Vladimir Murzin
  2 siblings, 1 reply; 6+ messages in thread
From: Vladimir Murzin @ 2017-08-14  8:50 UTC (permalink / raw)
  To: linux-arm-kernel

atomic_pool is setup once while init stage and never changed after
that, so it is good candidate for __ro_after_init.

Since we are here mark atomic_pool_size with __init_data.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/mm/dma-mapping.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 25a8bce..ada8eb2 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -382,9 +382,9 @@ static void __dma_free_remap(void *cpu_addr, size_t size)
 }
 
 #define DEFAULT_DMA_COHERENT_POOL_SIZE	SZ_256K
-static struct gen_pool *atomic_pool;
+static struct gen_pool *atomic_pool __ro_after_init;
 
-static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE;
+static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE;
 
 static int __init early_coherent_pool(char *p)
 {
-- 
2.0.0

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

* [PATCH] ARM: dma-mapping: Remove init_dma_coherent_pool_size()
  2017-08-14  8:50 [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo() Vladimir Murzin
  2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Mark atomic_pool as __ro_after_init Vladimir Murzin
@ 2017-08-14  8:50 ` Vladimir Murzin
  2017-09-04  8:21   ` Vladimir Murzin
  2017-09-04  8:20 ` [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo() Vladimir Murzin
  2 siblings, 1 reply; 6+ messages in thread
From: Vladimir Murzin @ 2017-08-14  8:50 UTC (permalink / raw)
  To: linux-arm-kernel

There are no users of init_dma_coherent_pool_size() left due to
387870f ("mm: dmapool: use provided gfp flags for all
dma_alloc_coherent() calls"), so remove it.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
 arch/arm/include/asm/dma-mapping.h |  7 -------
 arch/arm/mm/dma-mapping.c          | 15 ---------------
 2 files changed, 22 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 4e0285a..462803f 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -190,13 +190,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 			unsigned long 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
- * before postcore_initcall.
- */
-extern void __init init_dma_coherent_pool_size(unsigned long size);
-
-/*
  * For SA-1111, IXP425, and ADI systems  the dma-mapping functions are "magic"
  * and utilize bounce buffers as needed to work around limited DMA windows.
  *
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 785606e..25a8bce 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -393,21 +393,6 @@ static int __init early_coherent_pool(char *p)
 }
 early_param("coherent_pool", early_coherent_pool);
 
-void __init init_dma_coherent_pool_size(unsigned long size)
-{
-	/*
-	 * Catch any attempt to set the pool size too late.
-	 */
-	BUG_ON(atomic_pool);
-
-	/*
-	 * Set architecture specific coherent pool size only if
-	 * it has not been changed by kernel command line parameter.
-	 */
-	if (atomic_pool_size == DEFAULT_DMA_COHERENT_POOL_SIZE)
-		atomic_pool_size = size;
-}
-
 /*
  * Initialise the coherent pool for atomic allocations.
  */
-- 
2.0.0

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

* [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo()
  2017-08-14  8:50 [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo() Vladimir Murzin
  2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Mark atomic_pool as __ro_after_init Vladimir Murzin
  2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Remove init_dma_coherent_pool_size() Vladimir Murzin
@ 2017-09-04  8:20 ` Vladimir Murzin
  2 siblings, 0 replies; 6+ messages in thread
From: Vladimir Murzin @ 2017-09-04  8:20 UTC (permalink / raw)
  To: linux-arm-kernel

On 14/08/17 09:50, Vladimir Murzin wrote:
> gen_pool_first_fit_order_align() does not make use of additional data,
> so pass plain NULL there.
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
> ---
>  arch/arm/mm/dma-mapping.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index fcf1473..785606e 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -443,7 +443,7 @@ static int __init atomic_pool_init(void)
>  
>  		gen_pool_set_algo(atomic_pool,
>  				gen_pool_first_fit_order_align,
> -				(void *)PAGE_SHIFT);
> +				NULL);
>  		pr_info("DMA: preallocated %zu KiB pool for atomic coherent allocations\n",
>  		       atomic_pool_size / 1024);
>  		return 0;
> 

Ok for patch tracker?

Vladimir

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

* [PATCH] ARM: dma-mapping: Mark atomic_pool as __ro_after_init
  2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Mark atomic_pool as __ro_after_init Vladimir Murzin
@ 2017-09-04  8:20   ` Vladimir Murzin
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Murzin @ 2017-09-04  8:20 UTC (permalink / raw)
  To: linux-arm-kernel

On 14/08/17 09:50, Vladimir Murzin wrote:
> atomic_pool is setup once while init stage and never changed after
> that, so it is good candidate for __ro_after_init.
> 
> Since we are here mark atomic_pool_size with __init_data.
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
> ---
>  arch/arm/mm/dma-mapping.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index 25a8bce..ada8eb2 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -382,9 +382,9 @@ static void __dma_free_remap(void *cpu_addr, size_t size)
>  }
>  
>  #define DEFAULT_DMA_COHERENT_POOL_SIZE	SZ_256K
> -static struct gen_pool *atomic_pool;
> +static struct gen_pool *atomic_pool __ro_after_init;
>  
> -static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE;
> +static size_t atomic_pool_size __initdata = DEFAULT_DMA_COHERENT_POOL_SIZE;
>  
>  static int __init early_coherent_pool(char *p)
>  {
> 

Ok for patch tracker?

Vladimir

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

* [PATCH] ARM: dma-mapping: Remove init_dma_coherent_pool_size()
  2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Remove init_dma_coherent_pool_size() Vladimir Murzin
@ 2017-09-04  8:21   ` Vladimir Murzin
  0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Murzin @ 2017-09-04  8:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 14/08/17 09:50, Vladimir Murzin wrote:
> There are no users of init_dma_coherent_pool_size() left due to
> 387870f ("mm: dmapool: use provided gfp flags for all
> dma_alloc_coherent() calls"), so remove it.
> 
> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
> ---
>  arch/arm/include/asm/dma-mapping.h |  7 -------
>  arch/arm/mm/dma-mapping.c          | 15 ---------------
>  2 files changed, 22 deletions(-)
> 
> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> index 4e0285a..462803f 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -190,13 +190,6 @@ extern int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>  			unsigned long 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
> - * before postcore_initcall.
> - */
> -extern void __init init_dma_coherent_pool_size(unsigned long size);
> -
> -/*
>   * For SA-1111, IXP425, and ADI systems  the dma-mapping functions are "magic"
>   * and utilize bounce buffers as needed to work around limited DMA windows.
>   *
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index 785606e..25a8bce 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -393,21 +393,6 @@ static int __init early_coherent_pool(char *p)
>  }
>  early_param("coherent_pool", early_coherent_pool);
>  
> -void __init init_dma_coherent_pool_size(unsigned long size)
> -{
> -	/*
> -	 * Catch any attempt to set the pool size too late.
> -	 */
> -	BUG_ON(atomic_pool);
> -
> -	/*
> -	 * Set architecture specific coherent pool size only if
> -	 * it has not been changed by kernel command line parameter.
> -	 */
> -	if (atomic_pool_size == DEFAULT_DMA_COHERENT_POOL_SIZE)
> -		atomic_pool_size = size;
> -}
> -
>  /*
>   * Initialise the coherent pool for atomic allocations.
>   */
> 

Ok for patch tracker?

Vladimir

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

end of thread, other threads:[~2017-09-04  8:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14  8:50 [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo() Vladimir Murzin
2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Mark atomic_pool as __ro_after_init Vladimir Murzin
2017-09-04  8:20   ` Vladimir Murzin
2017-08-14  8:50 ` [PATCH] ARM: dma-mapping: Remove init_dma_coherent_pool_size() Vladimir Murzin
2017-09-04  8:21   ` Vladimir Murzin
2017-09-04  8:20 ` [PATCH] ARM: dma-mapping: Do not pass data to gen_pool_set_algo() Vladimir Murzin

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.