Skip to contentSkip to conversation

s390x fixes for 2.2

GIT PULL Applied Cornelia Huck 3 participants 8 messages Nov 5, 2014 – Nov 10, 2014

lore
Share & tools
lore
#0 lore raw

The following changes since commit 6e76d125f244e10676b917208f2a074729820246:

Update version for v2.2.0-rc0 release (2014-11-05 15:21:04 +0000)

are available in the git repository at:

git://github.com/cohuck/qemu tags/s390x-20141105

for you to fetch changes up to bb3e9e1fd7ab62b60780c66d68b2d7bfd8758e61:

s390x/sclpconsole: Avoid hanging SCLP ASCII console (2014-11-05 16:35:56 +0100)

----------------------------------------------------------------
Several bugfixes for s390x:
- instruction decoding and sparse warning in kvm
- overlong input and hangs in the sclp consoles

----------------------------------------------------------------

Frank Blaschka (1):
s390x/kvm: Fix opcode decoding for eb instruction handler

Heinz Graalfs (3):
s390x/sclpconsole-lm: truncate input if line is too long s390x/sclpconsole-lm: Fix hanging SCLP line mode console s390x/sclpconsole: Avoid hanging SCLP ASCII console

Thomas Huth (1):
s390x/kvm: Fix warning from sparse

 hw/char/sclpconsole-lm.c |   12 ++++++++----
 hw/char/sclpconsole.c    |   12 +++++++++++-
 target-s390x/kvm.c       |   10 +++++-----
 3 files changed, 24 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

[Qemu-devel] [PULL 1/5] s390x/kvm: Fix opcode decoding for eb instruction handler

From: Frank Blaschka <[email protected]>

The second byte of the opcode is encoded in the lowest byte of the ipb field, not the lowest byte of the ipa field.

---
 target-s390x/kvm.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
target-s390x/kvm.c +4 -4
index 5b10a25..690cb71 100644
@@ -827,18 +827,18 @@ static int handle_b9(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
     return r;
 }
 
-static int handle_eb(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
+static int handle_eb(S390CPU *cpu, struct kvm_run *run, uint8_t ipbl)
 {
     int r = 0;
 
-    switch (ipa1) {
+    switch (ipbl) {
     case PRIV_EB_SQBS:
         /* just inject exception */
         r = -1;
         break;
     default:
         r = -1;
-        DPRINTF("KVM: unhandled PRIV: 0xeb%x\n", ipa1);
+        DPRINTF("KVM: unhandled PRIV: 0xeb%x\n", ipbl);
         break;
     }
 
@@ -1039,7 +1039,7 @@ static int handle_instruction(S390CPU *cpu, struct kvm_run *run)
         r = handle_b9(cpu, run, ipa1);
         break;
     case IPA0_EB:
-        r = handle_eb(cpu, run, ipa1);
+        r = handle_eb(cpu, run, run->s390_sieic.ipb & 0xff);
         break;
     case IPA0_DIAG:
         r = handle_diag(cpu, run, run->s390_sieic.ipb);
Signature · 1 line
1.7.9.5
#2 lore raw

[Qemu-devel] [PULL 3/5] s390x/sclpconsole-lm: truncate input if line is too long

In reply to Cornelia Huck

From: Heinz Graalfs <[email protected]>

As the SCLP line mode console input length is limited by the available SCCB buffer space, it might lock up if the input does not fit into the buffer.

With this patch, characters that don't fit are 'eaten' up to the next CR/LF and the input line is sent truncated to the guest.

---
 hw/char/sclpconsole-lm.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
hw/char/sclpconsole-lm.c +7 -4
index 80dd0a9..605dd50 100644
@@ -52,7 +52,8 @@ typedef struct SCLPConsoleLM {
  * event_pending is set when a newline character is encountered
  *
  * The maximum command line length is limited by the maximum
- * space available in an SCCB
+ * space available in an SCCB. Line mode console input is sent
+ * truncated to the guest in case it doesn't fit into the SCCB.
  */
 
 static int chr_can_read(void *opaque)
@@ -61,10 +62,8 @@ static int chr_can_read(void *opaque)
 
     if (scon->event.event_pending) {
         return 0;
-    } else if (SIZE_CONSOLE_BUFFER - scon->length) {
-        return 1;
     }
-    return 0;
+    return 1;
 }
 
 static void chr_read(void *opaque, const uint8_t *buf, int size)
@@ -78,6 +77,10 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
         sclp_service_interrupt(0);
         return;
     }
+    if (scon->length == SIZE_CONSOLE_BUFFER) {
+        /* Eat the character, but still process CR and LF.  */
+        return;
+    }
     scon->buf[scon->length] = *buf;
     scon->length += 1;
     if (scon->echo) {
Signature · 1 line
1.7.9.5
#3 lore raw

[Qemu-devel] [PULL 2/5] s390x/kvm: Fix warning from sparse

In reply to Cornelia Huck

From: Thomas Huth <[email protected]>

When running "sparse" with the s390x kvm.c code, it complains that "constant 0x00400f1d40330000 is so big it is long" - let's fix this by appending a proper suffix.

---
 target-s390x/kvm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-s390x/kvm.c +1 -1
index 690cb71..d247471 100644
@@ -1272,7 +1272,7 @@ void kvm_s390_crw_mchk(void)
     struct kvm_s390_irq irq = {
         .type = KVM_S390_MCHK,
         .u.mchk.cr14 = 1 << 28,
-        .u.mchk.mcic = 0x00400f1d40330000,
+        .u.mchk.mcic = 0x00400f1d40330000ULL,
     };
     kvm_s390_floating_interrupt(&irq);
 }
Signature · 1 line
1.7.9.5
#4 lore raw

[Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII console

In reply to Cornelia Huck

From: Heinz Graalfs <[email protected]>

Force recalculation of file descriptor sets for main loop's poll(), in order to be able to readd a possibly removed input file descriptor after can_read() returned 0 (zero).

---
 hw/char/sclpconsole.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
hw/char/sclpconsole.c +11 -1
index fca105d..79891df 100644
@@ -36,6 +36,7 @@ typedef struct SCLPConsole {
     uint32_t iov_bs;        /* offset in buf for char layer read operation */
     uint32_t iov_data_len;  /* length of byte stream in buffer             */
     uint32_t iov_sclp_rest; /* length of byte stream not read via SCLP     */
+    bool notify;            /* qemu_notify_event() req'd if true           */
 } SCLPConsole;
 
 /* character layer call-back functions */
@@ -44,8 +45,12 @@ typedef struct SCLPConsole {
 static int chr_can_read(void *opaque)
 {
     SCLPConsole *scon = opaque;
+    int avail = SIZE_BUFFER_VT220 - scon->iov_data_len;
 
-    return SIZE_BUFFER_VT220 - scon->iov_data_len;
+    if (avail == 0) {
+        scon->notify = true;
+    }
+    return avail;
 }
 
 /* Send data from a char device over to the guest */
@@ -113,6 +118,10 @@ static void get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size,
         cons->iov_sclp += avail;
         /* more data pending */
     }
+    if (cons->notify) {
+        cons->notify = false;
+        qemu_notify_event();
+    }
 }
 
 static int read_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr,
@@ -229,6 +238,7 @@ static void console_reset(DeviceState *dev)
    scon->iov_bs = 0;
    scon->iov_data_len = 0;
    scon->iov_sclp_rest = 0;
+   scon->notify = false;
 }
 
 static int console_exit(SCLPEvent *event)
Signature · 1 line
1.7.9.5
#5 lore raw

[Qemu-devel] [PULL 4/5] s390x/sclpconsole-lm: Fix hanging SCLP line mode console

In reply to Cornelia Huck

From: Heinz Graalfs <[email protected]>

Trigger recalculating sets of file descriptors for the main loop's poll() in order to make sure a possibly removed FD 0 from the poll() file descriptor array is re-added. FD 0 is removed from the decriptor array when the console's can_read() callback returns 0.

---
 hw/char/sclpconsole-lm.c |    1 +
 1 file changed, 1 insertion(+)
hw/char/sclpconsole-lm.c +1 -0
index 605dd50..a9f5e62 100644
@@ -128,6 +128,7 @@ static int get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size,
     cons->length = 0;
     /* data provided and no more data pending */
     event->event_pending = false;
+    qemu_notify_event();
     return 0;
 }
 
