qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] xhci fixes
@ 2013-01-08 13:16 Gerd Hoffmann
  2013-01-08 13:16 ` [Qemu-devel] [PATCH 1/3] xhci: create xhci_detach_slot helper function Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2013-01-08 13:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Little patch series which makes sure xhci cancels inflight transfers
on device detach.

cheers,
  Gerd

Gerd Hoffmann (3):
  xhci: create xhci_detach_slot helper function
  xhci: call xhci_detach_slot on root port detach too
  xhci: nuke transfe5rs on detach

 hw/usb/hcd-xhci.c |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 1/3] xhci: create xhci_detach_slot helper function
  2013-01-08 13:16 [Qemu-devel] [PATCH 0/3] xhci fixes Gerd Hoffmann
@ 2013-01-08 13:16 ` Gerd Hoffmann
  2013-01-08 13:16 ` [Qemu-devel] [PATCH 2/3] xhci: call xhci_detach_slot on root port detach too Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2013-01-08 13:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-xhci.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 9132920..5d4d876 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2198,6 +2198,23 @@ static unsigned int xhci_get_slot(XHCIState *xhci, XHCIEvent *event, XHCITRB *tr
     return slotid;
 }
 
+/* cleanup slot state on usb device detach */
+static void xhci_detach_slot(XHCIState *xhci, USBPort *uport)
+{
+    int slot;
+
+    for (slot = 0; slot < xhci->numslots; slot++) {
+        if (xhci->slots[slot].uport == uport) {
+            break;
+        }
+    }
+    if (slot == xhci->numslots) {
+        return;
+    }
+
+    xhci->slots[slot].uport = NULL;
+}
+
 static TRBCCode xhci_get_port_bandwidth(XHCIState *xhci, uint64_t pctx)
 {
     dma_addr_t ctx;
@@ -2971,13 +2988,8 @@ static void xhci_child_detach(USBPort *uport, USBDevice *child)
 {
     USBBus *bus = usb_bus_from_device(child);
     XHCIState *xhci = container_of(bus, XHCIState, bus);
-    int i;
 
-    for (i = 0; i < xhci->numslots; i++) {
-        if (xhci->slots[i].uport == uport) {
-            xhci->slots[i].uport = NULL;
-        }
-    }
+    xhci_detach_slot(xhci, uport);
 }
 
 static USBPortOps xhci_uport_ops = {
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/3] xhci: call xhci_detach_slot on root port detach too
  2013-01-08 13:16 [Qemu-devel] [PATCH 0/3] xhci fixes Gerd Hoffmann
  2013-01-08 13:16 ` [Qemu-devel] [PATCH 1/3] xhci: create xhci_detach_slot helper function Gerd Hoffmann
@ 2013-01-08 13:16 ` Gerd Hoffmann
  2013-01-08 13:16 ` [Qemu-devel] [PATCH 3/3] xhci: nuke transfe5rs on detach Gerd Hoffmann
  2013-01-09 14:01 ` [Qemu-devel] [PATCH 0/3] xhci fixes Hans de Goede
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2013-01-08 13:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-xhci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 5d4d876..b4736f5 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2957,6 +2957,7 @@ static void xhci_detach(USBPort *usbport)
     XHCIState *xhci = usbport->opaque;
     XHCIPort *port = xhci_lookup_port(xhci, usbport);
 
+    xhci_detach_slot(xhci, usbport);
     xhci_port_update(port, 1);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 3/3] xhci: nuke transfe5rs on detach
  2013-01-08 13:16 [Qemu-devel] [PATCH 0/3] xhci fixes Gerd Hoffmann
  2013-01-08 13:16 ` [Qemu-devel] [PATCH 1/3] xhci: create xhci_detach_slot helper function Gerd Hoffmann
  2013-01-08 13:16 ` [Qemu-devel] [PATCH 2/3] xhci: call xhci_detach_slot on root port detach too Gerd Hoffmann
@ 2013-01-08 13:16 ` Gerd Hoffmann
  2013-01-09 14:01 ` [Qemu-devel] [PATCH 0/3] xhci fixes Hans de Goede
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2013-01-08 13:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-xhci.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index b4736f5..f8f5aeb 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1197,6 +1197,7 @@ static int xhci_ep_nuke_xfers(XHCIState *xhci, unsigned int slotid,
             ep = epctx->transfers[xferi].packet.ep;
         }
         killed += xhci_ep_nuke_one_xfer(&epctx->transfers[xferi]);
+        epctx->transfers[xferi].packet.ep = NULL;
         xferi = (xferi + 1) % TD_QUEUE;
     }
     if (ep) {
@@ -2201,7 +2202,7 @@ static unsigned int xhci_get_slot(XHCIState *xhci, XHCIEvent *event, XHCITRB *tr
 /* cleanup slot state on usb device detach */
 static void xhci_detach_slot(XHCIState *xhci, USBPort *uport)
 {
-    int slot;
+    int slot, ep;
 
     for (slot = 0; slot < xhci->numslots; slot++) {
         if (xhci->slots[slot].uport == uport) {
@@ -2212,6 +2213,11 @@ static void xhci_detach_slot(XHCIState *xhci, USBPort *uport)
         return;
     }
 
+    for (ep = 0; ep < 31; ep++) {
+        if (xhci->slots[slot].eps[ep]) {
+            xhci_ep_nuke_xfers(xhci, slot+1, ep+1);
+        }
+    }
     xhci->slots[slot].uport = NULL;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 0/3] xhci fixes
  2013-01-08 13:16 [Qemu-devel] [PATCH 0/3] xhci fixes Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2013-01-08 13:16 ` [Qemu-devel] [PATCH 3/3] xhci: nuke transfe5rs on detach Gerd Hoffmann
@ 2013-01-09 14:01 ` Hans de Goede
  3 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2013-01-09 14:01 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

Hi,

Other then the typo in the commit messages for the 3th patch,
this sets looks good. ACK series.

Regards,

Hans


On 01/08/2013 02:16 PM, Gerd Hoffmann wrote:
>    Hi,
>
> Little patch series which makes sure xhci cancels inflight transfers
> on device detach.
>
> cheers,
>    Gerd
>
> Gerd Hoffmann (3):
>    xhci: create xhci_detach_slot helper function
>    xhci: call xhci_detach_slot on root port detach too
>    xhci: nuke transfe5rs on detach
>
>   hw/usb/hcd-xhci.c |   31 +++++++++++++++++++++++++------
>   1 files changed, 25 insertions(+), 6 deletions(-)
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-09 13:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08 13:16 [Qemu-devel] [PATCH 0/3] xhci fixes Gerd Hoffmann
2013-01-08 13:16 ` [Qemu-devel] [PATCH 1/3] xhci: create xhci_detach_slot helper function Gerd Hoffmann
2013-01-08 13:16 ` [Qemu-devel] [PATCH 2/3] xhci: call xhci_detach_slot on root port detach too Gerd Hoffmann
2013-01-08 13:16 ` [Qemu-devel] [PATCH 3/3] xhci: nuke transfe5rs on detach Gerd Hoffmann
2013-01-09 14:01 ` [Qemu-devel] [PATCH 0/3] xhci fixes Hans de Goede

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).