All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: octeon: Remove vestiges of CONFIG_CAVIUM_RESERVE32
@ 2021-07-13 17:49 Joe Perches
  2021-07-19 11:27 ` Thomas Bogendoerfer
  2022-07-21 12:19 ` Alexander Sverdlin
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Perches @ 2021-07-13 17:49 UTC (permalink / raw)
  To: David Daney; +Cc: Thomas Bogendoerfer, linux-mips, LKML

The config option CAVIUM_RESERVE32 is not used.
Remove the dead code controlled by it.

Signed-off-by: Joe Perches <joe@perches.com>
---

Uncompiled, untested.

Found using a grep for unused Kconfig entries:

$ git grep -P '^\s*#\s*if(?:def\s+|\s*defined\s*\(?\s*)CONFIG_[A-Z0-9_]+' | \
  grep -oh -P '\bCONFIG_[A-Z0-9_]+\b' | \
  sort | sed -e 's/^CONFIG_//' -e 's/_MODULE$//' | uniq | \
  while read config ; do \
    echo CONFIG_$config; \
    git grep -w $config -- '*/Kconfig*' | \
    wc -l; \
  done | \
  grep -B1 '^0'

with some additional inspection of the kernel source tree to verify.

 arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c | 21 +++---------
 arch/mips/cavium-octeon/setup.c                    | 38 +---------------------
 2 files changed, 5 insertions(+), 54 deletions(-)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
