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: "Denis V. Lunev\" via" X-Patchwork-Id: 10002091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51DF66028A for ; Thu, 12 Oct 2017 14:04:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 411C728C6C for ; Thu, 12 Oct 2017 14:04:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34CFC28DE9; Thu, 12 Oct 2017 14:04:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F18D428C6C for ; Thu, 12 Oct 2017 14:04:57 +0000 (UTC) Received: from localhost ([::1]:45756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2e6b-0007OR-7j for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 Oct 2017 10:04:57 -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: "Denis V. Lunev\" via" Reply-To: geoff@hostfission.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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) &&