qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/5] s390x fixes for 2.2
@ 2014-11-05 15:48 Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 1/5] s390x/kvm: Fix opcode decoding for eb instruction handler Cornelia Huck
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Cornelia Huck @ 2014-11-05 15:48 UTC (permalink / raw)
  To: peter.maydell; +Cc: Cornelia Huck, borntraeger, jfrei, qemu-devel, agraf

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

-- 
1.7.9.5

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

* [Qemu-devel] [PULL 1/5] s390x/kvm: Fix opcode decoding for eb instruction handler
  2014-11-05 15:48 [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Cornelia Huck
@ 2014-11-05 15:48 ` Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 2/5] s390x/kvm: Fix warning from sparse Cornelia Huck
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2014-11-05 15:48 UTC (permalink / raw)
  To: peter.maydell
  Cc: Frank Blaschka, qemu-devel, agraf, borntraeger, jfrei,
	Cornelia Huck

From: Frank Blaschka <blaschka@linux.vnet.ibm.com>

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

Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
---
 target-s390x/kvm.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 5b10a25..690cb71 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -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);
-- 
1.7.9.5

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

* [Qemu-devel] [PULL 2/5] s390x/kvm: Fix warning from sparse
  2014-11-05 15:48 [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 1/5] s390x/kvm: Fix opcode decoding for eb instruction handler Cornelia Huck
@ 2014-11-05 15:48 ` Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 3/5] s390x/sclpconsole-lm: truncate input if line is too long Cornelia Huck
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2014-11-05 15:48 UTC (permalink / raw)
  To: peter.maydell
  Cc: Thomas Huth, qemu-devel, agraf, borntraeger, jfrei, Cornelia Huck

From: Thomas Huth <thuth@linux.vnet.ibm.com>

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.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 target-s390x/kvm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 690cb71..d247471 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -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);
 }
-- 
1.7.9.5

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

* [Qemu-devel] [PULL 3/5] s390x/sclpconsole-lm: truncate input if line is too long
  2014-11-05 15:48 [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 1/5] s390x/kvm: Fix opcode decoding for eb instruction handler Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 2/5] s390x/kvm: Fix warning from sparse Cornelia Huck
@ 2014-11-05 15:48 ` Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 4/5] s390x/sclpconsole-lm: Fix hanging SCLP line mode console Cornelia Huck
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2014-11-05 15:48 UTC (permalink / raw)
  To: peter.maydell
  Cc: Heinz Graalfs, qemu-devel, agraf, borntraeger, jfrei,
	Cornelia Huck

From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>

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.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/char/sclpconsole-lm.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index 80dd0a9..605dd50 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -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) {
-- 
1.7.9.5

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

* [Qemu-devel] [PULL 4/5] s390x/sclpconsole-lm: Fix hanging SCLP line mode console
  2014-11-05 15:48 [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Cornelia Huck
                   ` (2 preceding siblings ...)
  2014-11-05 15:48 ` [Qemu-devel] [PULL 3/5] s390x/sclpconsole-lm: truncate input if line is too long Cornelia Huck
@ 2014-11-05 15:48 ` Cornelia Huck
  2014-11-05 15:48 ` [Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII console Cornelia Huck
  2014-11-10  9:17 ` [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Christian Borntraeger
  5 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2014-11-05 15:48 UTC (permalink / raw)
  To: peter.maydell
  Cc: Heinz Graalfs, qemu-devel, agraf, borntraeger, jfrei,
	Cornelia Huck

From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>

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.

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/char/sclpconsole-lm.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index 605dd50..a9f5e62 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -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;
 }
 
-- 
1.7.9.5

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

* [Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII console
  2014-11-05 15:48 [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Cornelia Huck
                   ` (3 preceding siblings ...)
  2014-11-05 15:48 ` [Qemu-devel] [PULL 4/5] s390x/sclpconsole-lm: Fix hanging SCLP line mode console Cornelia Huck
@ 2014-11-05 15:48 ` Cornelia Huck
  2014-11-10  9:17 ` [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Christian Borntraeger
  5 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2014-11-05 15:48 UTC (permalink / raw)
  To: peter.maydell
  Cc: Heinz Graalfs, qemu-devel, agraf, borntraeger, jfrei,
	Cornelia Huck

From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>

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

Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/char/sclpconsole.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index fca105d..79891df 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -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)
-- 
1.7.9.5

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

* Re: [Qemu-devel] [PULL 0/5] s390x fixes for 2.2
  2014-11-05 15:48 [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Cornelia Huck
                   ` (4 preceding siblings ...)
  2014-11-05 15:48 ` [Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII console Cornelia Huck
@ 2014-11-10  9:17 ` Christian Borntraeger
  2014-11-10 16:28   ` Peter Maydell
  5 siblings, 1 reply; 8+ messages in thread
From: Christian Borntraeger @ 2014-11-10  9:17 UTC (permalink / raw)
  To: Cornelia Huck, peter.maydell; +Cc: jfrei, qemu-devel, agraf

Am 05.11.2014 um 16:48 schrieb Cornelia Huck:
> 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(-)
> 

FWIW: for 2.2
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>

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

* Re: [Qemu-devel] [PULL 0/5] s390x fixes for 2.2
  2014-11-10  9:17 ` [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Christian Borntraeger
@ 2014-11-10 16:28   ` Peter Maydell
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2014-11-10 16:28 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Cornelia Huck, Jens Freimann, QEMU Developers, Alexander Graf

On 10 November 2014 09:17, Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> Am 05.11.2014 um 16:48 schrieb Cornelia Huck:
>> 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

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

end of thread, other threads:[~2014-11-10 16:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-05 15:48 [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Cornelia Huck
2014-11-05 15:48 ` [Qemu-devel] [PULL 1/5] s390x/kvm: Fix opcode decoding for eb instruction handler Cornelia Huck
2014-11-05 15:48 ` [Qemu-devel] [PULL 2/5] s390x/kvm: Fix warning from sparse Cornelia Huck
2014-11-05 15:48 ` [Qemu-devel] [PULL 3/5] s390x/sclpconsole-lm: truncate input if line is too long Cornelia Huck
2014-11-05 15:48 ` [Qemu-devel] [PULL 4/5] s390x/sclpconsole-lm: Fix hanging SCLP line mode console Cornelia Huck
2014-11-05 15:48 ` [Qemu-devel] [PULL 5/5] s390x/sclpconsole: Avoid hanging SCLP ASCII console Cornelia Huck
2014-11-10  9:17 ` [Qemu-devel] [PULL 0/5] s390x fixes for 2.2 Christian Borntraeger
2014-11-10 16:28   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).