From patchwork Mon Aug 17 14:47:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Reimar_D=C3=B6ffinger?= X-Patchwork-Id: 31522 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id C26FAB70AD for ; Tue, 18 Aug 2009 00:48:44 +1000 (EST) Received: from localhost ([127.0.0.1]:32796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Md3Vn-0002cE-4B for incoming@patchwork.ozlabs.org; Mon, 17 Aug 2009 10:48:39 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Md3VD-0002ZC-KQ for qemu-devel@nongnu.org; Mon, 17 Aug 2009 10:48:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Md3V9-0002WX-5w for qemu-devel@nongnu.org; Mon, 17 Aug 2009 10:48:03 -0400 Received: from [199.232.76.173] (port=39705 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Md3V8-0002WS-To for qemu-devel@nongnu.org; Mon, 17 Aug 2009 10:47:58 -0400 Received: from mail.gmx.net ([213.165.64.20]:39638) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Md3V7-00045p-L7 for qemu-devel@nongnu.org; Mon, 17 Aug 2009 10:47:58 -0400 Received: (qmail invoked by alias); 17 Aug 2009 14:47:56 -0000 Received: from p5B1345D1.dip.t-dialin.net (EHLO localhost) [91.19.69.209] by mail.gmx.net (mp031) with SMTP; 17 Aug 2009 16:47:56 +0200 X-Authenticated: #11956158 X-Provags-ID: V01U2FsdGVkX1/ZhxtpKzfZy0kMlfU692gPEpHBc4Y/8p+hzKqvsy VFNSLk7GAYHPa2 Date: Mon, 17 Aug 2009 16:47:54 +0200 From: Reimar =?iso-8859-1?Q?D=F6ffinger?= To: qemu-devel@nongnu.org Message-ID: <20090817144754.GA31553@1und1.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6899999999999999 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Subject: [Qemu-devel] [HACK] make vmmouse work with KVM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hello, vmmouse uses a giant hack: it uses io ports (in instruction) but passes data via registers. This currently does not work since the qemu CPU registers are (understandably) not kept in sync with the real KVM registers for this operation. Attached patch detects access to the vmmouse port and loads/stores CPU registers into/from the QEMU state. Signed-off-by: Reimar Döffinger diff --git a/kvm-all.c b/kvm-all.c index f669c3a..207378b 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -611,11 +611,21 @@ int kvm_cpu_exec(CPUState *env) switch (run->exit_reason) { case KVM_EXIT_IO: dprintf("handle_io\n"); +#if defined(TARGET_I386) || defined(TARGET_X86_64) + // HACK to make vmport/vmmouse work + if (run->io.port == 0x5658) + kvm_arch_get_registers(env); +#endif ret = kvm_handle_io(env, run->io.port, (uint8_t *)run + run->io.data_offset, run->io.direction, run->io.size, run->io.count); +#if defined(TARGET_I386) || defined(TARGET_X86_64) + // HACK to make vmport/vmmouse work + if (run->io.port == 0x5658) + kvm_arch_put_registers(env); +#endif break; case KVM_EXIT_MMIO: dprintf("handle_mmio\n");