From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, John Snow <jsnow@redhat.com>, pl@kamp.de
Subject: [Qemu-devel] [PATCH 2/2] ide-test: cdrom_pio_impl fixup
Date: Fri, 20 Nov 2015 17:53:55 -0500 [thread overview]
Message-ID: <1448060035-31973-3-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1448060035-31973-1-git-send-email-jsnow@redhat.com>
Final tidying: move the interrupt wait into the loop,
document that the status read clears the IRQ, and move
the final interrupt check outside of the loop.
This should be functionally equivalent to how it works
currently, but a little less ambiguous and slightly more
explicit about the state transitions.
Signed-off-by: John Snow <jsnow@redhat.com>
---
tests/ide-test.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/tests/ide-test.c b/tests/ide-test.c
index d37dc5e..f94c859 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -719,9 +719,6 @@ static void cdrom_pio_impl(int nblocks)
/* SCSI CDB (READ10) -- read n*2048 bytes from block 0 */
send_scsi_cdb_read10(0, nblocks);
- /* HP3: INTRQ_Wait */
- ide_wait_intr(IDE_PRIMARY_IRQ);
-
/* Read data back: occurs in bursts of 'BYTE_COUNT_LIMIT' bytes.
* If BYTE_COUNT_LIMIT is odd, we transfer BYTE_COUNT_LIMIT - 1 bytes.
* We allow an odd limit only when the remaining transfer size is
@@ -733,16 +730,25 @@ static void cdrom_pio_impl(int nblocks)
for (i = 0; i < DIV_ROUND_UP(rxsize, limit); i++) {
size_t offset = i * (limit / 2);
size_t rem = (rxsize / 2) - offset;
- /* HP2: Check_Status_B */
+
+ /* HP3: INTRQ_Wait */
+ ide_wait_intr(IDE_PRIMARY_IRQ);
+
+ /* HP2: Check_Status_B (and clear IRQ) */
data = ide_wait_clear(BSY);
assert_bit_set(data, DRQ | DRDY);
assert_bit_clear(data, ERR | DF | BSY);
+
/* HP4: Transfer_Data */
for (j = 0; j < MIN((limit / 2), rem); j++) {
rx[offset + j] = le16_to_cpu(inw(IDE_BASE + reg_data));
}
- ide_wait_intr(IDE_PRIMARY_IRQ);
}
+
+ /* Check for final completion IRQ */
+ ide_wait_intr(IDE_PRIMARY_IRQ);
+
+ /* Sanity check final state */
data = ide_wait_clear(DRQ);
assert_bit_set(data, DRDY);
assert_bit_clear(data, DRQ | ERR | DF | BSY);
--
2.4.3
next prev parent reply other threads:[~2015-11-20 22:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-20 22:53 [Qemu-devel] [PATCH 0/2] ide-test: tidy up after pio race fix John Snow
2015-11-20 22:53 ` [Qemu-devel] [PATCH 1/2] ide-test: fix timeouts John Snow
2015-11-24 15:40 ` Kevin Wolf
2015-11-24 17:22 ` John Snow
2015-11-20 22:53 ` John Snow [this message]
2015-11-24 15:35 ` [Qemu-devel] [PATCH 2/2] ide-test: cdrom_pio_impl fixup Kevin Wolf
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=1448060035-31973-3-git-send-email-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.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).