Hi Volker,

On 5/5/21 9:21 PM, Volker Rümelin wrote:
Currently the PS/2 controller command KBD_CCMD_MOUSE_DISABLE
doesn't disable the PS/2 mouse communication at all, and the
PS/2 controller commands KBD_CCMD_KBD_DISABLE and
KBD_CCMD_KBD_ENABLE disable and enable the keyboard interrupt,
which is very different from what a real PS/2 controller does.
A guest may notice the difference.

Mask out pending data on disabled queues to correctly disable
the PS/2 controller communication.

Signed-off-by: Volker Rümelin <vr_q...@t-online.de>
---
  hw/input/pckbd.c | 48 +++++++++++++++++++++++++++++++++++-------------
  1 file changed, 35 insertions(+), 13 deletions(-)
+static uint8_t kbd_pending(KBDState *s)
+{
+    return s->pending & (~s->mode | ~(KBD_PENDING_KBD | KBD_PENDING_AUX));
+}
Please introduce kbd_pending() in a preliminary patch.

OK, I will send a version 2 patch series with an additional patch.

With best regards,
Volker

  /* update irq and KBD_STAT_[MOUSE_]OBF */
  static void kbd_update_irq(KBDState *s)
  {
+    uint8_t pending = kbd_pending(s);
+
      s->status &= ~(KBD_STAT_OBF | KBD_STAT_MOUSE_OBF);
      s->outport &= ~(KBD_OUT_OBF | KBD_OUT_MOUSE_OBF);
-    if (s->pending) {
+    if (pending) {
          s->status |= KBD_STAT_OBF;
          s->outport |= KBD_OUT_OBF;
-        if (s->pending & KBD_PENDING_CTRL_KBD) {
+        if (pending & KBD_PENDING_CTRL_KBD) {
              s->obsrc = KBD_OBSRC_CTRL;


Reply via email to