diff mbox series

This patch fixes processing of rfi instructions in icount mode.

Message ID 20181030122134.11055.15711.stgit@pasha-VirtualBox (mailing list archive)
State New, archived
Headers show
Series This patch fixes processing of rfi instructions in icount mode. | expand

Commit Message

Pavel Dovgalyuk Oct. 30, 2018, 12:21 p.m. UTC
From: Maria Klimushenkova <maria.klimushenkova@ispras.ru>

In this mode writing to interrupt/peripheral state is controlled
by can_do_io flag. This flag must be set explicitly before helper
function invocation.

Signed-off-by: Maria Klimushenkova <maria.klimushenkova@ispras.ru>
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 target/ppc/translate.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Mark Cave-Ayland Nov. 7, 2018, 6:25 p.m. UTC | #1
On 30/10/2018 12:21, Pavel Dovgalyuk wrote:

> From: Maria Klimushenkova <maria.klimushenkova@ispras.ru>
> 
> In this mode writing to interrupt/peripheral state is controlled
> by can_do_io flag. This flag must be set explicitly before helper
> function invocation.
> 
> Signed-off-by: Maria Klimushenkova <maria.klimushenkova@ispras.ru>
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> ---
>  target/ppc/translate.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 987ce6e..980862c 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -3878,9 +3878,15 @@ static void gen_rfi(DisasContext *ctx)
>      }
>      /* Restore CPU state */
>      CHK_SV;
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_start();
> +    }
>      gen_update_cfar(ctx, ctx->base.pc_next - 4);
>      gen_helper_rfi(cpu_env);
>      gen_sync_exception(ctx);
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_end();
> +    }
>  #endif
>  }
>  
> @@ -3892,9 +3898,15 @@ static void gen_rfid(DisasContext *ctx)
>  #else
>      /* Restore CPU state */
>      CHK_SV;
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_start();
> +    }
>      gen_update_cfar(ctx, ctx->base.pc_next - 4);
>      gen_helper_rfid(cpu_env);
>      gen_sync_exception(ctx);
> +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +        gen_io_end();
> +    }
>  #endif
>  }

I've given this patch a spin on top of ppc-for-3.1 and it allows my test images to
boot with icount enabled without asserting, so:

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
David Gibson Nov. 8, 2018, 1:09 a.m. UTC | #2
On Wed, Nov 07, 2018 at 06:25:19PM +0000, Mark Cave-Ayland wrote:
> On 30/10/2018 12:21, Pavel Dovgalyuk wrote:
> 
> > From: Maria Klimushenkova <maria.klimushenkova@ispras.ru>
> > 
> > In this mode writing to interrupt/peripheral state is controlled
> > by can_do_io flag. This flag must be set explicitly before helper
> > function invocation.
> > 
> > Signed-off-by: Maria Klimushenkova <maria.klimushenkova@ispras.ru>
> > Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> > ---
> >  target/ppc/translate.c |   12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> > index 987ce6e..980862c 100644
> > --- a/target/ppc/translate.c
> > +++ b/target/ppc/translate.c
> > @@ -3878,9 +3878,15 @@ static void gen_rfi(DisasContext *ctx)
> >      }
> >      /* Restore CPU state */
> >      CHK_SV;
> > +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> > +        gen_io_start();
> > +    }
> >      gen_update_cfar(ctx, ctx->base.pc_next - 4);
> >      gen_helper_rfi(cpu_env);
> >      gen_sync_exception(ctx);
> > +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> > +        gen_io_end();
> > +    }
> >  #endif
> >  }
> >  
> > @@ -3892,9 +3898,15 @@ static void gen_rfid(DisasContext *ctx)
> >  #else
> >      /* Restore CPU state */
> >      CHK_SV;
> > +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> > +        gen_io_start();
> > +    }
> >      gen_update_cfar(ctx, ctx->base.pc_next - 4);
> >      gen_helper_rfid(cpu_env);
> >      gen_sync_exception(ctx);
> > +    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> > +        gen_io_end();
> > +    }
> >  #endif
> >  }
> 
> I've given this patch a spin on top of ppc-for-3.1 and it allows my test images to
> boot with icount enabled without asserting, so:
> 
> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Good enough for me.  Applied to ppc-for-3.1.
diff mbox series

Patch

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 987ce6e..980862c 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -3878,9 +3878,15 @@  static void gen_rfi(DisasContext *ctx)
     }
     /* Restore CPU state */
     CHK_SV;
+    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+        gen_io_start();
+    }
     gen_update_cfar(ctx, ctx->base.pc_next - 4);
     gen_helper_rfi(cpu_env);
     gen_sync_exception(ctx);
+    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+        gen_io_end();
+    }
 #endif
 }
 
@@ -3892,9 +3898,15 @@  static void gen_rfid(DisasContext *ctx)
 #else
     /* Restore CPU state */
     CHK_SV;
+    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+        gen_io_start();
+    }
     gen_update_cfar(ctx, ctx->base.pc_next - 4);
     gen_helper_rfid(cpu_env);
     gen_sync_exception(ctx);
+    if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+        gen_io_end();
+    }
 #endif
 }