Skip to contentSkip to conversation

s390x patches (shift instructions, MAINTAINERS, ...)

GIT PULL Applied Thomas Huth 2 participants 12 messages Jan 19, 2022

lore
Share & tools
lore
#1 lore raw

[PULL 05/10] target/s390x: Fix shifting 32-bit values for more than 31 bits

In reply to Thomas Huth

From: Ilya Leoshkevich <[email protected]>

According to PoP, both 32- and 64-bit shifts use lowest 6 address bits. The current code special-cases 32-bit shifts to use only 5 bits, which is not correct. For example, shifting by 32 bits currently preserves the initial value, however, it's supposed zero it out instead.

Fix by merging sh32 and sh64 and adapting CC calculation to shift values greater than 31.

Fixes cbe24bfa91d2 ("target-s390: Convert SHIFT, ROTATE SINGLE")

Message-Id: <[email protected]>

---
 target/s390x/cpu-dump.c        |  3 +--
 target/s390x/s390x-internal.h  |  3 +--
 target/s390x/tcg/cc_helper.c   | 36 +++-----------------------
 target/s390x/tcg/insn-data.def | 36 +++++++++++++-------------
 target/s390x/tcg/translate.c   | 47 ++++++++++++++++------------------
 5 files changed, 45 insertions(+), 80 deletions(-)
target/s390x/cpu-dump.c +1 -2
index 0f5c062994..ffa9e94d84 100644
@@ -121,8 +121,7 @@ const char *cc_name(enum cc_op cc_op)
         [CC_OP_NZ_F64]    = "CC_OP_NZ_F64",
         [CC_OP_NZ_F128]   = "CC_OP_NZ_F128",
         [CC_OP_ICM]       = "CC_OP_ICM",
-        [CC_OP_SLA_32]    = "CC_OP_SLA_32",
-        [CC_OP_SLA_64]    = "CC_OP_SLA_64",
+        [CC_OP_SLA]       = "CC_OP_SLA",
         [CC_OP_FLOGR]     = "CC_OP_FLOGR",
         [CC_OP_LCBB]      = "CC_OP_LCBB",
         [CC_OP_VC]        = "CC_OP_VC",
target/s390x/s390x-internal.h +1 -2
index 1a178aed41..6fc8cad2d5 100644
@@ -193,8 +193,7 @@ enum cc_op {
     CC_OP_NZ_F128,              /* FP dst != 0 (128bit) */
 
     CC_OP_ICM,                  /* insert characters under mask */
-    CC_OP_SLA_32,               /* Calculate shift left signed (32bit) */
-    CC_OP_SLA_64,               /* Calculate shift left signed (64bit) */
+    CC_OP_SLA,                  /* Calculate shift left signed */
     CC_OP_FLOGR,                /* find leftmost one */
     CC_OP_LCBB,                 /* load count to block boundary */
     CC_OP_VC,                   /* vector compare result */
target/s390x/tcg/cc_helper.c +3 -33
index c9b7b0e8c6..8d04097f78 100644
@@ -268,34 +268,7 @@ static uint32_t cc_calc_icm(uint64_t mask, uint64_t val)
     }
 }
 
