From: Ingo Molnar Subject: Re: [PATCH] kvm tools: Add support for PS/2 keyboard system Date: Thu, 2 Jun 2011 09:21:19 +0200 Message-ID: <20110602072119.GB2150@elte.hu> References: <1306940036-15540-1-git-send-email-levinsasha928@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: penberg@kernel.org, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, John Floren To: Sasha Levin Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:51955 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932145Ab1FBHVa (ORCPT ); Thu, 2 Jun 2011 03:21:30 -0400 Content-Disposition: inline In-Reply-To: <1306940036-15540-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: * Sasha Levin wrote: > From: John Floren > > Add support for PS/2 keyboard system with AUX device (aka mouse). > The device works with vnc, the guest must be started with the > '--vnc' parameter for the device to be initialized. > > Signed-off-by: John Floren > [ turn into patch and clean up code ] > Signed-off-by: Sasha Levin > --- > tools/kvm/Makefile | 1 + > tools/kvm/hw/pckbd.c | 475 +++++++++++++++++++++++++++++++++++++++++ Since this is a PS2 keyboard and mouse driver please name it i8042.[ch] like the kernel-side does. that will also make it easier to find the guest-side <-> host-side pair of guest-driver/host-driver files :-) > tools/kvm/hw/vesa.c | 3 + > tools/kvm/include/kvm/pckbd.h | 19 ++ > tools/kvm/ioport.c | 4 - > tools/kvm/kvm-run.c | 5 +- > 6 files changed, 502 insertions(+), 5 deletions(-) > create mode 100644 tools/kvm/hw/pckbd.c > create mode 100644 tools/kvm/include/kvm/pckbd.h In general the code looks very clean to me! Found two minor nits: > + ret = state.kq[state.kread++ % QUEUE_SIZE]; > + ret = state.mq[state.mread++ % QUEUE_SIZE]; Please increment the index explicitly, on a separate line - the permanent side-effect to the keyboard state is not obvious at first sight. Thanks, Ingo