Re: [Qemu-devel] [PATCH v3 3/3] target-ppc: tlbie should have global effect

2016-09-12 Thread Nikunj A Dadhania
Benjamin Herrenschmidt  writes:

> On Mon, 2016-09-12 at 11:18 +0530, Nikunj A Dadhania wrote:
>> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
>> index 5026804..d96ff66 100644
>> --- a/target-ppc/translate.c
>> +++ b/target-ppc/translate.c
>> @@ -4448,6 +4448,7 @@ static void gen_tlbie(DisasContext *ctx)
>>  #if defined(CONFIG_USER_ONLY)
>>  GEN_PRIV;
>>  #else
>> +    TCGv_i32 t1;
>>  CHK_HV;
>>  
>>  if (NARROW_MODE(ctx)) {
>> @@ -4458,6 +4459,11 @@ static void gen_tlbie(DisasContext *ctx)
>>  } else {
>>  gen_helper_tlbie(cpu_env, cpu_gpr[rB(ctx->opcode)]);
>>  }
>> +    t1 = tcg_temp_new_i32();
>> +    tcg_gen_ld_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush));
>> +    tcg_gen_ori_i32(t1, t1, TLB_NEED_GLOBAL_FLUSH);
>> +    tcg_gen_st_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush));
>> +    tcg_temp_free_i32(t1);
>>  #endif /* defined(CONFIG_USER_ONLY) */
>
> Why not do this in the helper ? 

Ah ok, now I recall: If I need to do this in helper:

* I will need to split tlbie and tlbiel
  OR
* Add a new argument in helper_tlbie

So, I thought of doing this in tcg.

Regards
Nikunj




Re: [Qemu-devel] [PATCH v3 3/3] target-ppc: tlbie should have global effect

2016-09-12 Thread Nikunj A Dadhania
Benjamin Herrenschmidt  writes:

> On Mon, 2016-09-12 at 11:18 +0530, Nikunj A Dadhania wrote:
>> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
>> index 5026804..d96ff66 100644
>> --- a/target-ppc/translate.c
>> +++ b/target-ppc/translate.c
>> @@ -4448,6 +4448,7 @@ static void gen_tlbie(DisasContext *ctx)
>>  #if defined(CONFIG_USER_ONLY)
>>  GEN_PRIV;
>>  #else
>> +    TCGv_i32 t1;
>>  CHK_HV;
>>  
>>  if (NARROW_MODE(ctx)) {
>> @@ -4458,6 +4459,11 @@ static void gen_tlbie(DisasContext *ctx)
>>  } else {
>>  gen_helper_tlbie(cpu_env, cpu_gpr[rB(ctx->opcode)]);
>>  }
>> +    t1 = tcg_temp_new_i32();
>> +    tcg_gen_ld_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush));
>> +    tcg_gen_ori_i32(t1, t1, TLB_NEED_GLOBAL_FLUSH);
>> +    tcg_gen_st_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush));
>> +    tcg_temp_free_i32(t1);
>>  #endif /* defined(CONFIG_USER_ONLY) */
>
> Why not do this in the helper ? 

No particular reason though, I can do it there as well.

Regards
Nikunj




Re: [Qemu-devel] [PATCH v3 3/3] target-ppc: tlbie should have global effect

2016-09-12 Thread Benjamin Herrenschmidt
On Mon, 2016-09-12 at 11:18 +0530, Nikunj A Dadhania wrote:
> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
> index 5026804..d96ff66 100644
> --- a/target-ppc/translate.c
> +++ b/target-ppc/translate.c
> @@ -4448,6 +4448,7 @@ static void gen_tlbie(DisasContext *ctx)
>  #if defined(CONFIG_USER_ONLY)
>  GEN_PRIV;
>  #else
> +    TCGv_i32 t1;
>  CHK_HV;
>  
>  if (NARROW_MODE(ctx)) {
> @@ -4458,6 +4459,11 @@ static void gen_tlbie(DisasContext *ctx)
>  } else {
>  gen_helper_tlbie(cpu_env, cpu_gpr[rB(ctx->opcode)]);
>  }
> +    t1 = tcg_temp_new_i32();
> +    tcg_gen_ld_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush));
> +    tcg_gen_ori_i32(t1, t1, TLB_NEED_GLOBAL_FLUSH);
> +    tcg_gen_st_i32(t1, cpu_env, offsetof(CPUPPCState, tlb_need_flush));
> +    tcg_temp_free_i32(t1);
>  #endif /* defined(CONFIG_USER_ONLY) */

Why not do this in the helper ? 

Cheers,
Ben.