qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] More 2.2->2.1 migration refinements
@ 2014-12-22 13:53 Paolo Bonzini
  2014-12-22 13:53 ` [Qemu-devel] [PATCH 1/2] serial: refine serial_thr_ipending_needed Paolo Bonzini
  2014-12-22 13:53 ` [Qemu-devel] [PATCH 2/2] pckbd: set bits 2-3-6-7 of the output port by default Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-12-22 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: imammedo

Two more changes.  The first is a bit of a shot in the dark, because I
cannot reproduce it, but it's obviously an improvement.

Paolo Bonzini (2):
  serial: refine serial_thr_ipending_needed
  pckbd: set bits 2-3-6-7 of the output port by default

 hw/char/serial.c | 13 +++++++++++--
 hw/input/pckbd.c | 10 ++++++++--
 2 files changed, 19 insertions(+), 4 deletions(-)

-- 
2.1.0

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

* [Qemu-devel] [PATCH 1/2] serial: refine serial_thr_ipending_needed
  2014-12-22 13:53 [Qemu-devel] [PATCH 0/2] More 2.2->2.1 migration refinements Paolo Bonzini
@ 2014-12-22 13:53 ` Paolo Bonzini
  2014-12-22 13:53 ` [Qemu-devel] [PATCH 2/2] pckbd: set bits 2-3-6-7 of the output port by default Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-12-22 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: imammedo, qemu-stable

If the THR interrupt is disabled, there is no need to migrate thr_ipending
because LSR.THRE will be sampled again when the interrupt is enabled.
(This is the behavior that is not documented in the datasheet, but
relied on by Windows!)

Note that in this case IIR will never be 0x2 so, if thr_ipending were
to be one, QEMU would produce the subsection.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index 6d522ff..3aca874 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -645,8 +645,17 @@ static int serial_post_load(void *opaque, int version_id)
 static bool serial_thr_ipending_needed(void *opaque)
 {
     SerialState *s = opaque;
-    bool expected_value = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
-    return s->thr_ipending != expected_value;
+
+    if (s->ier & UART_IER_THRI) {
+        bool expected_value = ((s->iir & UART_IIR_ID) == UART_IIR_THRI);
+        return s->thr_ipending != expected_value;
+    } else {
+        /* LSR.THRE will be sampled again when the interrupt is enabled.
+         * thr_ipending is not used in this case, do not migrate it.  It
+         * will be set to false on the destination machine.
+         */
+        return false;
+    }
 }
 
 const VMStateDescription vmstate_serial_thr_ipending = {
-- 
2.1.0

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

* [Qemu-devel] [PATCH 2/2] pckbd: set bits 2-3-6-7 of the output port by default
  2014-12-22 13:53 [Qemu-devel] [PATCH 0/2] More 2.2->2.1 migration refinements Paolo Bonzini
  2014-12-22 13:53 ` [Qemu-devel] [PATCH 1/2] serial: refine serial_thr_ipending_needed Paolo Bonzini
@ 2014-12-22 13:53 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-12-22 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: imammedo, qemu-stable

OSes typically write 0xdd/0xdf to turn the A20 line off and on.  This
has bits 2-3-6-7 on, so that the output port subsection is migrated.
Change the reset value and migration default to include those four
bits, thus avoiding that the subsection is migrated.

This strictly speaking changes guest ABI, but the long time during which
we have not migrated the value means that the guests really do not care
much; so the change is for all machine types.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/input/pckbd.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 2b0cd3d..9b9a7d7 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -101,6 +101,12 @@
 #define KBD_OUT_OBF             0x10    /* Keyboard output buffer full */
 #define KBD_OUT_MOUSE_OBF       0x20    /* Mouse output buffer full */
 
+/* OSes typically write 0xdd/0xdf to turn the A20 line off and on.
+ * We make the default value of the outport include these four bits,
+ * so that the subsection is rarely necessary.
+ */
+#define KBD_OUT_ONES            0xcc
+
 /* Mouse Commands */
 #define AUX_SET_SCALE11		0xE6	/* Set 1:1 scaling */
 #define AUX_SET_SCALE21		0xE7	/* Set 2:1 scaling */
@@ -367,13 +373,13 @@ static void kbd_reset(void *opaque)
 
     s->mode = KBD_MODE_KBD_INT | KBD_MODE_MOUSE_INT;
     s->status = KBD_STAT_CMD | KBD_STAT_UNLOCKED;
-    s->outport = KBD_OUT_RESET | KBD_OUT_A20;
+    s->outport = KBD_OUT_RESET | KBD_OUT_A20 | KBD_OUT_ONES;
     s->outport_present = false;
 }
 
 static uint8_t kbd_outport_default(KBDState *s)
 {
-    return KBD_OUT_RESET | KBD_OUT_A20
+    return KBD_OUT_RESET | KBD_OUT_A20 | KBD_OUT_ONES
            | (s->status & KBD_STAT_OBF ? KBD_OUT_OBF : 0)
            | (s->status & KBD_STAT_MOUSE_OBF ? KBD_OUT_MOUSE_OBF : 0);
 }
-- 
2.1.0

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

end of thread, other threads:[~2014-12-22 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-22 13:53 [Qemu-devel] [PATCH 0/2] More 2.2->2.1 migration refinements Paolo Bonzini
2014-12-22 13:53 ` [Qemu-devel] [PATCH 1/2] serial: refine serial_thr_ipending_needed Paolo Bonzini
2014-12-22 13:53 ` [Qemu-devel] [PATCH 2/2] pckbd: set bits 2-3-6-7 of the output port by default Paolo Bonzini

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