Signature · 1 line
1.7.9.5
#6 lore raw
In reply to Cornelia Huck

Am 05.11.2014 um 16:48 schrieb Cornelia Huck:

Quoted 27 lines

The following changes since commit 6e76d125f244e10676b917208f2a074729820246:

Update version for v2.2.0-rc0 release (2014-11-05 15:21:04 +0000)

are available in the git repository at:

git://github.com/cohuck/qemu tags/s390x-20141105

for you to fetch changes up to bb3e9e1fd7ab62b60780c66d68b2d7bfd8758e61:

s390x/sclpconsole: Avoid hanging SCLP ASCII console (2014-11-05 16:35:56 +0100)

----------------------------------------------------------------
Several bugfixes for s390x:
- instruction decoding and sparse warning in kvm
- overlong input and hangs in the sclp consoles

----------------------------------------------------------------

Frank Blaschka (1):
s390x/kvm: Fix opcode decoding for eb instruction handler

Heinz Graalfs (3):
s390x/sclpconsole-lm: truncate input if line is too long s390x/sclpconsole-lm: Fix hanging SCLP line mode console s390x/sclpconsole: Avoid hanging SCLP ASCII console

Quoted 8 lines

Thomas Huth (1):
s390x/kvm: Fix warning from sparse

 hw/char/sclpconsole-lm.c |   12 ++++++++----
 hw/char/sclpconsole.c    |   12 +++++++++++-
 target-s390x/kvm.c       |   10 +++++-----
 3 files changed, 24 insertions(+), 10 deletions(-)

FWIW: for 2.2

#7 lore raw
Quoted 19 lines · Christian Borntraeger

Am 05.11.2014 um 16:48 schrieb Cornelia Huck:

Quoted 18 lines

The following changes since commit 6e76d125f244e10676b917208f2a074729820246:

Update version for v2.2.0-rc0 release (2014-11-05 15:21:04 +0000)

are available in the git repository at:

git://github.com/cohuck/qemu tags/s390x-20141105

for you to fetch changes up to bb3e9e1fd7ab62b60780c66d68b2d7bfd8758e61:

s390x/sclpconsole: Avoid hanging SCLP ASCII console (2014-11-05 16:35:56 +0100)

----------------------------------------------------------------
Several bugfixes for s390x:
- instruction decoding and sparse warning in kvm
- overlong input and hangs in the sclp consoles

----------------------------------------------------------------

Applied, thanks.

-- PMM