All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mats Petersson <mats.petersson@citrix.com>
To: xen-devel@lists.xen.org
Subject: Re: [PATCH 2 of 5] rombios/ata: Do not wait for BSY to be set
Date: Tue, 27 Nov 2012 17:02:58 +0000	[thread overview]
Message-ID: <50B4F242.8080103@citrix.com> (raw)
In-Reply-To: <20121127164637.GG51942@ocelot.phlegethon.org>

On 27/11/12 16:46, Tim Deegan wrote:
> At 16:41 +0000 on 26 Nov (1353948093), Andrew Cooper wrote:
>> I can't find any guarantee in the ATA specification that this will happen, and it
>> certainly does not with Qemu.  SeaBIOS has replaced it with a call to udelay(5)
>> instead.
>>
>> As rombios does not have an equivalent udelay(), replace the wait with a write
>> to port 0x80 which is whitelisted by Xen for 'a small delay'.
> Does this actually do anything useful?  I'd guess that on qemu the extra
> outb has no effect and on real hardware that needed a delay here, one
> I/O cycle would not be enough.

I believe it's quite a significant delay also on real hardware - but 
real hardware isn't booting 100s of OSes in short succession [typically, 
at least], as it has to trickle through all the buses and stuff down to 
the southbridge. Which is quite a large number of cycles even in a 
modern system.

It is typically used to ensure that "some other bus cycle" goes in 
between two IO operations that affect each other, where the hardware is 
run by a significantly slower processor than the CPU - a 16MHz 16-bit 
processor or some such. It allows the hardware to "react" to the IO 
instructions, and change state. Yes, it's daft, and we can't fix that.

In QEMU, it's not going to matter, as the "hardware" is idealised and 
don't have the same timing restrictions of REAL hardware.

--
mats
>
> Tim.
>
>> This causes roughly 42k fewer traps to Qemu, which is very roughly 10% of the
>> number of traps during boot of a Win7 guest.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>
>> diff -r 1728fb789940 -r c223c044afbf tools/firmware/rombios/rombios.c
>> --- a/tools/firmware/rombios/rombios.c
>> +++ b/tools/firmware/rombios/rombios.c
>> @@ -2914,8 +2914,8 @@ Bit16u device;
>>   // 8.2.1 (a) -- set SRST in DC
>>     outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN | ATA_CB_DC_SRST);
>>   
>> -// 8.2.1 (b) -- wait for BSY
>> -  await_ide(BSY, iobase1, 20);
>> +// 8.2.1 (b) -- wait
>> +  outb(0x80, 0x00);
>>   
>>   // 8.2.1 (f) -- clear SRST
>>     outb(iobase2+ATA_CB_DC, ATA_CB_DC_HD15 | ATA_CB_DC_NIEN);
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
>

  reply	other threads:[~2012-11-27 17:02 UTC|newest]

Thread overview: 27+ 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
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 [this message]
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 2 of 5] rombios/ata: Do not wait for BSY to be set Andrew Cooper
2012-07-30 20:18   ` Pasi Kärkkäinen

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=50B4F242.8080103@citrix.com \
    --to=mats.petersson@citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.