qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 09/10] pckbd: correctly disable PS/2 communication


From: Volker Rümelin
Subject: Re: [PATCH 09/10] pckbd: correctly disable PS/2 communication
Date: Thu, 6 May 2021 20:06:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0

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_qemu@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

[Prev in Thread] Current Thread [Next in Thread]