[PATCH 21/27] target/ppc: cpu_init: Rename software TLB function

Fabiano Rosas posted 27 patches 3 years, 11 months ago
Maintainers: Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>
There is a newer version of this series
[PATCH 21/27] target/ppc: cpu_init: Rename software TLB function
Posted by Fabiano Rosas 3 years, 11 months ago
With the removal of the 7450 software TLB code, the only software TLBs
that we support currently are the 6xx and 7xx, so there's no need for
this function to indicate that in its name anymore.

Also, it's best to use a generic name for functions that are shared
and only mention the specific CPU name when the function applies only
to that (or similar) CPUs.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
 target/ppc/cpu_init.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index b4913e25de..3e687d0301 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -428,7 +428,7 @@ static void register_high_BATs(CPUPPCState *env)
 }
 
 /* Softare table search registers */
-static void register_6xx_7xx_soft_tlb(CPUPPCState *env, int nb_tlbs, int nb_ways)
+static void register_soft_tlb_sprs(CPUPPCState *env, int nb_tlbs, int nb_ways)
 {
 #if !defined(CONFIG_USER_ONLY)
     env->nb_tlb = nb_tlbs;
@@ -3029,7 +3029,7 @@ static void init_proc_G2(CPUPPCState *env)
     /* Memory management */
     register_low_BATs(env);
     register_high_BATs(env);
-    register_6xx_7xx_soft_tlb(env, 64, 2);
+    register_soft_tlb_sprs(env, 64, 2);
     init_excp_G2(env);
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
@@ -3738,7 +3738,7 @@ static void init_proc_603(CPUPPCState *env)
 
     /* Memory management */
     register_low_BATs(env);
-    register_6xx_7xx_soft_tlb(env, 64, 2);
+    register_soft_tlb_sprs(env, 64, 2);
     init_excp_603(env);
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
@@ -4499,7 +4499,7 @@ static void init_proc_745(CPUPPCState *env)
     /* Memory management */
     register_low_BATs(env);
     register_high_BATs(env);
-    register_6xx_7xx_soft_tlb(env, 64, 2);
+    register_soft_tlb_sprs(env, 64, 2);
     init_excp_7x5(env);
     env->dcache_line_size = 32;
     env->icache_line_size = 32;
-- 
2.34.1


Re: [PATCH 21/27] target/ppc: cpu_init: Rename software TLB function
Posted by David Gibson 3 years, 11 months ago
On Tue, Feb 15, 2022 at 06:41:42PM -0300, Fabiano Rosas wrote:
> With the removal of the 7450 software TLB code, the only software TLBs
> that we support currently are the 6xx and 7xx, so there's no need for
> this function to indicate that in its name anymore.

I don't think this is a good idea.  It may not have a function of a
similar name, but 40x and 44x certainly have a software tlb with an
entirely different programming model.  So I think it makes sense to
keep the 6xx/7xx reference here for clarity.

> 
> Also, it's best to use a generic name for functions that are shared
> and only mention the specific CPU name when the function applies only
> to that (or similar) CPUs.
> 
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
>  target/ppc/cpu_init.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index b4913e25de..3e687d0301 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -428,7 +428,7 @@ static void register_high_BATs(CPUPPCState *env)
>  }
>  
>  /* Softare table search registers */
> -static void register_6xx_7xx_soft_tlb(CPUPPCState *env, int nb_tlbs, int nb_ways)
> +static void register_soft_tlb_sprs(CPUPPCState *env, int nb_tlbs, int nb_ways)
>  {
>  #if !defined(CONFIG_USER_ONLY)
>      env->nb_tlb = nb_tlbs;
> @@ -3029,7 +3029,7 @@ static void init_proc_G2(CPUPPCState *env)
>      /* Memory management */
>      register_low_BATs(env);
>      register_high_BATs(env);
> -    register_6xx_7xx_soft_tlb(env, 64, 2);
> +    register_soft_tlb_sprs(env, 64, 2);
>      init_excp_G2(env);
>      env->dcache_line_size = 32;
>      env->icache_line_size = 32;
> @@ -3738,7 +3738,7 @@ static void init_proc_603(CPUPPCState *env)
>  
>      /* Memory management */
>      register_low_BATs(env);
> -    register_6xx_7xx_soft_tlb(env, 64, 2);
> +    register_soft_tlb_sprs(env, 64, 2);
>      init_excp_603(env);
>      env->dcache_line_size = 32;
>      env->icache_line_size = 32;
> @@ -4499,7 +4499,7 @@ static void init_proc_745(CPUPPCState *env)
>      /* Memory management */
>      register_low_BATs(env);
>      register_high_BATs(env);
> -    register_6xx_7xx_soft_tlb(env, 64, 2);
> +    register_soft_tlb_sprs(env, 64, 2);
>      init_excp_7x5(env);
>      env->dcache_line_size = 32;
>      env->icache_line_size = 32;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson