Skip to content

Commit d13c040

Browse files
committed
pckbd: set bits 2-3-6-7 of the output port by default
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>
1 parent bfa7362 commit d13c040

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

hw/input/pckbd.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@
101101
#define KBD_OUT_OBF 0x10 /* Keyboard output buffer full */
102102
#define KBD_OUT_MOUSE_OBF 0x20 /* Mouse output buffer full */
103103

104+
/* OSes typically write 0xdd/0xdf to turn the A20 line off and on.
105+
* We make the default value of the outport include these four bits,
106+
* so that the subsection is rarely necessary.
107+
*/
108+
#define KBD_OUT_ONES 0xcc
109+
104110
/* Mouse Commands */
105111
#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */
106112
#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */
@@ -367,13 +373,13 @@ static void kbd_reset(void *opaque)
367373

368374
s->mode = KBD_MODE_KBD_INT | KBD_MODE_MOUSE_INT;
369375
s->status = KBD_STAT_CMD | KBD_STAT_UNLOCKED;
370-
s->outport = KBD_OUT_RESET | KBD_OUT_A20;
376+
s->outport = KBD_OUT_RESET | KBD_OUT_A20 | KBD_OUT_ONES;
371377
s->outport_present = false;
372378
}
373379

374380
static uint8_t kbd_outport_default(KBDState *s)
375381
{
376-
return KBD_OUT_RESET | KBD_OUT_A20
382+
return KBD_OUT_RESET | KBD_OUT_A20 | KBD_OUT_ONES
377383
| (s->status & KBD_STAT_OBF ? KBD_OUT_OBF : 0)
378384
| (s->status & KBD_STAT_MOUSE_OBF ? KBD_OUT_MOUSE_OBF : 0);
379385
}

0 commit comments

Comments
 (0)