xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Keir Fraser <keir@xen.org>, xen-devel@lists.xen.org
Subject: Re: [PATCH 1 of 5] rombios/keyboard: Don't needlessly poll the status register
Date: Tue, 27 Nov 2012 16:33:22 +0000	[thread overview]
Message-ID: <20121127163322.GF51942@ocelot.phlegethon.org> (raw)
In-Reply-To: <1728fb78994054ad3695.1353948092@andrewcoop.uk.xensource.com>

At 16:41 +0000 on 26 Nov (1353948092), Andrew Cooper wrote:
> Repeated polling of the status register is not going to change its value, so
> don't needlessly take 8192 traps to Qemu when 1 will do.

AFAICS the purpose of this loop is to handle the case where someone's
actually typing at the time.  The 0x2000 is intended to make us wait
long enough for the next keypress or autorepeat.

Reducing the loop to _2_ outb(0x80)s seems strange -- is there some case
in qemu where another character will be presented after 2 delays but not
immediately?

If not, can we dispense with 'max' altogether and just have 
    while ( (inb(0x64) & 0x01) ) { inb(0x60); outb(0x80, 0x00); }
or even
    while ( (inb(0x64) & 0x01) ) inb(0x60);
?

Tim.

> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> diff -r 0049de3827bc -r 1728fb789940 tools/firmware/rombios/rombios.c
> --- a/tools/firmware/rombios/rombios.c
> +++ b/tools/firmware/rombios/rombios.c
> @@ -1805,12 +1805,12 @@ keyboard_init()
>      while ( (inb(0x64) & 0x02) && (--max>0)) outb(0x80, 0x00);
>  
>      /* flush incoming keys */
> -    max=0x2000;
> +    max=2;
>      while (--max > 0) {
>          outb(0x80, 0x00);
>          if (inb(0x64) & 0x01) {
>              inb(0x60);
> -            max = 0x2000;
> +            max = 2;
>              }
>          }
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

  parent reply	other threads:[~2012-11-27 16:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26 16:41 [PATCH 0 of 5] HVM performance improvements Andrew Cooper
2012-11-26 16:41 ` [PATCH 1 of 5] rombios/keyboard: Don't needlessly poll the status register Andrew Cooper
2012-11-26 16:48   ` Ian Campbell
2012-11-26 16:53     ` Andrew Cooper
2012-11-27 16:33   ` Tim Deegan [this message]
2012-11-27 17:08     ` Andrew Cooper
2012-11-26 16:41 ` [PATCH 2 of 5] rombios/ata: Do not wait for BSY to be set Andrew Cooper
2012-11-27 16:46   ` Tim Deegan
2012-11-27 17:02     ` Mats Petersson
2012-11-27 17:08     ` Alan Cox
2012-11-27 17:22       ` Andrew Cooper
2012-11-27 17:49         ` Alan Cox
2012-11-27 18:24           ` Andrew Cooper
2012-11-26 16:41 ` [PATCH 3 of 5] rombios/ata: Reading this status register has no relevant side effects Andrew Cooper
2012-11-26 16:51   ` Ian Campbell
2012-11-26 16:56     ` Andrew Cooper
2012-11-26 17:01       ` Ian Campbell
2012-11-26 16:41 ` [PATCH 4 of 5] rombios/ata Remove more needless traps from the int 0x13 path Andrew Cooper
2012-11-26 16:41 ` [PATCH 5 of 5] rombios/debug: Reduce verbosity of rombios Andrew Cooper
2012-11-27 17:07   ` Tim Deegan
2013-05-09 14:07 ` [PATCH 0 of 5] HVM performance improvements Pasi Kärkkäinen
2013-08-05 16:31   ` Pasi Kärkkäinen
2013-08-05 17:10     ` Andrew Cooper
2013-08-06  9:57       ` George Dunlap
2013-08-06  9:59         ` Andrew Cooper
  -- strict thread matches above, loose matches on Subject: below --
2012-07-30 19:47 [PATCH 0 of 5] Rombios PIO performance Andrew Cooper
2012-07-30 19:47 ` [PATCH 1 of 5] rombios/keyboard: Don't needlessly poll the status register Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121127163322.GF51942@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).