Skip to contentSkip to conversation

uhci: stop queue filling when we find a in-flight td

PATCH In review Gerd Hoffmann 2 participants 2 messages Mar 21, 2012 – Mar 22, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uhci: stop queue filling when we find a in-flight td

Not only QHs can form rings, but TDs too. With the new queuing/pipelining support we are following TD chains and can actually walk in circles. An assert() prevents us from entering an endless loop then.

Fix is easy: Just stop queuing when we figure the TD we are about to queue up is in flight already.

---
 hw/usb/hcd-uhci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/usb/hcd-uhci.c +3 -0
index e55dad9..2be564b 100644
@@ -965,6 +965,9 @@ static void uhci_fill_queue(UHCIState *s, UHCI_TD *td)
         }
         trace_usb_uhci_td_queue(plink & ~0xf, ptd.ctrl, ptd.token);
         ret = uhci_handle_td(s, plink, &ptd, &int_mask);
+        if (ret == TD_RESULT_ASYNC_CONT) {
+            break;
+        }
         assert(ret == TD_RESULT_ASYNC_START);
         assert(int_mask == 0);
         plink = ptd.link;
Signature · 1 line
1.7.1
#1 lore raw

hw/usb/hcd-uhci.c static void uhci_fill_queue(UHCIState *s, UHCI_TD

Quoted 18 lines · Gerd Hoffmann

Not only QHs can form rings, but TDs too. With the new queuing/pipelining support we are following TD chains and can actually walk in circles. An assert() prevents us from entering an endless loop then.

Fix is easy: Just stop queuing when we figure the TD we are about to queue up is in flight already.

---
 hw/usb/hcd-uhci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/usb/hcd-uhci.c +0 -0
index e55dad9..2be564b 100644
@@ -965,6 +965,9 @@ static void uhci_fill_queue(UHCIState *s, UHCI_TD

*td)

Quoted 10 lines
hw/usb/hcd-uhci.c +3 -1
         }
         trace_usb_uhci_td_queue(plink & ~0xf, ptd.ctrl, ptd.token);
         ret = uhci_handle_td(s, plink, &ptd, &int_mask);
+        if (ret == TD_RESULT_ASYNC_CONT) {
+            break;
+        }
         assert(ret == TD_RESULT_ASYNC_START);
         assert(int_mask == 0);
         plink = ptd.link;
--
Quoted 3 lines

1.7.1

Issue fixed - my Windows boots again :-)

Thanks a lot!

Best regards,

Erik