mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
DM USB: xHCI: workaround for libusb timing issue
On some platforms, the VBus will drop after suspending is done, hence a disconnect and re-connect for device connected before suspending will be triggered in DM. But during the stress test, when the free memory is limited to very low level, and put huge workload to SOS, under certain possibility, the DM will receive re-connect event first and disconnect event later, this behavior will result of failing to emulate USB device to UOS. The reason is due to a timing issue from libusb. Before we could upstream fixing patch to libusb or find some other better solution, this workaround patch will be used to avoid errors happen. Tracked-On: #2823 Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
parent
66dabd1260
commit
7c79f50752
@ -958,21 +958,6 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data)
|
||||
state = xdev->native_ports[index].state;
|
||||
vport = xdev->native_ports[index].vport;
|
||||
|
||||
if (state == VPORT_CONNECTED && vport > 0) {
|
||||
/*
|
||||
* When this place is reached, it means the physical
|
||||
* USB device is disconnected before the emulation
|
||||
* procedure is started. The related states should be
|
||||
* cleared for future connecting.
|
||||
*/
|
||||
UPRINTF(LFTL, "disconnect VPORT_CONNECTED device: "
|
||||
"%d-%s vport %d\r\n", di->path.bus,
|
||||
usb_dev_path(&di->path), vport);
|
||||
pci_xhci_disconnect_port(xdev, vport, 0);
|
||||
xdev->native_ports[index].state = VPORT_ASSIGNED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
edev = xdev->devices[vport];
|
||||
for (slot = 1; slot < XHCI_MAX_SLOTS; ++slot)
|
||||
if (xdev->slots[slot] == edev)
|
||||
@ -996,6 +981,21 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data)
|
||||
}
|
||||
}
|
||||
|
||||
if (state == VPORT_CONNECTED && vport > 0) {
|
||||
/*
|
||||
* When this place is reached, it means the physical
|
||||
* USB device is disconnected before the emulation
|
||||
* procedure is started. The related states should be
|
||||
* cleared for future connecting.
|
||||
*/
|
||||
UPRINTF(LFTL, "disconnect VPORT_CONNECTED device: "
|
||||
"%d-%s vport %d\r\n", di->path.bus,
|
||||
usb_dev_path(&di->path), vport);
|
||||
pci_xhci_disconnect_port(xdev, vport, 0);
|
||||
xdev->native_ports[index].state = VPORT_ASSIGNED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(state == VPORT_EMULATED || state == VPORT_CONNECTED);
|
||||
xdev->native_ports[index].state = VPORT_ASSIGNED;
|
||||
xdev->native_ports[index].vport = 0;
|
||||
|
@ -597,7 +597,7 @@ usb_dev_native_toggle_if_drivers(struct usb_dev *udev, int attach)
|
||||
return -1;
|
||||
}
|
||||
|
||||
UPRINTF(LDBG, "%s driver\r\n", attach == 1 ? "attach" : "detach");
|
||||
UPRINTF(LINF, "%s driver\r\n", attach == 1 ? "attach" : "detach");
|
||||
|
||||
c = config->bConfigurationValue;
|
||||
for (i = 0; i < config->bNumInterfaces; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user