From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuKZM-0003sF-Th for qemu-devel@nongnu.org; Mon, 18 May 2015 08:54:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuKZI-0004Il-0u for qemu-devel@nongnu.org; Mon, 18 May 2015 08:54:56 -0400 Message-ID: <5559E118.9070606@redhat.com> Date: Mon, 18 May 2015 06:54:48 -0600 From: Eric Blake MIME-Version: 1.0 References: <20150517160052.6B12849ED81@webmail.sinamail.sina.com.cn> In-Reply-To: <20150517160052.6B12849ED81@webmail.sinamail.sina.com.cn> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HijARj14IhDH4SHkjIlMwUm6vH7o6nbpf" Subject: Re: [Qemu-devel] [PATCH] keyboard: handle ps2 typing buffer overrun List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: penghao122@sina.com, qemu-devel Cc: qemu-stable This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HijARj14IhDH4SHkjIlMwUm6vH7o6nbpf Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/17/2015 10:00 AM, penghao122@sina.com wrote: > Subject: [PATCH] keyboard: handle ps2 typing buffer overrun This line is redundant. Also, you have tried to send this patch more than once. Please be sure to include a proper 'v3' or 'v4' in the subject line, as appropriate. > Starting a linux guest with ps2 keyboard, if you type many times during= leaving > grub and into linux kernel,then you can't use keyboard after linux init= ialization finished. > Specally when you setup linux guest from iso file,you will type in grub= =2E s/Specally/Specifically,/ s/file,you/file, you/ > During grub,the work method of ps2 keyboard is like this: > First, ps2 keyboard driver send command KBD_CCMD_KBD_ENABLE. > Second, if there is a keyboard input, then ps2 keyboard driver read dat= a. > Third, ps2 keyboard driver send command KBD_CCMD_KBD_ENABLE again. > After leaving grub and before finishing linux kernel ps2 driver initial= ization, > if you type many times, the input data keep saving in ps2 queue of qemu= =2E > Before linux kernel initialize ps2 keyboard,linux call i8042_controller= _check, s/initialize/initializes/ s/keyboard,linux call/keyboard, linux calls/ > I8042_STR_OBF. Then i8042_flush() will return I8042_BUFFER_SIZE. > Signed-off-by: Hao Peng Usually a blank line between the main commit body and the trailing tags like Signed-off-by. > --- > hw/input/pckbd.c | 11 +++++++++-- > hw/input/ps2.c | 7 +++++++ > include/hw/input/ps2.h | 1 + > 3 files changed, 17 insertions(+), 2 deletions(-) > diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c > index 9b9a7d7..1253b04 100644 > --- a/hw/input/pckbd.c > +++ b/hw/input/pckbd.c > @@ -207,6 +207,8 @@ static uint64_t kbd_read_status(void *opaque, hwadd= r addr, > KBDState *s =3D opaque; > int val; > val =3D s->status; > + if(s->write_cmd =3D=3D KBD_CCMD_KBD_ENABLE) > + val &=3D ~KBD_STAT_OBF; Missing {}, and please use space after keywords like 'if'. Please run =2E/scripts/checkpatch.pl on your submission. > DPRINTF("kbd: read status=3D0x%02x\n", val); > return val; > } > @@ -251,9 +253,10 @@ static void kbd_write_command(void *opaque, hwaddr= addr, > else > val =3D KBD_CCMD_NO_OP; > } > - > + s->write_cmd =3D 0; > switch(val) { Pre-existing, but as long as you are touching this code, it is worth putting a space after the keyword 'switch'. > @@ -364,7 +368,10 @@ static void kbd_write_data(void *opaque, hwaddr ad= dr, > default: > break; > } > - s->write_cmd =3D 0; > + if(s->write_cmd =3D=3D KBD_CCMD_WRITE_MODE && s->mode =3D=3D 0x61)= > + s->write_cmd =3D KBD_CCMD_KBD_ENABLE; > + else > + s->write_cmd =3D 0; More missing {}, and another missing space after 'if'. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --HijARj14IhDH4SHkjIlMwUm6vH7o6nbpf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVWeEYAAoJEKeha0olJ0NqKuUH/2lPy+pmRUENw9rjddXCJufD WFBH9CJTDPkd3AyUY0xXrb1pP1KkC284SJANeU+NwFA6LJpjjLUmBucDI5/X8LSH sH2OyhvDdBLW+LySF9DhVmNV+lmM+3xtSnLdB/MXB8bknuYl+qKICZYFhcI+qMZj jxweskbyu+dQp0vlR9GlnV5mHF+wmS/6vJ/vd5oI4Y8iqWM27SaYxcLbuWxjhJoE 78/8+bCIec8fuuIzhDOy2hi7Ua3IeBG1BA3lB7gPadlkelcN0XbTJ/Z7M3hQ8hKs rqmyKgEwTniPpkKAiQvToGG6sYAx+DoUQNpZhz010d8XM/PtsOQVNoujMO4yp0g= =96/H -----END PGP SIGNATURE----- --HijARj14IhDH4SHkjIlMwUm6vH7o6nbpf--