-static uint32_t cc_calc_sla_32(uint32_t src, int shift)
-{
-    uint32_t mask = ((1U << shift) - 1U) << (32 - shift);
-    uint32_t sign = 1U << 31;
-    uint32_t match;
-    int32_t r;
-
-    /* Check if the sign bit stays the same.  */
-    if (src & sign) {
-        match = mask;
-    } else {
-        match = 0;
-    }
-    if ((src & mask) != match) {
-        /* Overflow.  */
-        return 3;
-    }
-
-    r = ((src << shift) & ~sign) | (src & sign);
-    if (r == 0) {
-        return 0;
-    } else if (r < 0) {
-        return 1;
-    }
-    return 2;
-}
-
-static uint32_t cc_calc_sla_64(uint64_t src, int shift)
+static uint32_t cc_calc_sla(uint64_t src, int shift)
 {
     uint64_t mask = -1ULL << (63 - shift);
     uint64_t sign = 1ULL << 63;
@@ -459,11 +432,8 @@ static uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op,
     case CC_OP_ICM:
         r =  cc_calc_icm(src, dst);
         break;
-    case CC_OP_SLA_32:
-        r =  cc_calc_sla_32(src, dst);
-        break;
-    case CC_OP_SLA_64:
-        r =  cc_calc_sla_64(src, dst);
+    case CC_OP_SLA:
+        r =  cc_calc_sla(src, dst);
         break;
     case CC_OP_FLOGR:
         r = cc_calc_flogr(dst);
target/s390x/tcg/insn-data.def +18 -18
index 90c753068c..1c3e115712 100644
@@ -747,8 +747,8 @@
     C(0xb9e1, POPCNT,  RRE,   PC,  0, r2_o, r1, 0, popcnt, nz64)
 
 /* ROTATE LEFT SINGLE LOGICAL */
-    C(0xeb1d, RLL,     RSY_a, Z,   r3_o, sh32, new, r1_32, rll32, 0)
-    C(0xeb1c, RLLG,    RSY_a, Z,   r3_o, sh64, r1, 0, rll64, 0)
+    C(0xeb1d, RLL,     RSY_a, Z,   r3_o, sh, new, r1_32, rll32, 0)
+    C(0xeb1c, RLLG,    RSY_a, Z,   r3_o, sh, r1, 0, rll64, 0)
 
 /* ROTATE THEN INSERT SELECTED BITS */
     C(0xec55, RISBG,   RIE_f, GIE, 0, r2, r1, 0, risbg, s64)
@@ -784,29 +784,29 @@
     C(0x0400, SPM,     RR_a,  Z,   r1, 0, 0, 0, spm, 0)
 
 /* SHIFT LEFT SINGLE */
-    D(0x8b00, SLA,     RS_a,  Z,   r1, sh32, new, r1_32, sla, 0, 31)
-    D(0xebdd, SLAK,    RSY_a, DO,  r3, sh32, new, r1_32, sla, 0, 31)
-    D(0xeb0b, SLAG,    RSY_a, Z,   r3, sh64, r1, 0, sla, 0, 63)
+    D(0x8b00, SLA,     RS_a,  Z,   r1, sh, new, r1_32, sla, 0, 31)
+    D(0xebdd, SLAK,    RSY_a, DO,  r3, sh, new, r1_32, sla, 0, 31)
+    D(0xeb0b, SLAG,    RSY_a, Z,   r3, sh, r1, 0, sla, 0, 63)
 /* SHIFT LEFT SINGLE LOGICAL */
-    C(0x8900, SLL,     RS_a,  Z,   r1_o, sh32, new, r1_32, sll, 0)
-    C(0xebdf, SLLK,    RSY_a, DO,  r3_o, sh32, new, r1_32, sll, 0)
-    C(0xeb0d, SLLG,    RSY_a, Z,   r3_o, sh64, r1, 0, sll, 0)
+    C(0x8900, SLL,     RS_a,  Z,   r1_o, sh, new, r1_32, sll, 0)
+    C(0xebdf, SLLK,    RSY_a, DO,  r3_o, sh, new, r1_32, sll, 0)
+    C(0xeb0d, SLLG,    RSY_a, Z,   r3_o, sh, r1, 0, sll, 0)
 /* SHIFT RIGHT SINGLE */
-    C(0x8a00, SRA,     RS_a,  Z,   r1_32s, sh32, new, r1_32, sra, s32)
-    C(0xebdc, SRAK,    RSY_a, DO,  r3_32s, sh32, new, r1_32, sra, s32)
-    C(0xeb0a, SRAG,    RSY_a, Z,   r3_o, sh64, r1, 0, sra, s64)
+    C(0x8a00, SRA,     RS_a,  Z,   r1_32s, sh, new, r1_32, sra, s32)
+    C(0xebdc, SRAK,    RSY_a, DO,  r3_32s, sh, new, r1_32, sra, s32)
+    C(0xeb0a, SRAG,    RSY_a, Z,   r3_o, sh, r1, 0, sra, s64)
 /* SHIFT RIGHT SINGLE LOGICAL */
-    C(0x8800, SRL,     RS_a,  Z,   r1_32u, sh32, new, r1_32, srl, 0)
-    C(0xebde, SRLK,    RSY_a, DO,  r3_32u, sh32, new, r1_32, srl, 0)
-    C(0xeb0c, SRLG,    RSY_a, Z,   r3_o, sh64, r1, 0, srl, 0)
+    C(0x8800, SRL,     RS_a,  Z,   r1_32u, sh, new, r1_32, srl, 0)
+    C(0xebde, SRLK,    RSY_a, DO,  r3_32u, sh, new, r1_32, srl, 0)
+    C(0xeb0c, SRLG,    RSY_a, Z,   r3_o, sh, r1, 0, srl, 0)
 /* SHIFT LEFT DOUBLE */
-    D(0x8f00, SLDA,    RS_a,  Z,   r1_D32, sh64, new, r1_D32, sla, 0, 63)
+    D(0x8f00, SLDA,    RS_a,  Z,   r1_D32, sh, new, r1_D32, sla, 0, 63)
 /* SHIFT LEFT DOUBLE LOGICAL */
-    C(0x8d00, SLDL,    RS_a,  Z,   r1_D32, sh64, new, r1_D32, sll, 0)
+    C(0x8d00, SLDL,    RS_a,  Z,   r1_D32, sh, new, r1_D32, sll, 0)
 /* SHIFT RIGHT DOUBLE */
-    C(0x8e00, SRDA,    RS_a,  Z,   r1_D32, sh64, new, r1_D32, sra, s64)
+    C(0x8e00, SRDA,    RS_a,  Z,   r1_D32, sh, new, r1_D32, sra, s64)
 /* SHIFT RIGHT DOUBLE LOGICAL */
-    C(0x8c00, SRDL,    RS_a,  Z,   r1_D32, sh64, new, r1_D32, srl, 0)
+    C(0x8c00, SRDL,    RS_a,  Z,   r1_D32, sh, new, r1_D32, srl, 0)
 
 /* SQUARE ROOT */
     F(0xb314, SQEBR,   RRE,   Z,   0, e2, new, e1, sqeb, 0, IF_BFP)
target/s390x/tcg/translate.c +22 -25

75 lines not on this page · raw message

Signature · 1 line
2.27.0
#0 lore raw

Hi!

The following changes since commit 69353c332c558cead5f8081d0bb69f989fe33fa3:

Merge remote-tracking branch 'remotes/konstantin/tags/qga-win32-pull-2022-01-10' into staging (2022-01-16 16:32:34 +0000)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2022-01-19

for you to fetch changes up to 59b9b5186e44a90088a91ed7a7493b03027e4f1f:

s390x: sigp: Reorder the SIGP STOP code (2022-01-18 15:00:57 +0100)

----------------------------------------------------------------
* Fix bits in one of the PMCW channel subsystem masks
* s390x TCG shift instruction fixes
* Re-organization for the MAINTAINERS file
* Support for extended length of kernel command lines
* Re-order the SIGP STOP code

----------------------------------------------------------------
Cornelia Huck (1):

      MAINTAINERS: split out s390x sections

Eric Farman (2):
MAINTAINERS: Add myself to s390 I/O areas
s390x: sigp: Reorder the SIGP STOP code

Ilya Leoshkevich (5):

      target/s390x: Fix SLDA sign bit index
      target/s390x: Fix SRDA CC calculation
      target/s390x: Fix cc_calc_sla_64() missing overflows
      target/s390x: Fix shifting 32-bit values for more than 31 bits
      tests/tcg/s390x: Test shift instructions

Marc Hartmayer (1):

      s390x/ipl: support extended kernel command line size

Nico Boehr (1):

      s390x/css: fix PMCW invalid mask
 MAINTAINERS                     |  88 +++++++++++--
 hw/s390x/ipl.c                  |  27 +++-
 include/hw/s390x/ioinst.h       |   2 +-
 target/s390x/cpu-dump.c         |   3 +-
 target/s390x/s390x-internal.h   |   3 +-
 target/s390x/sigp.c             |  12 +-
 target/s390x/tcg/cc_helper.c    |  38 +-----
 target/s390x/tcg/insn-data.def  |  36 +++---
 target/s390x/tcg/translate.c    |  53 ++++----
 tests/tcg/s390x/Makefile.target |   1 +
 tests/tcg/s390x/shift.c         | 270 ++++++++++++++++++++++++++++++++++++++++
 11 files changed, 430 insertions(+), 103 deletions(-)
 create mode 100644 tests/tcg/s390x/shift.c
#2 lore raw

[PULL 06/10] tests/tcg/s390x: Test shift instructions

From: Ilya Leoshkevich <[email protected]>

Add a test for each shift instruction in order to to prevent regressions.

Message-Id: <[email protected]>

---
 tests/tcg/s390x/Makefile.target |   1 +
 tests/tcg/s390x/shift.c         | 270 ++++++++++++++++++++++++++++++++
 2 files changed, 271 insertions(+)
 create mode 100644 tests/tcg/s390x/shift.c
tests/tcg/s390x/Makefile.target +1 -0
index cc64dd32d2..1a7238b4eb 100644
@@ -9,6 +9,7 @@ TESTS+=exrl-trtr
 TESTS+=pack
 TESTS+=mvo
 TESTS+=mvc
+TESTS+=shift
 TESTS+=trap
 TESTS+=signals-s390x
 
tests/tcg/s390x/shift.c new file +270 -0

270 lines not on this page · raw message

Signature · 1 line
2.27.0
#3 lore raw

[PULL 02/10] target/s390x: Fix SLDA sign bit index

In reply to Thomas Huth

From: Ilya Leoshkevich <[email protected]>

SLDA operates on 64-bit values, so its sign bit index should be 63, not 31.

Fixes a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE")

Message-Id: <[email protected]>

---
 target/s390x/tcg/insn-data.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/tcg/insn-data.def +1 -1
index f0af458aee..90c753068c 100644
@@ -800,7 +800,7 @@
     C(0xebde, SRLK,    RSY_a, DO,  r3_32u, sh32, new, r1_32, srl, 0)
     C(0xeb0c, SRLG,    RSY_a, Z,   r3_o, sh64, r1, 0, srl, 0)
 /* SHIFT LEFT DOUBLE */
-    D(0x8f00, SLDA,    RS_a,  Z,   r1_D32, sh64, new, r1_D32, sla, 0, 31)
+    D(0x8f00, SLDA,    RS_a,  Z,   r1_D32, sh64, new, r1_D32, sla, 0, 63)
 /* SHIFT LEFT DOUBLE LOGICAL */
     C(0x8d00, SLDL,    RS_a,  Z,   r1_D32, sh64, new, r1_D32, sll, 0)
 /* SHIFT RIGHT DOUBLE */
Signature · 1 line
2.27.0
#4 lore raw

[PULL 10/10] s390x: sigp: Reorder the SIGP STOP code

In reply to Thomas Huth

From: Eric Farman <[email protected]>

Let's wait to mark the VCPU STOPPED until the possible STORE STATUS operation is completed, so that we know the CPU is fully stopped and done doing anything. (When we also clear the possible sigp_order field for STOP orders.)

Message-Id: <[email protected]>

---
 target/s390x/sigp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
target/s390x/sigp.c +8 -4
index 51c727834c..9dd977349a 100644
@@ -139,7 +139,7 @@ static void sigp_stop_and_store_status(CPUState *cs, run_on_cpu_data arg)
     case S390_CPU_STATE_OPERATING:
         cpu->env.sigp_order = SIGP_STOP_STORE_STATUS;
         cpu_inject_stop(cpu);
-        /* store will be performed in do_stop_interrup() */
+        /* store will be performed in do_stop_interrupt() */
         break;
     case S390_CPU_STATE_STOPPED:
         /* already stopped, just store the status */
@@ -479,13 +479,17 @@ void do_stop_interrupt(CPUS390XState *env)
 {
     S390CPU *cpu = env_archcpu(env);
 
-    if (s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu) == 0) {
-        qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
-    }
+    /*
+     * Complete the STOP operation before exposing the CPU as
+     * STOPPED to the system.
+     */
     if (cpu->env.sigp_order == SIGP_STOP_STORE_STATUS) {
         s390_store_status(cpu, S390_STORE_STATUS_DEF_ADDR, true);
     }
     env->sigp_order = 0;
+    if (s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu) == 0) {
+        qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
+    }
     env->pending_int &= ~INTERRUPT_STOP;
 }
 
