Skip to contentSkip to conversation

s390x: sck: load into a temporary not into in1

PATCH In review Nico Boehr 4 participants 5 messages Jan 26, 2022 – Jan 28, 2022 s390

lore
Share & tools
lore

Nico Boehr

author
#0 lore raw

PATCH v2 1/1 s390x: sck: load into a temporary not into in1

We previously loaded into in1, but in1 is not filled during disassembly and hence always zero. This leads to an assertion failure:

  qemu-system-s390x: /home/nrb/qemu/include/tcg/tcg.h:654: temp_idx:
  Assertion `n >= 0 && n < tcg_ctx->nb_temps' failed.`

Instead, use in2_la2_m64a to load from storage into in2 and pass that to the helper, which matches what we already do for SCKC.

This fixes the SCK test I sent here under TCG:
<https://www.spinics.net/lists/kvm/msg265169.html>

---
 target/s390x/tcg/insn-data.def | 2 +-
 target/s390x/tcg/translate.c   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
target/s390x/tcg/insn-data.def +1 -1
index 3e5594210c88..848a9c9e622f 100644
@@ -1317,7 +1317,7 @@
 /* SET ADDRESS SPACE CONTROL FAST */
     F(0xb279, SACF,    S,     Z,   0, a2, 0, 0, sacf, 0, IF_PRIV)
 /* SET CLOCK */
-    F(0xb204, SCK,     S,     Z,   la2, 0, 0, 0, sck, 0, IF_PRIV | IF_IO)
+    F(0xb204, SCK,     S,     Z,   0, m2_64a, 0, 0, sck, 0, IF_PRIV | IF_IO)
 /* SET CLOCK COMPARATOR */
     F(0xb206, SCKC,    S,     Z,   0, m2_64a, 0, 0, sckc, 0, IF_PRIV | IF_IO)
 /* SET CLOCK PROGRAMMABLE FIELD */
target/s390x/tcg/translate.c +1 -2
index dcc249a197ce..7fb87cd9f3b7 100644
@@ -4295,8 +4295,7 @@ static DisasJumpType op_stcke(DisasContext *s, DisasOps *o)
 #ifndef CONFIG_USER_ONLY
 static DisasJumpType op_sck(DisasContext *s, DisasOps *o)
 {
-    tcg_gen_qemu_ld_i64(o->in1, o->addr1, get_mem_index(s), MO_TEQ | MO_ALIGN);
-    gen_helper_sck(cc_op, cpu_env, o->in1);
+    gen_helper_sck(cc_op, cpu_env, o->in2);
     set_cc_static(s);
     return DISAS_NEXT;
 }
Signature · 1 line
2.31.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 37 lines · Nico Boehr

We previously loaded into in1, but in1 is not filled during disassembly and hence always zero. This leads to an assertion failure:

  qemu-system-s390x: /home/nrb/qemu/include/tcg/tcg.h:654: temp_idx:
  Assertion `n >= 0 && n < tcg_ctx->nb_temps' failed.`

Instead, use in2_la2_m64a to load from storage into in2 and pass that to the helper, which matches what we already do for SCKC.

This fixes the SCK test I sent here under TCG:
<https://www.spinics.net/lists/kvm/msg265169.html>

---
 target/s390x/tcg/insn-data.def | 2 +-
 target/s390x/tcg/translate.c   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
target/s390x/tcg/insn-data.def +1 -1
index 3e5594210c88..848a9c9e622f 100644
@@ -1317,7 +1317,7 @@
 /* SET ADDRESS SPACE CONTROL FAST */
     F(0xb279, SACF,    S,     Z,   0, a2, 0, 0, sacf, 0, IF_PRIV)
 /* SET CLOCK */
-    F(0xb204, SCK,     S,     Z,   la2, 0, 0, 0, sck, 0, IF_PRIV | IF_IO)
+    F(0xb204, SCK,     S,     Z,   0, m2_64a, 0, 0, sck, 0, IF_PRIV | IF_IO)
 /* SET CLOCK COMPARATOR */
     F(0xb206, SCKC,    S,     Z,   0, m2_64a, 0, 0, sckc, 0, IF_PRIV | IF_IO)
 /* SET CLOCK PROGRAMMABLE FIELD */
target/s390x/tcg/translate.c +0 -0
index dcc249a197ce..7fb87cd9f3b7 100644

target/s390x/tcg/translate.c static DisasJumpType op_stcke(DisasContext *s, DisasOps *o) · line 4301

Quoted 9 lines
target/s390x/tcg/translate.c +1 -2
@@ -4295,8 +4295,7 @@ static DisasJumpType op_stcke(DisasContext *s, DisasOps *o)
 #ifndef CONFIG_USER_ONLY
 static DisasJumpType op_sck(DisasContext *s, DisasOps *o)
 {
-    tcg_gen_qemu_ld_i64(o->in1, o->addr1, get_mem_index(s), MO_TEQ | MO_ALIGN);
-    gen_helper_sck(cc_op, cpu_env, o->in1);
+    gen_helper_sck(cc_op, cpu_env, o->in2);
     set_cc_static(s);
     return DISAS_NEXT;
 }
Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
In reply to Nico Boehr
Quoted 6 lines · Nico Boehr

