From nobody Thu May 2 09:14:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507817129718354.4313763034529; Thu, 12 Oct 2017 07:05:29 -0700 (PDT) Received: from localhost ([::1]:45767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2e73-0008Rk-0g for importer@patchew.org; Thu, 12 Oct 2017 10:05:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2c9R-0004qa-R7 for qemu-devel@nongnu.org; Thu, 12 Oct 2017 07:59:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2c9O-00028H-KJ for qemu-devel@nongnu.org; Thu, 12 Oct 2017 07:59:45 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:41620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2c9O-000276-7y for qemu-devel@nongnu.org; Thu, 12 Oct 2017 07:59:42 -0400 Received: from www1.hostfission.com (www1.hostfission.com [139.99.139.52]) by mail1.hostfission.com (Postfix) with ESMTP id EC2B2422DE for ; Thu, 12 Oct 2017 22:59:32 +1100 (AEDT) Received: by www1.hostfission.com (Postfix, from userid 1000) id D89C180459; Thu, 12 Oct 2017 22:59:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1507809572; bh=SN3ZCDHnO5nCaa5Sv/9nKTBcIzFHt4maYfT1amOwX6c=; h=To:Subject:Date:From:From; b=o2uuO4R4VwTwzlprGyuJ0ZM3Nwta8tk1B2USvPb+vp9u0zUTZNvLkl/WAmxObyKFM a4q3AccKAZrk6rEHOOo9Kys3OZM8wtO6Uo1GglaNaGp8u/c12fuamLWNO2MLjqeZ8m A5tRlY+44EhfsDILAsDkjtCjclZxDNcoNvOYA2Tg= To: qemu-devel@nongnu.org X-PHP-Originating-Script: 0:rcube.php MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Date: Thu, 12 Oct 2017 22:59:32 +1100 Message-ID: X-Sender: geoff@hostfission.com User-Agent: Roundcube Webmail/1.2.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 139.99.139.48 X-Mailman-Approved-At: Thu, 12 Oct 2017 10:03:36 -0400 Subject: [Qemu-devel] [PATCH] [pckbd] Prevent IRQs when the guest disables the mouse X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: geoff--- via Qemu-devel Reply-To: geoff@hostfission.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8"; format="flowed" When the guest OS needs to send the mouse commands it will at least in=20 the case of Windows 10 set the KBD_MODE_DISABLE_MOUSE bit to prevent interrupts=20 from causing stream desynchronisation. Here is Windows 10 attempting to issue a PS/2 mouse reset without this=20 fix where you can see the mouse positional data was returned as the answer to the=20 get type command. KBD: kbd: write cmd=3D0xd4 // write next cmd to the aux port KBD: kbd: read status=3D0x1c KBD: kbd: read status=3D0x1c KBD: kbd: read status=3D0x1c KBD: kbd: write data=3D0xff kbd: write mouse 0xff // reset KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0xfa // ack KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0xaa // self-test good KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0x00 // the device type KBD: kbd: read status=3D0x3d KBD: kbd: write cmd=3D0xd4 // write cmd to the aux port KBD: kbd: read status=3D0x3d KBD: kbd: write data=3D0xf2 kbd: write mouse 0xf2 // get type KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0x08 // mouse data byte 1 KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0x00 // mouse data byte 2 KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0x00 // mouse data byte 3 KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0xfa // the ack for the get type above KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0x00 // the device type KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0x08 // mouse data byte 1 KBD: kbd: read status=3D0x3d KBD: kbd: read status=3D0x3d KBD: kbd: read data=3D0x00 // mouse data byte 2 Signed-off-by: Geoffrey McRae --- hw/input/pckbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c479f827b6..78d5356817 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -168,7 +168,8 @@ static void kbd_update_irq(KBDState *s) if (s->pending =3D=3D KBD_PENDING_AUX) { s->status |=3D KBD_STAT_MOUSE_OBF; s->outport |=3D KBD_OUT_MOUSE_OBF; - if (s->mode & KBD_MODE_MOUSE_INT) + if ((s->mode & KBD_MODE_MOUSE_INT) && + !(s->mode & KBD_MODE_DISABLE_MOUSE)) irq_mouse_level =3D 1; } else { if ((s->mode & KBD_MODE_KBD_INT) && --=20 2.11.0