From patchwork Thu Oct 12 11:59:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cameron Esfahani via X-Patchwork-Id: 824894 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=hostfission.com header.i=@hostfission.com header.b="o2uuO4R4"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yCXf01B2Nz9t2c for ; Fri, 13 Oct 2017 01:04:23 +1100 (AEDT) Received: from localhost ([::1]:45756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2e61-0007OR-Eq for incoming@patchwork.ozlabs.org; Thu, 12 Oct 2017 10:04:21 -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) 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= Received: by www1.hostfission.com (Postfix, from userid 1000) id D89C180459; Thu, 12 Oct 2017 22:59:32 +1100 (AEDT) To: qemu-devel@nongnu.org X-PHP-Originating-Script: 0:rcube.php MIME-Version: 1.0 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: , X-Patchwork-Original-From: geoff--- via Qemu-devel From: Cameron Esfahani via Reply-To: geoff@hostfission.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When the guest OS needs to send the mouse commands it will at least in the case of Windows 10 set the KBD_MODE_DISABLE_MOUSE bit to prevent interrupts from causing stream desynchronisation. Here is Windows 10 attempting to issue a PS/2 mouse reset without this fix where you can see the mouse positional data was returned as the answer to the get type command. KBD: kbd: write cmd=0xd4 // write next cmd to the aux port KBD: kbd: read status=0x1c KBD: kbd: read status=0x1c KBD: kbd: read status=0x1c KBD: kbd: write data=0xff kbd: write mouse 0xff // reset KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0xfa // ack KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0xaa // self-test good KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0x00 // the device type KBD: kbd: read status=0x3d KBD: kbd: write cmd=0xd4 // write cmd to the aux port KBD: kbd: read status=0x3d KBD: kbd: write data=0xf2 kbd: write mouse 0xf2 // get type KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0x08 // mouse data byte 1 KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0x00 // mouse data byte 2 KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0x00 // mouse data byte 3 KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0xfa // the ack for the get type above KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0x00 // the device type KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0x08 // mouse data byte 1 KBD: kbd: read status=0x3d KBD: kbd: read status=0x3d KBD: kbd: read data=0x00 // 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 == KBD_PENDING_AUX) { s->status |= KBD_STAT_MOUSE_OBF; s->outport |= 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 = 1; } else { if ((s->mode & KBD_MODE_KBD_INT) &&