index 3839feba68f20..fb42e8e21ea0d 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
@@ -57,27 +57,14 @@ EXPORT_SYMBOL_GPL(__cvmx_cmd_queue_state_ptr);
 static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void)
 {
 	char *alloc_name = "cvmx_cmd_queues";
-#if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
-	extern uint64_t octeon_reserve32_memory;
-#endif
 
 	if (likely(__cvmx_cmd_queue_state_ptr))
 		return CVMX_CMD_QUEUE_SUCCESS;
 
-#if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
-	if (octeon_reserve32_memory)
-		__cvmx_cmd_queue_state_ptr =
-		    cvmx_bootmem_alloc_named_range(sizeof(*__cvmx_cmd_queue_state_ptr),
-						   octeon_reserve32_memory,
-						   octeon_reserve32_memory +
-						   (CONFIG_CAVIUM_RESERVE32 <<
-						    20) - 1, 128, alloc_name);
-	else
-#endif
-		__cvmx_cmd_queue_state_ptr =
-		    cvmx_bootmem_alloc_named(sizeof(*__cvmx_cmd_queue_state_ptr),
-					    128,
-					    alloc_name);
+	__cvmx_cmd_queue_state_ptr =
+		cvmx_bootmem_alloc_named(sizeof(*__cvmx_cmd_queue_state_ptr),
+					 128,
+					 alloc_name);
 	if (__cvmx_cmd_queue_state_ptr)
 		memset(__cvmx_cmd_queue_state_ptr, 0,
 		       sizeof(*__cvmx_cmd_queue_state_ptr));
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index ce4e2806159bb..0ddd3cc16ee47 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -284,11 +284,6 @@ void octeon_crash_smp_send_stop(void)
 
 #endif /* CONFIG_KEXEC */
 
-#ifdef CONFIG_CAVIUM_RESERVE32
-uint64_t octeon_reserve32_memory;
-EXPORT_SYMBOL(octeon_reserve32_memory);
-#endif
-
 #ifdef CONFIG_KEXEC
 /* crashkernel cmdline parameter is parsed _after_ memory setup
  * we also parse it here (workaround for EHB5200) */
@@ -665,9 +660,7 @@ void __init prom_init(void)
 	int i;
 	u64 t;
 	int argc;
-#ifdef CONFIG_CAVIUM_RESERVE32
-	int64_t addr = -1;
-#endif
+
 	/*
 	 * The bootloader passes a pointer to the boot descriptor in
 	 * $a3, this is available as fw_arg3.
@@ -782,25 +775,6 @@ void __init prom_init(void)
 		cvmx_write_csr(CVMX_LED_UDD_DATX(1), 0);
 		cvmx_write_csr(CVMX_LED_EN, 1);
 	}
-#ifdef CONFIG_CAVIUM_RESERVE32
-	/*
-	 * We need to temporarily allocate all memory in the reserve32
-	 * region. This makes sure the kernel doesn't allocate this
-	 * memory when it is getting memory from the
-	 * bootloader. Later, after the memory allocations are
-	 * complete, the reserve32 will be freed.
-	 *
-	 * Allocate memory for RESERVED32 aligned on 2MB boundary. This
-	 * is in case we later use hugetlb entries with it.
-	 */
-	addr = cvmx_bootmem_phy_named_block_alloc(CONFIG_CAVIUM_RESERVE32 << 20,
-						0, 0, 2 << 20,
-						"CAVIUM_RESERVE32", 0);
-	if (addr < 0)
-		pr_err("Failed to allocate CAVIUM_RESERVE32 memory area\n");
-	else
-		octeon_reserve32_memory = addr;
-#endif
 
 #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2
 	if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) {
@@ -1078,16 +1052,6 @@ void __init plat_mem_setup(void)
 	cvmx_bootmem_unlock();
 #endif /* CONFIG_CRASH_DUMP */
 
-#ifdef CONFIG_CAVIUM_RESERVE32
-	/*
-	 * Now that we've allocated the kernel memory it is safe to
-	 * free the reserved region. We free it here so that builtin
-	 * drivers can use the memory.
-	 */
-	if (octeon_reserve32_memory)
-		cvmx_bootmem_free_named("CAVIUM_RESERVE32");
-#endif /* CONFIG_CAVIUM_RESERVE32 */
-
 	if (total == 0)
 		panic("Unable to allocate memory from "
 		      "cvmx_bootmem_phy_alloc");


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

* Re: [PATCH] MIPS: octeon: Remove vestiges of CONFIG_CAVIUM_RESERVE32
  2021-07-13 17:49 [PATCH] MIPS: octeon: Remove vestiges of CONFIG_CAVIUM_RESERVE32 Joe Perches
@ 2021-07-19 11:27 ` Thomas Bogendoerfer
  2022-07-21 12:19 ` Alexander Sverdlin
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2021-07-19 11:27 UTC (permalink / raw)
  To: Joe Perches; +Cc: David Daney, linux-mips, LKML

On Tue, Jul 13, 2021 at 10:49:15AM -0700, Joe Perches wrote:
> The config option CAVIUM_RESERVE32 is not used.
> Remove the dead code controlled by it.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> Uncompiled, untested.
> 
> Found using a grep for unused Kconfig entries:
> 
> $ git grep -P '^\s*#\s*if(?:def\s+|\s*defined\s*\(?\s*)CONFIG_[A-Z0-9_]+' | \
>   grep -oh -P '\bCONFIG_[A-Z0-9_]+\b' | \
>   sort | sed -e 's/^CONFIG_//' -e 's/_MODULE$//' | uniq | \
>   while read config ; do \
>     echo CONFIG_$config; \
>     git grep -w $config -- '*/Kconfig*' | \
>     wc -l; \
>   done | \
>   grep -B1 '^0'
> 
> with some additional inspection of the kernel source tree to verify.
> 
>  arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c | 21 +++---------
>  arch/mips/cavium-octeon/setup.c                    | 38 +---------------------

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: [PATCH] MIPS: octeon: Remove vestiges of CONFIG_CAVIUM_RESERVE32
  2021-07-13 17:49 [PATCH] MIPS: octeon: Remove vestiges of CONFIG_CAVIUM_RESERVE32 Joe Perches
  2021-07-19 11:27 ` Thomas Bogendoerfer
@ 2022-07-21 12:19 ` Alexander Sverdlin
  2022-07-22  7:53   ` Joe Perches
  1 sibling, 1 reply; 4+ messages in thread
From: Alexander Sverdlin @ 2022-07-21 12:19 UTC (permalink / raw)
  To: Joe Perches, David Daney; +Cc: Thomas Bogendoerfer, linux-mips, LKML

Hello Joe!

On 13/07/2021 19:49, Joe Perches wrote:
> The config option CAVIUM_RESERVE32 is not used.

We use it. Does it make sense that I submit a revert and a patch adding the option to Kconfig?

> Remove the dead code controlled by it.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> Uncompiled, untested.
> 
> Found using a grep for unused Kconfig entries:
> 
> $ git grep -P '^\s*#\s*if(?:def\s+|\s*defined\s*\(?\s*)CONFIG_[A-Z0-9_]+' | \
>   grep -oh -P '\bCONFIG_[A-Z0-9_]+\b' | \
>   sort | sed -e 's/^CONFIG_//' -e 's/_MODULE$//' | uniq | \
>   while read config ; do \
>     echo CONFIG_$config; \
>     git grep -w $config -- '*/Kconfig*' | \
>     wc -l; \
>   done | \
>   grep -B1 '^0'
> 
> with some additional inspection of the kernel source tree to verify.
> 
>  arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c | 21 +++---------
>  arch/mips/cavium-octeon/setup.c                    | 38 +---------------------
>  2 files changed, 5 insertions(+), 54 deletions(-)
> 
> diff --git a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
> index 3839feba68f20..fb42e8e21ea0d 100644
> --- a/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
> +++ b/arch/mips/cavium-octeon/executive/cvmx-cmd-queue.c
> @@ -57,27 +57,14 @@ EXPORT_SYMBOL_GPL(__cvmx_cmd_queue_state_ptr);
>  static cvmx_cmd_queue_result_t __cvmx_cmd_queue_init_state_ptr(void)
>  {
>  	char *alloc_name = "cvmx_cmd_queues";
> -#if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
> -	extern uint64_t octeon_reserve32_memory;
> -#endif
>  
>  	if (likely(__cvmx_cmd_queue_state_ptr))
>  		return CVMX_CMD_QUEUE_SUCCESS;
>  
> -#if defined(CONFIG_CAVIUM_RESERVE32) && CONFIG_CAVIUM_RESERVE32
> -	if (octeon_reserve32_memory)
> -		__cvmx_cmd_queue_state_ptr =
> -		    cvmx_bootmem_alloc_named_range(sizeof(*__cvmx_cmd_queue_state_ptr),
> -						   octeon_reserve32_memory,
> -						   octeon_reserve32_memory +
> -						   (CONFIG_CAVIUM_RESERVE32 <<
> -						    20) - 1, 128, alloc_name);
> -	else
> -#endif
> -		__cvmx_cmd_queue_state_ptr =
> -		    cvmx_bootmem_alloc_named(sizeof(*__cvmx_cmd_queue_state_ptr),
> -					    128,
> -					    alloc_name);
> +	__cvmx_cmd_queue_state_ptr =
> +		cvmx_bootmem_alloc_named(sizeof(*__cvmx_cmd_queue_state_ptr),
> +					 128,
> +					 alloc_name);
>  	if (__cvmx_cmd_queue_state_ptr)
>  		memset(__cvmx_cmd_queue_state_ptr, 0,
>  		       sizeof(*__cvmx_cmd_queue_state_ptr));
> diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
> index ce4e2806159bb..0ddd3cc16ee47 100644
> --- a/arch/mips/cavium-octeon/setup.c
> +++ b/arch/mips/cavium-octeon/setup.c
> @@ -284,11 +284,6 @@ void octeon_crash_smp_send_stop(void)
>  
>  #endif /* CONFIG_KEXEC */
>  
> -#ifdef CONFIG_CAVIUM_RESERVE32
> -uint64_t octeon_reserve32_memory;
> -EXPORT_SYMBOL(octeon_reserve32_memory);
> -#endif
> -
>  #ifdef CONFIG_KEXEC
>  /* crashkernel cmdline parameter is parsed _after_ memory setup
>   * we also parse it here (workaround for EHB5200) */
> @@ -665,9 +660,7 @@ void __init prom_init(void)
>  	int i;
>  	u64 t;
>  	int argc;
> -#ifdef CONFIG_CAVIUM_RESERVE32
> -	int64_t addr = -1;
> -#endif
> +
>  	/*
>  	 * The bootloader passes a pointer to the boot descriptor in
>  	 * $a3, this is available as fw_arg3.
> @@ -782,25 +775,6 @@ void __init prom_init(void)
>  		cvmx_write_csr(CVMX_LED_UDD_DATX(1), 0);
>  		cvmx_write_csr(CVMX_LED_EN, 1);
>  	}
> -#ifdef CONFIG_CAVIUM_RESERVE32
> -	/*
> -	 * We need to temporarily allocate all memory in the reserve32
> -	 * region. This makes sure the kernel doesn't allocate this
> -	 * memory when it is getting memory from the
> -	 * bootloader. Later, after the memory allocations are
> -	 * complete, the reserve32 will be freed.
> -	 *
> -	 * Allocate memory for RESERVED32 aligned on 2MB boundary. This
> -	 * is in case we later use hugetlb entries with it.
> -	 */
> -	addr = cvmx_bootmem_phy_named_block_alloc(CONFIG_CAVIUM_RESERVE32 << 20,
> -						0, 0, 2 << 20,
> -						"CAVIUM_RESERVE32", 0);
> -	if (addr < 0)
> -		pr_err("Failed to allocate CAVIUM_RESERVE32 memory area\n");
> -	else
> -		octeon_reserve32_memory = addr;
> -#endif
>  
>  #ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2
>  	if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) {
> @@ -1078,16 +1052,6 @@ void __init plat_mem_setup(void)
>  	cvmx_bootmem_unlock();
>  #endif /* CONFIG_CRASH_DUMP */
>  
> -#ifdef CONFIG_CAVIUM_RESERVE32
> -	/*
> -	 * Now that we've allocated the kernel memory it is safe to
> -	 * free the reserved region. We free it here so that builtin
> -	 * drivers can use the memory.
> -	 */
> -	if (octeon_reserve32_memory)
> -		cvmx_bootmem_free_named("CAVIUM_RESERVE32");
> -#endif /* CONFIG_CAVIUM_RESERVE32 */
> -
>  	if (total == 0)
>  		panic("Unable to allocate memory from "
>  		      "cvmx_bootmem_phy_alloc");
> 
> 

-- 
Best regards,
Alexander Sverdlin.

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

* Re: [PATCH] MIPS: octeon: Remove vestiges of CONFIG_CAVIUM_RESERVE32
  2022-07-21 12:19 ` Alexander Sverdlin
@ 2022-07-22  7:53   ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2022-07-22  7:53 UTC (permalink / raw)
  To: Alexander Sverdlin, David Daney; +Cc: Thomas Bogendoerfer, linux-mips, LKML

On Thu, 2022-07-21 at 14:19 +0200, Alexander Sverdlin wrote:
> Hello Joe!
> 
> On 13/07/2021 19:49, Joe Perches wrote:
> > The config option CAVIUM_RESERVE32 is not used.
> 
> We use it. Does it make sense that I submit a revert and a patch adding the option to Kconfig?

yes.


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

end of thread, other threads:[~2022-07-22  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 17:49 [PATCH] MIPS: octeon: Remove vestiges of CONFIG_CAVIUM_RESERVE32 Joe Perches
2021-07-19 11:27 ` Thomas Bogendoerfer
2022-07-21 12:19 ` Alexander Sverdlin
2022-07-22  7:53   ` Joe Perches

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.