[SLOF] [PATCH v2 3/8] usb-xhci: add delay in shutdown path

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Fri Sep 18 18:46:57 AEST 2015


QEMU implementation of XHCI doesn't implement halt properly. There might
be ongoing activities and active DMAs, introduce 50ms delay during
shutdown path.

Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
---
 lib/libusb/usb-xhci.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/libusb/usb-xhci.c b/lib/libusb/usb-xhci.c
index aa8a066..c4ee387 100644
--- a/lib/libusb/usb-xhci.c
+++ b/lib/libusb/usb-xhci.c
@@ -870,6 +870,18 @@ static bool xhci_hcd_exit(struct xhci_hcd *xhcd)
 		SLOF_dma_map_out(xhcd->dcbaap_dma, (void *)xhcd->dcbaap, XHCI_DCBAAP_MAX_SIZE);
 		SLOF_dma_free((void *)xhcd->dcbaap, XHCI_DCBAAP_MAX_SIZE);
 	}
+
+	/*
+	 * QEMU implementation of XHCI doesn't implement halt
+	 * properly. It basically says that it's halted immediately
+	 * but doesn't actually terminate ongoing activities and
+	 * DMAs. This needs to be fixed in QEMU.
+	 *
+	 * For now, wait for 50ms grace time till qemu stops using
+	 * this device.
+	 */
+	SLOF_msleep(50);
+
 	return true;
 }
 
-- 
2.4.3



More information about the SLOF mailing list