From 2a37eb9a6a0c02622ee17c17b6de14362999737d Mon Sep 17 00:00:00 2001 From: Nikunj A Dadhania Date: Fri, 18 Sep 2015 14:16:57 +0530 Subject: [PATCH] usb-xhci: add delay in shutdown path 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 Signed-off-by: Alexey Kardashevskiy --- 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; }