Signature · 1 line
2.27.0
#5 lore raw

[PULL 04/10] target/s390x: Fix cc_calc_sla_64() missing overflows

In reply to Thomas Huth

From: Ilya Leoshkevich <[email protected]>

An overflow occurs for SLAG when at least one shifted bit is not equal to sign bit. Therefore, we need to check that shift + 1 bits are neither all 0s nor all 1s. The current code checks only shift bits, missing some overflows.

Fixes cbe24bfa91d2 ("target-s390: Convert SHIFT, ROTATE SINGLE")

Message-Id: <[email protected]>

---
 target/s390x/tcg/cc_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/tcg/cc_helper.c +1 -1
index c2c96c3a3c..c9b7b0e8c6 100644
@@ -297,7 +297,7 @@ static uint32_t cc_calc_sla_32(uint32_t src, int shift)
 
 static uint32_t cc_calc_sla_64(uint64_t src, int shift)
 {
-    uint64_t mask = ((1ULL << shift) - 1ULL) << (64 - shift);
+    uint64_t mask = -1ULL << (63 - shift);
     uint64_t sign = 1ULL << 63;
     uint64_t match;
     int64_t r;
Signature · 1 line
2.27.0
#6 lore raw

[PULL 07/10] MAINTAINERS: split out s390x sections

In reply to Thomas Huth

From: Cornelia Huck <[email protected]>

Split out some more specialized devices etc., so that we can build smarter lists of people to be put on cc: in the future.

Message-Id: <[email protected]>

---
 MAINTAINERS | 85 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 74 insertions(+), 11 deletions(-)
MAINTAINERS +74 -11
index 2fd74c4642..793d6edd2d 100644
@@ -297,7 +297,6 @@ M: David Hildenbrand <[email protected]>
 S: Maintained
 F: target/s390x/
 F: target/s390x/tcg
-F: target/s390x/cpu_models_*.[ch]
 F: hw/s390x/
 F: disas/s390.c
 F: tests/tcg/s390x/
@@ -396,16 +395,10 @@ M: Halil Pasic <[email protected]>
 M: Christian Borntraeger <[email protected]>
 S: Supported
 F: target/s390x/kvm/
-F: target/s390x/ioinst.[ch]
 F: target/s390x/machine.c
 F: target/s390x/sigp.c
-F: target/s390x/cpu_features*.[ch]
-F: target/s390x/cpu_models.[ch]
 F: hw/s390x/pv.c
 F: include/hw/s390x/pv.h
-F: hw/intc/s390_flic.c
-F: hw/intc/s390_flic_kvm.c
-F: include/hw/s390x/s390_flic.h
 F: gdb-xml/s390*.xml
 T: git https://github.com/borntraeger/qemu.git s390-next
 L: [email protected]
@@ -1533,12 +1526,8 @@ S390 Virtio-ccw
 M: Halil Pasic <[email protected]>
 M: Christian Borntraeger <[email protected]>
 S: Supported
-F: hw/char/sclp*.[hc]
-F: hw/char/terminal3270.c
 F: hw/s390x/
 F: include/hw/s390x/
-F: hw/watchdog/wdt_diag288.c
-F: include/hw/watchdog/wdt_diag288.h
 F: configs/devices/s390x-softmmu/default.mak
 F: tests/avocado/machine_s390_ccw_virtio.py
 T: git https://github.com/borntraeger/qemu.git s390-next
@@ -1563,6 +1552,37 @@ F: hw/s390x/s390-pci*
 F: include/hw/s390x/s390-pci*
 L: [email protected]
 
+S390 channel subsystem
+M: Halil Pasic <[email protected]>
+M: Christian Borntraeger <[email protected]>
+S: Supported
+F: hw/s390x/ccw-device.[ch]
+F: hw/s390x/css.c
+F: hw/s390x/css-bridge.c
+F: include/hw/s390x/css.h
+F: include/hw/s390x/css-bridge.h
+F: include/hw/s390x/ioinst.h
+F: target/s390x/ioinst.c
+L: [email protected]
+
+S390 CPU models
+M: David Hildenbrand <[email protected]>
+S: Maintained
+F: target/s390x/cpu_features*.[ch]
+F: target/s390x/cpu_models.[ch]
+L: [email protected]
+
+S390 SCLP-backed devices
+M: Halil Pasic <[email protected]>
+M: Christian Borntraeger <[email protected]>
+S: Supported
+F: include/hw/s390x/event-facility.h
+F: include/hw/s390x/sclp.h
+F: hw/char/sclp*.[hc]
+F: hw/s390x/event-facility.c
+F: hw/s390x/sclp*.c
+L: [email protected]
+
 X86 Machines
 ------------
 PC
@@ -1970,6 +1990,7 @@ M: Halil Pasic <[email protected]>
 S: Supported
 F: hw/s390x/virtio-ccw*.[hc]
 F: hw/s390x/vhost-vsock-ccw.c
+F: hw/s390x/vhost-user-fs-ccw.c
 T: git https://gitlab.com/cohuck/qemu.git s390-next
 T: git https://github.com/borntraeger/qemu.git s390-next
 L: [email protected]
@@ -2308,6 +2329,48 @@ F: hw/timer/mips_gictimer.c
 F: include/hw/intc/mips_gic.h
 F: include/hw/timer/mips_gictimer.h
 
+S390 3270 device
+M: Halil Pasic <[email protected]>
+M: Christian Borntraeger <[email protected]>
+S: Odd fixes
+F: include/hw/s390x/3270-ccw.h
+F: hw/char/terminal3270.c
+F: hw/s390x/3270-ccw.c
+L: [email protected]
+
+S390 diag 288 watchdog
+M: Halil Pasic <[email protected]>
+M: Christian Borntraeger <[email protected]>
+S: Supported
+F: hw/watchdog/wdt_diag288.c
+F: include/hw/watchdog/wdt_diag288.h
+L: [email protected]
+
+S390 storage key device
+M: Halil Pasic <[email protected]>
+M: Christian Borntraeger <[email protected]>
+S: Supported
+F: hw/s390x/storage-keys.h
+F: hw/390x/s390-skeys*.c
+L: [email protected]
+
+S390 storage attribute device
+M: Halil Pasic <[email protected]>
+M: Christian Borntraeger <[email protected]>
+S: Supported
+F: hw/s390x/storage-attributes.h
+F: hw/s390/s390-stattrib*.c
+L: [email protected]
+
+S390 floating interrupt controller
+M: Halil Pasic <[email protected]>
+M: Christian Borntraeger <[email protected]>
+M: David Hildenbrand <[email protected]>
+S: Supported
+F: hw/intc/s390_flic*.c
+F: include/hw/s390x/s390_flic.h
+L: [email protected]
+
 Subsystems
 ----------
 Overall Audio backends
Signature · 1 line
2.27.0
#7 lore raw

[PULL 08/10] MAINTAINERS: Add myself to s390 I/O areas

In reply to Thomas Huth

From: Eric Farman <[email protected]>

After the recent restructuring, I'd like to volunteer to help in some of the s390 I/O areas.

Built on "[PATCH RFC v2] MAINTAINERS: split out s390x sections"

Message-Id: <[email protected]>

---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
index 793d6edd2d..893a556710 100644
@@ -1525,6 +1525,7 @@ S390 Machines
 S390 Virtio-ccw
 M: Halil Pasic <[email protected]>
 M: Christian Borntraeger <[email protected]>
+M: Eric Farman <[email protected]>
 S: Supported
 F: hw/s390x/
 F: include/hw/s390x/
@@ -1555,6 +1556,7 @@ L: [email protected]
 S390 channel subsystem
 M: Halil Pasic <[email protected]>
 M: Christian Borntraeger <[email protected]>
+M: Eric Farman <[email protected]>
 S: Supported
 F: hw/s390x/ccw-device.[ch]
 F: hw/s390x/css.c
@@ -1987,6 +1989,7 @@ T: git https://github.com/stefanha/qemu.git block
 virtio-ccw
 M: Cornelia Huck <[email protected]>
 M: Halil Pasic <[email protected]>
+M: Eric Farman <[email protected]>
 S: Supported
 F: hw/s390x/virtio-ccw*.[hc]
 F: hw/s390x/vhost-vsock-ccw.c
Signature · 1 line
2.27.0
#8 lore raw

[PULL 01/10] s390x/css: fix PMCW invalid mask

In reply to Thomas Huth

From: Nico Boehr <[email protected]>

Previously, we required bits 5, 6 and 7 to be zero (0x07 == 0b111). But, as per the principles of operation, bit 5 is ignored in MSCH and bits 0, 1, 6 and 7 need to be zero.

As both PMCW_FLAGS_MASK_INVALID and ioinst_schib_valid() are only used by ioinst_handle_msch(), adjust the mask accordingly.

Fixes db1c8f53bfb1 ("s390: Channel I/O basic definitions.")

Message-Id: <[email protected]>

---
 include/hw/s390x/ioinst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/s390x/ioinst.h +1 -1
index 3771fff9d4..ea8d0f2444 100644
@@ -107,7 +107,7 @@ QEMU_BUILD_BUG_MSG(sizeof(PMCW) != 28, "size of PMCW is wrong");
 #define PMCW_FLAGS_MASK_MP 0x0004
 #define PMCW_FLAGS_MASK_TF 0x0002
 #define PMCW_FLAGS_MASK_DNV 0x0001
-#define PMCW_FLAGS_MASK_INVALID 0x0700
+#define PMCW_FLAGS_MASK_INVALID 0xc300
 
 #define PMCW_CHARS_MASK_ST 0x00e00000
 #define PMCW_CHARS_MASK_MBFC 0x00000004
Signature · 1 line
2.27.0
#9 lore raw

[PULL 09/10] s390x/ipl: support extended kernel command line size

In reply to Thomas Huth

From: Marc Hartmayer <[email protected]>

In the past s390 used a fixed command line length of 896 bytes. This has changed with the Linux commit 5ecb2da660ab ("s390: support command lines longer than 896 bytes"). There is now a parm area indicating the maximum command line size. This parm area has always been initialized to zero, so with older kernels this field would read zero and we must then assume that only 896 bytes are available.

Message-Id: <[email protected]>

[thuth: Cosmetic fixes, and use PRIu64 instead of %lu]
---
 hw/s390x/ipl.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)