We previously loaded into in1, but in1 is not filled during disassembly and hence always zero. This leads to an assertion failure:

   qemu-system-s390x: /home/nrb/qemu/include/tcg/tcg.h:654: temp_idx:
   Assertion `n >= 0 && n < tcg_ctx->nb_temps' failed.`
Quoted 8 lines

Instead, use in2_la2_m64a to load from storage into in2 and pass that to the helper, which matches what we already do for SCKC.

This fixes the SCK test I sent here under TCG:
<https://www.spinics.net/lists/kvm/msg265169.html>

@David: Was this already broken when it was implemented?
I.e. do we want a "Fixes: 9dc67537 ("s390x/tcg: implement SET CLOCK ")" tag?

Quoted 33 lines
---
  target/s390x/tcg/insn-data.def | 2 +-
  target/s390x/tcg/translate.c   | 3 +--
  2 files changed, 2 insertions(+), 3 deletions(-)
target/s390x/tcg/insn-data.def +1 -1
index 3e5594210c88..848a9c9e622f 100644
@@ -1317,7 +1317,7 @@
  /* SET ADDRESS SPACE CONTROL FAST */
      F(0xb279, SACF,    S,     Z,   0, a2, 0, 0, sacf, 0, IF_PRIV)
  /* SET CLOCK */
-    F(0xb204, SCK,     S,     Z,   la2, 0, 0, 0, sck, 0, IF_PRIV | IF_IO)
+    F(0xb204, SCK,     S,     Z,   0, m2_64a, 0, 0, sck, 0, IF_PRIV | IF_IO)
  /* SET CLOCK COMPARATOR */
      F(0xb206, SCKC,    S,     Z,   0, m2_64a, 0, 0, sckc, 0, IF_PRIV | IF_IO)
  /* SET CLOCK PROGRAMMABLE FIELD */
target/s390x/tcg/translate.c +1 -2
index dcc249a197ce..7fb87cd9f3b7 100644
@@ -4295,8 +4295,7 @@ static DisasJumpType op_stcke(DisasContext *s, DisasOps *o)
  #ifndef CONFIG_USER_ONLY
  static DisasJumpType op_sck(DisasContext *s, DisasOps *o)
  {
-    tcg_gen_qemu_ld_i64(o->in1, o->addr1, get_mem_index(s), MO_TEQ | MO_ALIGN);
-    gen_helper_sck(cc_op, cpu_env, o->in1);
+    gen_helper_sck(cc_op, cpu_env, o->in2);
      set_cc_static(s);
      return DISAS_NEXT;
  }
#3 lore raw
Quoted 10 lines · Janosch Frank
Quoted 9 lines · Nico Boehr

We previously loaded into in1, but in1 is not filled during disassembly and hence always zero. This leads to an assertion failure:

   qemu-system-s390x: /home/nrb/qemu/include/tcg/tcg.h:654: temp_idx:
   Assertion `n >= 0 && n < tcg_ctx->nb_temps' failed.`

Instead, use in2_la2_m64a to load from storage into in2 and pass that to the helper, which matches what we already do for SCKC.

Quoted 8 lines
Quoted 5 lines

This fixes the SCK test I sent here under TCG:
<https://www.spinics.net/lists/kvm/msg265169.html>

@David: Was this already broken when it was implemented?
I.e. do we want a "Fixes: 9dc67537 ("s390x/tcg: implement SET CLOCK ")" tag?

That sounds about right.

Signature · 3 lines
Thanks,

David / dhildenb
#4 lore raw
Quoted 14 lines · David Hildenbrand
Quoted 13 lines · Janosch Frank
Quoted 12 lines · Nico Boehr

We previously loaded into in1, but in1 is not filled during disassembly and hence always zero. This leads to an assertion failure:

    qemu-system-s390x: /home/nrb/qemu/include/tcg/tcg.h:654: temp_idx:
    Assertion `n >= 0 && n < tcg_ctx->nb_temps' failed.`

Instead, use in2_la2_m64a to load from storage into in2 and pass that to the helper, which matches what we already do for SCKC.

This fixes the SCK test I sent here under TCG:
<https://www.spinics.net/lists/kvm/msg265169.html>

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

@David: Was this already broken when it was implemented?
I.e. do we want a "Fixes: 9dc67537 ("s390x/tcg: implement SET CLOCK ")" tag?

That sounds about right.

Thanks, queued to my s390x-next branch now:

https://gitlab.com/thuth/qemu/-/commits/s390x-next/

Thomas