mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 14:32:23 +00:00
usbip: Add USB_SPEED_SUPER_PLUS as valid arg
Add USB_SPEED_SUPER_PLUS as valid argument to allow to attach USB SuperSpeed+ devices. Update speed of virtual HC to SuperSpeed+ as well. Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://lore.kernel.org/r/20240715131131.3876380-1-ukaszb@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ac7c73c4df
commit
bb548c1654
@ -372,7 +372,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
}
|
}
|
||||||
switch (wValue) {
|
switch (wValue) {
|
||||||
case USB_PORT_FEAT_SUSPEND:
|
case USB_PORT_FEAT_SUSPEND:
|
||||||
if (hcd->speed == HCD_USB3) {
|
if (hcd->speed >= HCD_USB3) {
|
||||||
pr_err(" ClearPortFeature: USB_PORT_FEAT_SUSPEND req not "
|
pr_err(" ClearPortFeature: USB_PORT_FEAT_SUSPEND req not "
|
||||||
"supported for USB 3.0 roothub\n");
|
"supported for USB 3.0 roothub\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -388,7 +388,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
case USB_PORT_FEAT_POWER:
|
case USB_PORT_FEAT_POWER:
|
||||||
usbip_dbg_vhci_rh(
|
usbip_dbg_vhci_rh(
|
||||||
" ClearPortFeature: USB_PORT_FEAT_POWER\n");
|
" ClearPortFeature: USB_PORT_FEAT_POWER\n");
|
||||||
if (hcd->speed == HCD_USB3)
|
if (hcd->speed >= HCD_USB3)
|
||||||
vhci_hcd->port_status[rhport] &= ~USB_SS_PORT_STAT_POWER;
|
vhci_hcd->port_status[rhport] &= ~USB_SS_PORT_STAT_POWER;
|
||||||
else
|
else
|
||||||
vhci_hcd->port_status[rhport] &= ~USB_PORT_STAT_POWER;
|
vhci_hcd->port_status[rhport] &= ~USB_PORT_STAT_POWER;
|
||||||
@ -404,19 +404,19 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
break;
|
break;
|
||||||
case GetHubDescriptor:
|
case GetHubDescriptor:
|
||||||
usbip_dbg_vhci_rh(" GetHubDescriptor\n");
|
usbip_dbg_vhci_rh(" GetHubDescriptor\n");
|
||||||
if (hcd->speed == HCD_USB3 &&
|
if (hcd->speed >= HCD_USB3 &&
|
||||||
(wLength < USB_DT_SS_HUB_SIZE ||
|
(wLength < USB_DT_SS_HUB_SIZE ||
|
||||||
wValue != (USB_DT_SS_HUB << 8))) {
|
wValue != (USB_DT_SS_HUB << 8))) {
|
||||||
pr_err("Wrong hub descriptor type for USB 3.0 roothub.\n");
|
pr_err("Wrong hub descriptor type for USB 3.0 roothub.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (hcd->speed == HCD_USB3)
|
if (hcd->speed >= HCD_USB3)
|
||||||
ss_hub_descriptor((struct usb_hub_descriptor *) buf);
|
ss_hub_descriptor((struct usb_hub_descriptor *) buf);
|
||||||
else
|
else
|
||||||
hub_descriptor((struct usb_hub_descriptor *) buf);
|
hub_descriptor((struct usb_hub_descriptor *) buf);
|
||||||
break;
|
break;
|
||||||
case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
|
case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
|
||||||
if (hcd->speed != HCD_USB3)
|
if (hcd->speed < HCD_USB3)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if ((wValue >> 8) != USB_DT_BOS)
|
if ((wValue >> 8) != USB_DT_BOS)
|
||||||
@ -503,7 +503,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
case USB_PORT_FEAT_LINK_STATE:
|
case USB_PORT_FEAT_LINK_STATE:
|
||||||
usbip_dbg_vhci_rh(
|
usbip_dbg_vhci_rh(
|
||||||
" SetPortFeature: USB_PORT_FEAT_LINK_STATE\n");
|
" SetPortFeature: USB_PORT_FEAT_LINK_STATE\n");
|
||||||
if (hcd->speed != HCD_USB3) {
|
if (hcd->speed < HCD_USB3) {
|
||||||
pr_err("USB_PORT_FEAT_LINK_STATE req not "
|
pr_err("USB_PORT_FEAT_LINK_STATE req not "
|
||||||
"supported for USB 2.0 roothub\n");
|
"supported for USB 2.0 roothub\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -521,7 +521,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
usbip_dbg_vhci_rh(
|
usbip_dbg_vhci_rh(
|
||||||
" SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n");
|
" SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n");
|
||||||
/* TODO: add suspend/resume support! */
|
/* TODO: add suspend/resume support! */
|
||||||
if (hcd->speed != HCD_USB3) {
|
if (hcd->speed < HCD_USB3) {
|
||||||
pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not "
|
pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not "
|
||||||
"supported for USB 2.0 roothub\n");
|
"supported for USB 2.0 roothub\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -531,7 +531,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
usbip_dbg_vhci_rh(
|
usbip_dbg_vhci_rh(
|
||||||
" SetPortFeature: USB_PORT_FEAT_SUSPEND\n");
|
" SetPortFeature: USB_PORT_FEAT_SUSPEND\n");
|
||||||
/* Applicable only for USB2.0 hub */
|
/* Applicable only for USB2.0 hub */
|
||||||
if (hcd->speed == HCD_USB3) {
|
if (hcd->speed >= HCD_USB3) {
|
||||||
pr_err("USB_PORT_FEAT_SUSPEND req not "
|
pr_err("USB_PORT_FEAT_SUSPEND req not "
|
||||||
"supported for USB 3.0 roothub\n");
|
"supported for USB 3.0 roothub\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -551,7 +551,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
pr_err("invalid port number %d\n", wIndex);
|
pr_err("invalid port number %d\n", wIndex);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (hcd->speed == HCD_USB3)
|
if (hcd->speed >= HCD_USB3)
|
||||||
vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER;
|
vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER;
|
||||||
else
|
else
|
||||||
vhci_hcd->port_status[rhport] |= USB_PORT_STAT_POWER;
|
vhci_hcd->port_status[rhport] |= USB_PORT_STAT_POWER;
|
||||||
@ -564,7 +564,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* Applicable only for USB3.0 hub */
|
/* Applicable only for USB3.0 hub */
|
||||||
if (hcd->speed != HCD_USB3) {
|
if (hcd->speed < HCD_USB3) {
|
||||||
pr_err("USB_PORT_FEAT_BH_PORT_RESET req not "
|
pr_err("USB_PORT_FEAT_BH_PORT_RESET req not "
|
||||||
"supported for USB 2.0 roothub\n");
|
"supported for USB 2.0 roothub\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -578,7 +578,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
/* if it's already enabled, disable */
|
/* if it's already enabled, disable */
|
||||||
if (hcd->speed == HCD_USB3) {
|
if (hcd->speed >= HCD_USB3) {
|
||||||
vhci_hcd->port_status[rhport] = 0;
|
vhci_hcd->port_status[rhport] = 0;
|
||||||
vhci_hcd->port_status[rhport] =
|
vhci_hcd->port_status[rhport] =
|
||||||
(USB_SS_PORT_STAT_POWER |
|
(USB_SS_PORT_STAT_POWER |
|
||||||
@ -602,7 +602,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
}
|
}
|
||||||
if (wValue >= 32)
|
if (wValue >= 32)
|
||||||
goto error;
|
goto error;
|
||||||
if (hcd->speed == HCD_USB3) {
|
if (hcd->speed >= HCD_USB3) {
|
||||||
if ((vhci_hcd->port_status[rhport] &
|
if ((vhci_hcd->port_status[rhport] &
|
||||||
USB_SS_PORT_STAT_POWER) != 0) {
|
USB_SS_PORT_STAT_POWER) != 0) {
|
||||||
vhci_hcd->port_status[rhport] |= (1 << wValue);
|
vhci_hcd->port_status[rhport] |= (1 << wValue);
|
||||||
@ -616,7 +616,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
break;
|
break;
|
||||||
case GetPortErrorCount:
|
case GetPortErrorCount:
|
||||||
usbip_dbg_vhci_rh(" GetPortErrorCount\n");
|
usbip_dbg_vhci_rh(" GetPortErrorCount\n");
|
||||||
if (hcd->speed != HCD_USB3) {
|
if (hcd->speed < HCD_USB3) {
|
||||||
pr_err("GetPortErrorCount req not "
|
pr_err("GetPortErrorCount req not "
|
||||||
"supported for USB 2.0 roothub\n");
|
"supported for USB 2.0 roothub\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -626,7 +626,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
break;
|
break;
|
||||||
case SetHubDepth:
|
case SetHubDepth:
|
||||||
usbip_dbg_vhci_rh(" SetHubDepth\n");
|
usbip_dbg_vhci_rh(" SetHubDepth\n");
|
||||||
if (hcd->speed != HCD_USB3) {
|
if (hcd->speed < HCD_USB3) {
|
||||||
pr_err("SetHubDepth req not supported for "
|
pr_err("SetHubDepth req not supported for "
|
||||||
"USB 2.0 roothub\n");
|
"USB 2.0 roothub\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -646,7 +646,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
|||||||
if (!invalid_rhport) {
|
if (!invalid_rhport) {
|
||||||
dump_port_status_diff(prev_port_status[rhport],
|
dump_port_status_diff(prev_port_status[rhport],
|
||||||
vhci_hcd->port_status[rhport],
|
vhci_hcd->port_status[rhport],
|
||||||
hcd->speed == HCD_USB3);
|
hcd->speed >= HCD_USB3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
usbip_dbg_vhci_rh(" bye\n");
|
usbip_dbg_vhci_rh(" bye\n");
|
||||||
@ -1154,8 +1154,8 @@ static int vhci_setup(struct usb_hcd *hcd)
|
|||||||
} else {
|
} else {
|
||||||
vhci->vhci_hcd_ss = hcd_to_vhci_hcd(hcd);
|
vhci->vhci_hcd_ss = hcd_to_vhci_hcd(hcd);
|
||||||
vhci->vhci_hcd_ss->vhci = vhci;
|
vhci->vhci_hcd_ss->vhci = vhci;
|
||||||
hcd->speed = HCD_USB3;
|
hcd->speed = HCD_USB31;
|
||||||
hcd->self.root_hub->speed = USB_SPEED_SUPER;
|
hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1316,7 +1316,7 @@ static const struct hc_driver vhci_hc_driver = {
|
|||||||
.product_desc = driver_desc,
|
.product_desc = driver_desc,
|
||||||
.hcd_priv_size = sizeof(struct vhci_hcd),
|
.hcd_priv_size = sizeof(struct vhci_hcd),
|
||||||
|
|
||||||
.flags = HCD_USB3 | HCD_SHARED,
|
.flags = HCD_USB31 | HCD_SHARED,
|
||||||
|
|
||||||
.reset = vhci_setup,
|
.reset = vhci_setup,
|
||||||
.start = vhci_start,
|
.start = vhci_start,
|
||||||
|
@ -283,6 +283,7 @@ static int valid_args(__u32 *pdev_nr, __u32 *rhport,
|
|||||||
case USB_SPEED_HIGH:
|
case USB_SPEED_HIGH:
|
||||||
case USB_SPEED_WIRELESS:
|
case USB_SPEED_WIRELESS:
|
||||||
case USB_SPEED_SUPER:
|
case USB_SPEED_SUPER:
|
||||||
|
case USB_SPEED_SUPER_PLUS:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr_err("Failed attach request for unsupported USB speed: %s\n",
|
pr_err("Failed attach request for unsupported USB speed: %s\n",
|
||||||
@ -349,7 +350,7 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr,
|
|||||||
vhci_hcd = hcd_to_vhci_hcd(hcd);
|
vhci_hcd = hcd_to_vhci_hcd(hcd);
|
||||||
vhci = vhci_hcd->vhci;
|
vhci = vhci_hcd->vhci;
|
||||||
|
|
||||||
if (speed == USB_SPEED_SUPER)
|
if (speed >= USB_SPEED_SUPER)
|
||||||
vdev = &vhci->vhci_hcd_ss->vdev[rhport];
|
vdev = &vhci->vhci_hcd_ss->vdev[rhport];
|
||||||
else
|
else
|
||||||
vdev = &vhci->vhci_hcd_hs->vdev[rhport];
|
vdev = &vhci->vhci_hcd_hs->vdev[rhport];
|
||||||
|
Loading…
Reference in New Issue
Block a user