diff mbox series

[v2,1/3] target/ppc: Turn ppc_tlb_invalid_all in a noop

Message ID 20210610164648.83878-2-lucas.araujo@eldorado.org.br (mailing list archive)
State New, archived
Headers show
Series target/ppc: mmu cleanup | expand

Commit Message

Lucas Mateus Martins Araujo e Castro June 10, 2021, 4:46 p.m. UTC
The function ppc_tlb_invalid_all is now a no op when compiling without TCG.

Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
---
 target/ppc/mmu_helper.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bruno Larsen (billionai) June 10, 2021, 5:07 p.m. UTC | #1
On 10/06/2021 13:46, Lucas Mateus Castro (alqotel) wrote:
> The function ppc_tlb_invalid_all is now a no op when compiling without TCG.
>
> Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
> ---
>   target/ppc/mmu_helper.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index 1ecb36e85a..e7ba39c9e1 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -825,6 +825,7 @@ static int mmubooke_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
>       return ret;
>   }
>   
> +#ifdef CONFIG_TCG
>   static void booke206_flush_tlb(CPUPPCState *env, int flags,
>                                  const int check_iprot)
>   {
> @@ -846,6 +847,7 @@ static void booke206_flush_tlb(CPUPPCState *env, int flags,
>   
>       tlb_flush(env_cpu(env));
>   }
> +#endif
I think you could use ATTRIBUTE_UNUSED instead of ifdefs here. Not sure 
which would be preferable in this case, but IMHO unused is a bit more 
informative as to what is happening...
>   
>   static hwaddr booke206_tlb_to_page_size(CPUPPCState *env,
>                                           ppcmas_tlb_t *tlb)
> @@ -1956,6 +1958,7 @@ void helper_store_601_batl(CPUPPCState *env, uint32_t nr, target_ulong value)
>   /* TLB management */
>   void ppc_tlb_invalidate_all(CPUPPCState *env)
>   {
> +#ifdef CONFIG_TCG
>   #if defined(TARGET_PPC64)
>       if (mmu_is_64bit(env->mmu_model)) {
>           env->tlb_need_flush = 0;
> @@ -1994,6 +1997,7 @@ void ppc_tlb_invalidate_all(CPUPPCState *env)
>           cpu_abort(env_cpu(env), "Unknown MMU model %x\n", env->mmu_model);
>           break;
>       }
> +#endif
>   }
>   
>   #ifdef CONFIG_TCG
David Gibson June 15, 2021, 5:38 a.m. UTC | #2
On Thu, Jun 10, 2021 at 01:46:46PM -0300, Lucas Mateus Castro (alqotel) wrote:
> The function ppc_tlb_invalid_all is now a no op when compiling without TCG.
> 
> Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>


Hm, I think I suggested making ppc_tlb_invalidate_all() a stub, rather
than removing the call from !TCG code.  But looking at this again, I
think that was a mistake.  I think it makes more sense to suppress
this on the caller side, and make this a TCG only function.

> ---
>  target/ppc/mmu_helper.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index 1ecb36e85a..e7ba39c9e1 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -825,6 +825,7 @@ static int mmubooke_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
>      return ret;
>  }
>  
> +#ifdef CONFIG_TCG
>  static void booke206_flush_tlb(CPUPPCState *env, int flags,
>                                 const int check_iprot)
>  {
> @@ -846,6 +847,7 @@ static void booke206_flush_tlb(CPUPPCState *env, int flags,
>  
>      tlb_flush(env_cpu(env));
>  }
> +#endif
>  
>  static hwaddr booke206_tlb_to_page_size(CPUPPCState *env,
>                                          ppcmas_tlb_t *tlb)
> @@ -1956,6 +1958,7 @@ void helper_store_601_batl(CPUPPCState *env, uint32_t nr, target_ulong value)
>  /* TLB management */
>  void ppc_tlb_invalidate_all(CPUPPCState *env)
>  {
> +#ifdef CONFIG_TCG
>  #if defined(TARGET_PPC64)
>      if (mmu_is_64bit(env->mmu_model)) {
>          env->tlb_need_flush = 0;
> @@ -1994,6 +1997,7 @@ void ppc_tlb_invalidate_all(CPUPPCState *env)
>          cpu_abort(env_cpu(env), "Unknown MMU model %x\n", env->mmu_model);
>          break;
>      }
> +#endif
>  }
>  
>  #ifdef CONFIG_TCG
Lucas Mateus Martins Araujo e Castro June 15, 2021, 4:24 p.m. UTC | #3
On 15/06/2021 02:38, David Gibson wrote:
> On Thu, Jun 10, 2021 at 01:46:46PM -0300, Lucas Mateus Castro (alqotel) wrote:
>> The function ppc_tlb_invalid_all is now a no op when compiling without TCG.
>>
>> Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
>
> Hm, I think I suggested making ppc_tlb_invalidate_all() a stub, rather
> than removing the call from !TCG code.  But looking at this again, I
> think that was a mistake.  I think it makes more sense to suppress
> this on the caller side, and make this a TCG only function.
Ok, I'll add the if in ppc_cpu_reset that calls ppc_tlb_invalidate_all 
to an #ifdef CONFIG_TCG block, as Fabiano suggested last patch.
diff mbox series

Patch

diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 1ecb36e85a..e7ba39c9e1 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -825,6 +825,7 @@  static int mmubooke_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,
     return ret;
 }
 
+#ifdef CONFIG_TCG
 static void booke206_flush_tlb(CPUPPCState *env, int flags,
                                const int check_iprot)
 {
@@ -846,6 +847,7 @@  static void booke206_flush_tlb(CPUPPCState *env, int flags,
 
     tlb_flush(env_cpu(env));
 }
+#endif
 
 static hwaddr booke206_tlb_to_page_size(CPUPPCState *env,
                                         ppcmas_tlb_t *tlb)
@@ -1956,6 +1958,7 @@  void helper_store_601_batl(CPUPPCState *env, uint32_t nr, target_ulong value)
 /* TLB management */
 void ppc_tlb_invalidate_all(CPUPPCState *env)
 {
+#ifdef CONFIG_TCG
 #if defined(TARGET_PPC64)
     if (mmu_is_64bit(env->mmu_model)) {
         env->tlb_need_flush = 0;
@@ -1994,6 +1997,7 @@  void ppc_tlb_invalidate_all(CPUPPCState *env)
         cpu_abort(env_cpu(env), "Unknown MMU model %x\n", env->mmu_model);
         break;
     }
+#endif
 }
 
 #ifdef CONFIG_TCG