From: David Ahern <daahern@cisco.com>
To: qemu-devel@nongnu.org
Cc: jan.kiszka@web.de, David Ahern <daahern@cisco.com>
Subject: [Qemu-devel] [PATCH] ehci: honor frame expiration, async list picks up where it left off
Date: Fri, 9 Jul 2010 13:19:33 -0600 [thread overview]
Message-ID: <1278703173-18486-1-git-send-email-daahern@cisco.com> (raw)
Per Section 4 of the EHCI spec the HC should not start transactions that
will not be completed before the end of the micro-frame. For async
lists processing in the next frame should pick up where it left off.
However, when debugging is enabled we need to allow an overrun since the
printfs take too much time.
Signed-off-by: David Ahern <daahern@cisco.com>
---
hw/usb-ehci.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 6e455a2..53ee1fb 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -1308,14 +1308,10 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async, int *state)
int again = 0;
uint32_t entry = ehci->fetch_addr;
-#if 0
- if (qemu_get_clock(vm_clock) / 1000 > ehci->frame_end_usec) {
+#if EHCI_DEBUG == 0
+ if (qemu_get_clock(vm_clock) / 1000 >= ehci->frame_end_usec) {
if (async) {
-/* TO-DO: supposed to be saving the horizontal QH and picking up
- * from there on next frame
- */
- printf("FETCHENTRY: FRAME timer elapsed, exit state machine\n");
- *state = EST_ACTIVE;
+ DPRINTF("FETCHENTRY: FRAME timer elapsed, exit state machine\n");
goto out;
} else {
DPRINTF("FETCHENTRY: WARNING "
@@ -1773,8 +1769,9 @@ static int ehci_advance_state(EHCIState *ehci,
static void ehci_advance_async_state(EHCIState *ehci)
{
EHCIqh qh;
+ int state = ehci->astate;
- switch(ehci->astate) {
+ switch(state) {
case EST_INACTIVE:
if (!(ehci->usbcmd & USBCMD_ASE)) {
break;
@@ -1815,13 +1812,16 @@ static void ehci_advance_async_state(EHCIState *ehci)
break;
}
- ehci->astate = ehci_advance_state(ehci, 1, EST_WAITLISTHEAD);
- break;
+ state = EST_WAITLISTHEAD;
+ /* fall through */
+
+ case EST_FETCHENTRY:
+ /* fall through */
case EST_EXECUTING:
get_dwords(NLPTR_GET(ehci->qhaddr), (uint32_t *) &qh,
sizeof(EHCIqh) >> 2);
- ehci->astate = ehci_advance_state(ehci, 1, EST_EXECUTING);
+ ehci->astate = ehci_advance_state(ehci, 1, state);
break;
default:
@@ -1905,7 +1905,7 @@ static void ehci_frame_timer(void *opaque)
usec_now = t_now / 1000;
usec_elapsed = usec_now - ehci->last_run_usec;
frames = usec_elapsed / FRAME_TIMER_USEC;
- ehci->frame_end_usec = usec_now + FRAME_TIMER_USEC;
+ ehci->frame_end_usec = usec_now + FRAME_TIMER_USEC - 10;
for(i = 0; i < frames; i++) {
if ( !(ehci->usbsts & USBSTS_HALT)) {
--
1.7.1.1
reply other threads:[~2010-07-09 19:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1278703173-18486-1-git-send-email-daahern@cisco.com \
--to=daahern@cisco.com \
--cc=jan.kiszka@web.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).