hw/s390x/ipl.c +23 -4
index 7ddca0127f..eb7fc4c4ae 100644
@@ -37,8 +37,9 @@
 
 #define KERN_IMAGE_START                0x010000UL
 #define LINUX_MAGIC_ADDR                0x010008UL
+#define KERN_PARM_AREA_SIZE_ADDR        0x010430UL
 #define KERN_PARM_AREA                  0x010480UL
-#define KERN_PARM_AREA_SIZE             0x000380UL
+#define LEGACY_KERN_PARM_AREA_SIZE      0x000380UL
 #define INITRD_START                    0x800000UL
 #define INITRD_PARM_START               0x010408UL
 #define PARMFILE_START                  0x001000UL
@@ -110,6 +111,21 @@ static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr)
     return srcaddr + dstaddr;
 }
 
+static uint64_t get_max_kernel_cmdline_size(void)
+{
+    uint64_t *size_ptr = rom_ptr(KERN_PARM_AREA_SIZE_ADDR, sizeof(*size_ptr));
+
+    if (size_ptr) {
+        uint64_t size;
+
+        size = be64_to_cpu(*size_ptr);
+        if (size) {
+            return size;
+        }
+    }
+    return LEGACY_KERN_PARM_AREA_SIZE;
+}
+
 static void s390_ipl_realize(DeviceState *dev, Error **errp)
 {
     MachineState *ms = MACHINE(qdev_get_machine());
@@ -197,10 +213,13 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
             ipl->start_addr = KERN_IMAGE_START;
             /* Overwrite parameters in the kernel image, which are "rom" */
             if (parm_area) {
-                if (cmdline_size > KERN_PARM_AREA_SIZE) {
+                uint64_t max_cmdline_size = get_max_kernel_cmdline_size();
+
+                if (cmdline_size > max_cmdline_size) {
                     error_setg(errp,
-                               "kernel command line exceeds maximum size: %zu > %lu",
-                               cmdline_size, KERN_PARM_AREA_SIZE);
+                               "kernel command line exceeds maximum size:"
+                               " %zu > %" PRIu64,
+                               cmdline_size, max_cmdline_size);
                     return;
                 }
 
Signature · 1 line
2.27.0
#10 lore raw

[PULL 03/10] target/s390x: Fix SRDA CC calculation

In reply to Thomas Huth

From: Ilya Leoshkevich <[email protected]>

SRDA uses r1_D32 for binding the first operand and s64 for setting CC. cout_s64() relies on o->out being the shift result, however, wout_r1_D32() clobbers it.

Fix by using a temporary.

Fixes a79ba3398a0a ("target-s390: Convert SHIFT DOUBLE")

Message-Id: <[email protected]>

---
 target/s390x/tcg/translate.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
target/s390x/tcg/translate.c +4 -2
index f180853e7a..766b4c87b2 100644
@@ -5420,9 +5420,11 @@ static void wout_r1_P32(DisasContext *s, DisasOps *o)
 static void wout_r1_D32(DisasContext *s, DisasOps *o)
 {
     int r1 = get_field(s, r1);
+    TCGv_i64 t = tcg_temp_new_i64();
     store_reg32_i64(r1 + 1, o->out);
-    tcg_gen_shri_i64(o->out, o->out, 32);
-    store_reg32_i64(r1, o->out);
+    tcg_gen_shri_i64(t, o->out, 32);
+    store_reg32_i64(r1, t);
+    tcg_temp_free_i64(t);
 }
 #define SPEC_wout_r1_D32 SPEC_r1_even
 
Signature · 1 line
2.27.0
#11 lore raw
In reply to Thomas Huth
Quoted 13 lines · Thomas Huth

Hi!

The following changes since commit 69353c332c558cead5f8081d0bb69f989fe33fa3:

Merge remote-tracking branch 'remotes/konstantin/tags/qga-win32-pull-2022-01-10' into staging (2022-01-16 16:32:34 +0000)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2022-01-19

for you to fetch changes up to 59b9b5186e44a90088a91ed7a7493b03027e4f1f:

Quoted 9 lines

s390x: sigp: Reorder the SIGP STOP code (2022-01-18 15:00:57 +0100)

----------------------------------------------------------------
* Fix bits in one of the PMCW channel subsystem masks
* s390x TCG shift instruction fixes
* Re-organization for the MAINTAINERS file
* Support for extended length of kernel command lines
* Re-order the SIGP STOP code

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.0
for any user-visible changes.

-- PMM