All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount
@ 2018-10-30  9:30 Pavel Dovgalyuk
  2018-10-31 10:48 ` Richard Henderson
  2018-11-03 13:25 ` David Gibson
  0 siblings, 2 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2018-10-30  9:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: maria.klimushenkova, dovgaluk, agraf, pavel.dovgaluk, david

This patch fixes processing of mtmsr instructions in icount mode.
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 4e59dd5..987ce6e 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -4257,11 +4257,17 @@ static void gen_mtmsrd(DisasContext *ctx)
          *      if we enter power saving mode, we will exit the loop
          *      directly from ppc_store_msr
          */
+        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+            gen_io_start();
+        }
         gen_update_nip(ctx, ctx->base.pc_next);
         gen_helper_store_msr(cpu_env, cpu_gpr[rS(ctx->opcode)]);
         /* Must stop the translation as machine state (may have) changed */
         /* Note that mtmsr is not always defined as context-synchronizing */
         gen_stop_exception(ctx);
+        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+            gen_io_end();
+        }
     }
 #endif /* !defined(CONFIG_USER_ONLY) */
 }
@@ -4286,6 +4292,9 @@ static void gen_mtmsr(DisasContext *ctx)
          *      if we enter power saving mode, we will exit the loop
          *      directly from ppc_store_msr
          */
+        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+            gen_io_start();
+        }
         gen_update_nip(ctx, ctx->base.pc_next);
 #if defined(TARGET_PPC64)
         tcg_gen_deposit_tl(msr, cpu_msr, cpu_gpr[rS(ctx->opcode)], 0, 32);
@@ -4293,6 +4302,9 @@ static void gen_mtmsr(DisasContext *ctx)
         tcg_gen_mov_tl(msr, cpu_gpr[rS(ctx->opcode)]);
 #endif
         gen_helper_store_msr(cpu_env, msr);
+        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
+            gen_io_end();
+        }
         tcg_temp_free(msr);
         /* Must stop the translation as machine state (may have) changed */
         /* Note that mtmsr is not always defined as context-synchronizing */

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount
  2018-10-30  9:30 [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount Pavel Dovgalyuk
@ 2018-10-31 10:48 ` Richard Henderson
  2018-11-07  7:51   ` Pavel Dovgalyuk
  2018-11-03 13:25 ` David Gibson
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2018-10-31 10:48 UTC (permalink / raw)
  To: Pavel Dovgalyuk, qemu-devel; +Cc: maria.klimushenkova, dovgaluk, agraf, david

On 10/30/18 9:30 AM, Pavel Dovgalyuk wrote:
> This patch fixes processing of mtmsr instructions in icount mode.
> 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(+)

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


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount
  2018-10-30  9:30 [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount Pavel Dovgalyuk
  2018-10-31 10:48 ` Richard Henderson
@ 2018-11-03 13:25 ` David Gibson
  2018-11-06  6:10   ` Pavel Dovgalyuk
  1 sibling, 1 reply; 7+ messages in thread
From: David Gibson @ 2018-11-03 13:25 UTC (permalink / raw)
  To: Pavel Dovgalyuk; +Cc: qemu-devel, maria.klimushenkova, dovgaluk, agraf

[-- Attachment #1: Type: text/plain, Size: 2666 bytes --]

On Tue, Oct 30, 2018 at 12:30:31PM +0300, Pavel Dovgalyuk wrote:
> This patch fixes processing of mtmsr instructions in icount mode.
> 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>

Applied to ppc-for-3.1, thanks.

> ---
>  target/ppc/translate.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 4e59dd5..987ce6e 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -4257,11 +4257,17 @@ static void gen_mtmsrd(DisasContext *ctx)
>           *      if we enter power saving mode, we will exit the loop
>           *      directly from ppc_store_msr
>           */
> +        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +            gen_io_start();
> +        }
>          gen_update_nip(ctx, ctx->base.pc_next);
>          gen_helper_store_msr(cpu_env, cpu_gpr[rS(ctx->opcode)]);
>          /* Must stop the translation as machine state (may have) changed */
>          /* Note that mtmsr is not always defined as context-synchronizing */
>          gen_stop_exception(ctx);
> +        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +            gen_io_end();
> +        }
>      }
>  #endif /* !defined(CONFIG_USER_ONLY) */
>  }
> @@ -4286,6 +4292,9 @@ static void gen_mtmsr(DisasContext *ctx)
>           *      if we enter power saving mode, we will exit the loop
>           *      directly from ppc_store_msr
>           */
> +        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +            gen_io_start();
> +        }
>          gen_update_nip(ctx, ctx->base.pc_next);
>  #if defined(TARGET_PPC64)
>          tcg_gen_deposit_tl(msr, cpu_msr, cpu_gpr[rS(ctx->opcode)], 0, 32);
> @@ -4293,6 +4302,9 @@ static void gen_mtmsr(DisasContext *ctx)
>          tcg_gen_mov_tl(msr, cpu_gpr[rS(ctx->opcode)]);
>  #endif
>          gen_helper_store_msr(cpu_env, msr);
> +        if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) {
> +            gen_io_end();
> +        }
>          tcg_temp_free(msr);
>          /* Must stop the translation as machine state (may have) changed */
>          /* Note that mtmsr is not always defined as context-synchronizing */
> 

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount
  2018-11-03 13:25 ` David Gibson
@ 2018-11-06  6:10   ` Pavel Dovgalyuk
  2018-11-06 12:20     ` 'David Gibson'
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Dovgalyuk @ 2018-11-06  6:10 UTC (permalink / raw)
  To: 'David Gibson', 'Pavel Dovgalyuk'
  Cc: qemu-devel, maria.klimushenkova, agraf

> From: David Gibson [mailto:david@gibson.dropbear.id.au]
> On Tue, Oct 30, 2018 at 12:30:31PM +0300, Pavel Dovgalyuk wrote:
> > This patch fixes processing of mtmsr instructions in icount mode.
> > 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>
> 
> Applied to ppc-for-3.1, thanks.

Thanks. What about this one
https://patchew.org/QEMU/20181030122134.11055.15711.stgit@pasha-VirtualBox/
There is a mess with the subject, but the code is ok :)


Pavel Dovgalyuk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount
  2018-11-06  6:10   ` Pavel Dovgalyuk
