Skip to contentSkip to conversation

target/s390x: Fix PPNO execution with icount

PATCH In review Ilya Leoshkevich 2 participants 2 messages Jan 23, 2025 – Jan 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/s390x: Fix PPNO execution with icount

Executing PERFORM RANDOM NUMBER OPERATION makes QEMU exit with "Bad icount read" when using record/replay. This is caused by icount_get_raw_locked() if the current instruction is not the last one in the respective translation block.

For the x86_64's rdrand this is resolved by calling translator_io_start(). On s390x one uses IF_IO in order to make this call happen automatically.

---
 target/s390x/tcg/insn-data.h.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/tcg/insn-data.h.inc +1 -1
index e7d61cdec28..ec730ee0919 100644
@@ -1012,7 +1012,7 @@
     D(0xb92e, KM,      RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KM)
     D(0xb92f, KMC,     RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC)
     D(0xb929, KMA,     RRF_b, MSA8, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMA)
-    D(0xb93c, PPNO,    RRE,   MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPNO)
+    E(0xb93c, PPNO,    RRE,   MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPNO, IF_IO)
     D(0xb93e, KIMD,    RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KIMD)
     D(0xb93f, KLMD,    RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KLMD)
 
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Ilya Leoshkevich

Executing PERFORM RANDOM NUMBER OPERATION makes QEMU exit with "Bad icount read" when using record/replay. This is caused by icount_get_raw_locked() if the current instruction is not the last one in the respective translation block.

For the x86_64's rdrand this is resolved by calling translator_io_start(). On s390x one uses IF_IO in order to make this call happen automatically.

---
  target/s390x/tcg/insn-data.h.inc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/tcg/insn-data.h.inc +0 -0
index e7d61cdec28..ec730ee0919 100644

target/s390x/tcg/insn-data.h.inc line 1018

Quoted 8 lines
target/s390x/tcg/insn-data.h.inc +1 -1
@@ -1012,7 +1012,7 @@
      D(0xb92e, KM,      RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KM)
      D(0xb92f, KMC,     RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC)
      D(0xb929, KMA,     RRF_b, MSA8, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMA)
-    D(0xb93c, PPNO,    RRE,   MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPNO)
+    E(0xb93c, PPNO,    RRE,   MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPNO, IF_IO)
      D(0xb93e, KIMD,    RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KIMD)
      D(0xb93f, KLMD,    RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KLMD)
 

r~