[PATCH] target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags

Philippe Mathieu-Daudé posted 1 patch 5 days, 20 hours ago
target/ppc/translate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags
Posted by Philippe Mathieu-Daudé 5 days, 20 hours ago
CF_NO_GOTO_PTR is a TB cflags bit, but it was tested against
tb->flags, where bit 10 is HFLAGS_SE. Use tb_cflags().

Fixes: 46d396bde988 ("target/ppc: enable PMU instruction count")
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
 target/ppc/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 467b8f3d4ec2..dccae25bb4ec 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -2645,7 +2645,7 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx)
          * tcg_gen_lookup_and_goto_ptr will exit the TB if
          * CF_NO_GOTO_PTR is set. Count insns now.
          */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
             pmu_count_insns(ctx);
         }
 
@@ -5160,7 +5160,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
          * tcg_gen_lookup_and_goto_ptr will exit the TB if
          * CF_NO_GOTO_PTR is set. Count insns now.
          */
-        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
+        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
             pmu_count_insns(ctx);
         }
 
-- 
2.55.0


Re: [PATCH] target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags
Posted by Chinmay Rath 4 days, 16 hours ago
On 11/17/26 13:38, Philippe Mathieu-Daudé wrote:
> CF_NO_GOTO_PTR is a TB cflags bit, but it was tested against
> tb->flags, where bit 10 is HFLAGS_SE. Use tb_cflags().
>
> Fixes: 46d396bde988 ("target/ppc: enable PMU instruction count")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
>   target/ppc/translate.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 467b8f3d4ec2..dccae25bb4ec 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -2645,7 +2645,7 @@ static void gen_lookup_and_goto_ptr(DisasContext *ctx)
>            * tcg_gen_lookup_and_goto_ptr will exit the TB if
>            * CF_NO_GOTO_PTR is set. Count insns now.
>            */
> -        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
> +        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
>               pmu_count_insns(ctx);
>           }
>   
> @@ -5160,7 +5160,7 @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
>            * tcg_gen_lookup_and_goto_ptr will exit the TB if
>            * CF_NO_GOTO_PTR is set. Count insns now.
>            */
> -        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
> +        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
>               pmu_count_insns(ctx);
>           }
Hi Philippe,
Thanks for addressing the review comments brought up by Anton and Matt 
on the original patch :
https://lore.kernel.org/qemu-devel/20261104163854.87398-1-richard.henderson@linaro.org/

I think it'd be correct to include the original "Reported-by" and 
"Reviewed-by"s from the above mentioned patch as well.

+cc : Matt and Anton

Regards,
Chinmay
>   

Re: [PATCH] target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags
Posted by Philippe Mathieu-Daudé 4 days, 13 hours ago
On 18/11/26 12:28, Chinmay Rath wrote:
> 
> On 11/17/26 13:38, Philippe Mathieu-Daudé wrote:
>> CF_NO_GOTO_PTR is a TB cflags bit, but it was tested against
>> tb->flags, where bit 10 is HFLAGS_SE. Use tb_cflags().
>>
>> Fixes: 46d396bde988 ("target/ppc: enable PMU instruction count")
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
>> ---
>>   target/ppc/translate.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
>> index 467b8f3d4ec2..dccae25bb4ec 100644
>> --- a/target/ppc/translate.c
>> +++ b/target/ppc/translate.c
>> @@ -2645,7 +2645,7 @@ static void gen_lookup_and_goto_ptr(DisasContext 
>> *ctx)
>>            * tcg_gen_lookup_and_goto_ptr will exit the TB if
>>            * CF_NO_GOTO_PTR is set. Count insns now.
>>            */
>> -        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
>> +        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
>>               pmu_count_insns(ctx);
>>           }
>> @@ -5160,7 +5160,7 @@ static void ppc_tr_tb_stop(DisasContextBase 
>> *dcbase, CPUState *cs)
>>            * tcg_gen_lookup_and_goto_ptr will exit the TB if
>>            * CF_NO_GOTO_PTR is set. Count insns now.
>>            */
>> -        if (ctx->base.tb->flags & CF_NO_GOTO_PTR) {
>> +        if (tb_cflags(ctx->base.tb) & CF_NO_GOTO_PTR) {
>>               pmu_count_insns(ctx);
>>           }
> Hi Philippe,
> Thanks for addressing the review comments brought up by Anton and Matt 
> on the original patch :
> https://lore.kernel.org/qemu-devel/20261104163854.87398-1- 
> richard.henderson@linaro.org/

Amusing, I was not aware of this patch, we figured it within a 2 week
interval :) The ppc_tr_tb_stop() path is not updated however. Richard,
do you rather respin your patch with the ppc_tr_tb_stop() change or
keep this one?

> 
> I think it'd be correct to include the original "Reported-by" and 
> "Reviewed-by"s from the above mentioned patch as well.

Sure.

> 
> +cc : Matt and Anton
> 
> Regards,
> Chinmay
> 


Re: [PATCH] target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags
Posted by Richard Henderson 4 days, 11 hours ago
On 11/18/26 06:33, Philippe Mathieu-Daudé wrote:
>> Hi Philippe,
>> Thanks for addressing the review comments brought up by Anton and Matt 
>> on the original patch :
>> https://lore.kernel.org/qemu-devel/20261104163854.87398-1- 
>> richard.henderson@linaro.org/
> 
> Amusing, I was not aware of this patch, we figured it within a 2 week
> interval :) The ppc_tr_tb_stop() path is not updated however. Richard,
> do you rather respin your patch with the ppc_tr_tb_stop() change or
> keep this one?
Keep this one, Phil.

r~

Re: [PATCH] target/ppc: Test CF_NO_GOTO_PTR in cflags, not in TB flags
Posted by Richard Henderson 5 days, 7 hours ago
On 11/17/26 00:08, Philippe Mathieu-Daudé wrote:
> CF_NO_GOTO_PTR is a TB cflags bit, but it was tested against
> tb->flags, where bit 10 is HFLAGS_SE. Use tb_cflags().
> 
> Fixes: 46d396bde988 ("target/ppc: enable PMU instruction count")
> Signed-off-by: Philippe Mathieu-Daudé<philmd@oss.qualcomm.com>
> ---
>   target/ppc/translate.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~