Skip to contentSkip to conversation

xhci: fix control transfer event reporting

PATCH In review Gerd Hoffmann 2 participants 4 messages May 5, 2015

lore
Share & tools
lore
#0 lore raw

cover xhci: fix control transfer event reporting

Hi,

Laszlos fix unfortunaly had unwanted side effects, so we have to take a different approach to fix the issue at hand.

please review,
Gerd

Gerd Hoffmann (2):
Revert "xhci: generate a Transfer Event for each Transfer TRB with the
IOC bit set"
xhci: fix events for setup trb.

 hw/usb/hcd-xhci.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 Revert "xhci: generate a Transfer Event for each Transfer TRB with the IOC bit set"

This makes xhci generate multiple short packet events in case of multi-trb transfers. Which is wrong. We need to fix this in a different way.

This reverts commit aa6857891df614c620e6e9fc4bc4af6e0e49cafd.

---
 hw/usb/hcd-xhci.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
hw/usb/hcd-xhci.c +3 -12
index 2af3dd6..39aacf7 100644
@@ -1767,18 +1767,9 @@ static void xhci_xfer_report(XHCITransfer *xfer)
             break;
         }
 
-        /*
-         * XHCI 1.1, 4.11.3.1 Transfer Event TRB -- "each Transfer TRB
-         * encountered with its IOC flag set to '1' shall generate a Transfer
-         * Event."
-         *
-         * Otherwise, longer transfers can have multiple data TRBs (for scatter
-         * gather). Short transfers and errors should be reported once per
-         * transfer only.
-         */
-        if ((trb->control & TRB_TR_IOC) ||
-            (!reported && ((shortpkt && (trb->control & TRB_TR_ISP)) ||
-                           (xfer->status != CC_SUCCESS && left == 0)))) {
+        if (!reported && ((trb->control & TRB_TR_IOC) ||
+                          (shortpkt && (trb->control & TRB_TR_ISP)) ||
+                          (xfer->status != CC_SUCCESS && left == 0))) {
             event.slotid = xfer->slotid;
             event.epid = xfer->epid;
             event.length = (trb->status & 0x1ffff) - chunk;
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/2 xhci: fix events for setup trb.

In reply to Gerd Hoffmann

When we find a IOC bit set on a setup trb and therefore queue an event, that should not stop events being generated for following data trbs. So clear the 'reported' flag.

---
 hw/usb/hcd-xhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/usb/hcd-xhci.c +8 -0
index 39aacf7..927dc36 100644
@@ -1793,6 +1793,14 @@ static void xhci_xfer_report(XHCITransfer *xfer)
                 return;
             }
         }
+
+        switch (TRB_TYPE(*trb)) {
+        case TR_SETUP:
+            reported = 0;
+            shortpkt = 0;
+            break;
+        }
+
     }
 }
 
Signature · 1 line
1.8.3.1
Tested-by on the v1 series
#3 lore raw
In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

Hi,

Laszlos fix unfortunaly had unwanted side effects, so we have to take a different approach to fix the issue at hand.

please review,
Gerd

Quoted 8 lines

Gerd Hoffmann (2):
Revert "xhci: generate a Transfer Event for each Transfer TRB with the
IOC bit set"
xhci: fix events for setup trb.

 hw/usb/hcd-xhci.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)