mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 13:08:42 +00:00
DM USB: xHCI: add port sharing feature
add support for xHCI port sharing feature, which enable the ability to assign different native ports to different multi-UOSes. For example: 1-2,1-2 assigned to UOS-1. 1-1,2-1 assigned to UOS-2. Change-Id: I899070f7a8a6eb23179e41e7b1f1da24c52482b2 Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com> Reviewed-by: Shuo Liu <shuo.a.liu@intel.com> Reviewed-by: Yu Wang <yu1.wang@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
8aef2cb34b
commit
048b2c76a3
@ -256,6 +256,7 @@ struct pci_xhci_vdev {
|
|||||||
|
|
||||||
int usb2_port_start;
|
int usb2_port_start;
|
||||||
int usb3_port_start;
|
int usb3_port_start;
|
||||||
|
uint8_t *native_assign_ports[USB_NATIVE_NUM_BUS];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* portregs and devices arrays are set up to start from idx=1 */
|
/* portregs and devices arrays are set up to start from idx=1 */
|
||||||
@ -369,6 +370,26 @@ pci_xhci_native_usb_dev_conn_cb(void *hci_data, void *dev_data)
|
|||||||
UPRINTF(LDBG, "%X:%X %d-%d connecting.\r\n",
|
UPRINTF(LDBG, "%X:%X %d-%d connecting.\r\n",
|
||||||
native_vid, native_pid, native_bus, native_port);
|
native_vid, native_pid, native_bus, native_port);
|
||||||
|
|
||||||
|
/* FIXME: will support usb3 in future */
|
||||||
|
if (xdev->native_assign_ports[native_bus] &&
|
||||||
|
usb_native_is_ss_port(native_bus)) {
|
||||||
|
UPRINTF(LDBG, "%X:%X %d-%d not support usb3 device, exit.\r\n",
|
||||||
|
native_vid, native_pid, native_bus,
|
||||||
|
native_port);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!xdev->native_assign_ports[native_bus] ||
|
||||||
|
!xdev->native_assign_ports[native_bus][native_port]) {
|
||||||
|
UPRINTF(LDBG, "%X:%X %d-%d doesn't belong to this vm, bye.\r\n",
|
||||||
|
native_vid, native_pid, native_bus,
|
||||||
|
native_port);
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
|
||||||
|
UPRINTF(LDBG, "%X:%X %d-%d belong to this vm.\r\n", native_vid,
|
||||||
|
native_pid, native_bus, native_port);
|
||||||
|
|
||||||
if (ue->ue_usbver == 2)
|
if (ue->ue_usbver == 2)
|
||||||
port_start = xdev->usb2_port_start;
|
port_start = xdev->usb2_port_start;
|
||||||
else
|
else
|
||||||
|
@ -199,6 +199,8 @@ enum USB_ERRCODE {
|
|||||||
#define NATIVE_USBSYS_DEVDIR "/sys/bus/usb/devices"
|
#define NATIVE_USBSYS_DEVDIR "/sys/bus/usb/devices"
|
||||||
#define NATIVE_USB2_SPEED "480"
|
#define NATIVE_USB2_SPEED "480"
|
||||||
#define NATIVE_USB3_SPEED "5000"
|
#define NATIVE_USB3_SPEED "5000"
|
||||||
|
#define USB_NATIVE_NUM_PORT 255
|
||||||
|
#define USB_NATIVE_NUM_BUS 255
|
||||||
|
|
||||||
extern int usb_log_level;
|
extern int usb_log_level;
|
||||||
inline int usb_get_log_level(void) { return usb_log_level; }
|
inline int usb_get_log_level(void) { return usb_log_level; }
|
||||||
|
Loading…
Reference in New Issue
Block a user