@ 2018-11-06 12:20     ` 'David Gibson'
  2018-11-07 18:33       ` Mark Cave-Ayland
  0 siblings, 1 reply; 7+ messages in thread
From: 'David Gibson' @ 2018-11-06 12:20 UTC (permalink / raw)
  To: Pavel Dovgalyuk
  Cc: 'Pavel Dovgalyuk', qemu-devel, maria.klimushenkova, agraf

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]

On Tue, Nov 06, 2018 at 09:10:45AM +0300, Pavel Dovgalyuk wrote:
> > From: David Gibson [mailto:david@gibson.dropbear.id.au]
> > On Tue, Oct 30, 2018 at 12:30:31PM +0300, Pavel Dovgalyuk wrote:
> > > This patch fixes processing of mtmsr instructions in icount mode.
> > > 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>
> > 
> > Applied to ppc-for-3.1, thanks.
> 
> Thanks. What about this one
> https://patchew.org/QEMU/20181030122134.11055.15711.stgit@pasha-VirtualBox/
> There is a mess with the subject, but the code is ok :)

I've been procrastinating on that because I don't understand icount
well enough to review it easily, and no-one has replied with
Reviewed-by or Tested-by.

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount
  2018-10-31 10:48 ` Richard Henderson
@ 2018-11-07  7:51   ` Pavel Dovgalyuk
  0 siblings, 0 replies; 7+ messages in thread
From: Pavel Dovgalyuk @ 2018-11-07  7:51 UTC (permalink / raw)
  To: 'Richard Henderson', 'Pavel Dovgalyuk', qemu-devel
  Cc: maria.klimushenkova, agraf, david

> From: Richard Henderson [mailto:richard.henderson@linaro.org]
> On 10/30/18 9:30 AM, Pavel Dovgalyuk wrote:
> > This patch fixes processing of mtmsr instructions in icount mode.
> > 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(+)
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Richard, can you check the another similar patch?

https://patchew.org/QEMU/20181030122134.11055.15711.stgit@pasha-VirtualBox/


Pavel Dovgalyuk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount
  2018-11-06 12:20     ` 'David Gibson'
@ 2018-11-07 18:33       ` Mark Cave-Ayland
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Cave-Ayland @ 2018-11-07 18:33 UTC (permalink / raw)
  To: 'David Gibson', Pavel Dovgalyuk
  Cc: maria.klimushenkova, qemu-devel, 'Pavel Dovgalyuk', agraf

On 06/11/2018 12:20, 'David Gibson' wrote:

> On Tue, Nov 06, 2018 at 09:10:45AM +0300, Pavel Dovgalyuk wrote:
>>> From: David Gibson [mailto:david@gibson.dropbear.id.au]
>>> On Tue, Oct 30, 2018 at 12:30:31PM +0300, Pavel Dovgalyuk wrote:
>>>> This patch fixes processing of mtmsr instructions in icount mode.
>>>> 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>
>>>
>>> Applied to ppc-for-3.1, thanks.
>>
>> Thanks. What about this one
>> https://patchew.org/QEMU/20181030122134.11055.15711.stgit@pasha-VirtualBox/
>> There is a mess with the subject, but the code is ok :)
> 
> I've been procrastinating on that because I don't understand icount
> well enough to review it easily, and no-one has replied with
> Reviewed-by or Tested-by.

I've just sent a Tested-by tag for this - with icount enabled, QEMU will assert if an
instruction that alters interrupt state doesn't set can_do_io beforehand. With this
patch on top of ppc-for-3.1 then I can boot my OpenBIOS test images without QEMU
asserting in icount mode. Since it should have no effect without icount enabled, it
should be safe.

It might also be worth changing the title of the patch to "target/ppc: fix rfid
instruction for icount" so it matches its companion patch.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-07 18:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30  9:30 [Qemu-devel] [PATCH] target/ppc: fix mtmsr instruction for icount Pavel Dovgalyuk
2018-10-31 10:48 ` Richard Henderson
2018-11-07  7:51   ` Pavel Dovgalyuk
2018-11-03 13:25 ` David Gibson
2018-11-06  6:10   ` Pavel Dovgalyuk
2018-11-06 12:20     ` 'David Gibson'
2018-11-07 18:33       ` Mark Cave-Ayland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.