mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-07 09:41:30 +00:00
The xHCI emulation greatly depends on the user space library libusb which is based on the usbfs module in Linux kernel. The libusb will bind usbfs to physical USB device which makes hardware control over libusb in user space possible. The pci_xhci_dev_create is called in pci_xhci_native_usb_dev_conn_cb which is a callback function triggered by physical USB device plugging. This function will bind the physical USB device to usbfs in SOS, which we depend to create the communication between UOS xHCI driver with physical USB device. This design will fail if the reconnection happened in the SOS, which will bind class driver to the physical USB device instead of usbfs, hence the libusb device handle in DM is invalid. Currently, the native S3 will disable the vbus for all xHCI ports and re-drive during S3 resume. This behavior cause native USB driver unbind the usbfs and bind to related class driver, then made the DM lost control and failed to continue emulation. To fix this issue, place the pci_xhci_dev_create in the function pci_xhci_cmd_enable_slot. According to the xHCI spec 4.5.3 Figure 10, the UOS always send Enable Slot command when a device is attached or recovered from errors (by Disable Slot command). So every time the SOS can't resuming normally or some unexpected disconnection happens, this desigen will always survive by Disable Slot and Enable Slot command series from UOS xHCI driver. Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Reviewed-by: Liang Yang <liang3.yang@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>