Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Łukasz Bartosik and committed by
Greg Kroah-Hartman
bb548c16 ac7c73c4

+20 -19
+18 -18
drivers/usb/usbip/vhci_hcd.c
··· 372 372 } 373 373 switch (wValue) { 374 374 case USB_PORT_FEAT_SUSPEND: 375 - if (hcd->speed == HCD_USB3) { 375 + if (hcd->speed >= HCD_USB3) { 376 376 pr_err(" ClearPortFeature: USB_PORT_FEAT_SUSPEND req not " 377 377 "supported for USB 3.0 roothub\n"); 378 378 goto error; ··· 388 388 case USB_PORT_FEAT_POWER: 389 389 usbip_dbg_vhci_rh( 390 390 " ClearPortFeature: USB_PORT_FEAT_POWER\n"); 391 - if (hcd->speed == HCD_USB3) 391 + if (hcd->speed >= HCD_USB3) 392 392 vhci_hcd->port_status[rhport] &= ~USB_SS_PORT_STAT_POWER; 393 393 else 394 394 vhci_hcd->port_status[rhport] &= ~USB_PORT_STAT_POWER; ··· 404 404 break; 405 405 case GetHubDescriptor: 406 406 usbip_dbg_vhci_rh(" GetHubDescriptor\n"); 407 - if (hcd->speed == HCD_USB3 && 407 + if (hcd->speed >= HCD_USB3 && 408 408 (wLength < USB_DT_SS_HUB_SIZE || 409 409 wValue != (USB_DT_SS_HUB << 8))) { 410 410 pr_err("Wrong hub descriptor type for USB 3.0 roothub.\n"); 411 411 goto error; 412 412 } 413 - if (hcd->speed == HCD_USB3) 413 + if (hcd->speed >= HCD_USB3) 414 414 ss_hub_descriptor((struct usb_hub_descriptor *) buf); 415 415 else 416 416 hub_descriptor((struct usb_hub_descriptor *) buf); 417 417 break; 418 418 case DeviceRequest | USB_REQ_GET_DESCRIPTOR: 419 - if (hcd->speed != HCD_USB3) 419 + if (hcd->speed < HCD_USB3) 420 420 goto error; 421 421 422 422 if ((wValue >> 8) != USB_DT_BOS) ··· 503 503 case USB_PORT_FEAT_LINK_STATE: 504 504 usbip_dbg_vhci_rh( 505 505 " SetPortFeature: USB_PORT_FEAT_LINK_STATE\n"); 506 - if (hcd->speed != HCD_USB3) { 506 + if (hcd->speed < HCD_USB3) { 507 507 pr_err("USB_PORT_FEAT_LINK_STATE req not " 508 508 "supported for USB 2.0 roothub\n"); 509 509 goto error; ··· 521 521 usbip_dbg_vhci_rh( 522 522 " SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n"); 523 523 /* TODO: add suspend/resume support! */ 524 - if (hcd->speed != HCD_USB3) { 524 + if (hcd->speed < HCD_USB3) { 525 525 pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not " 526 526 "supported for USB 2.0 roothub\n"); 527 527 goto error; ··· 531 531 usbip_dbg_vhci_rh( 532 532 " SetPortFeature: USB_PORT_FEAT_SUSPEND\n"); 533 533 /* Applicable only for USB2.0 hub */ 534 - if (hcd->speed == HCD_USB3) { 534 + if (hcd->speed >= HCD_USB3) { 535 535 pr_err("USB_PORT_FEAT_SUSPEND req not " 536 536 "supported for USB 3.0 roothub\n"); 537 537 goto error; ··· 551 551 pr_err("invalid port number %d\n", wIndex); 552 552 goto error; 553 553 } 554 - if (hcd->speed == HCD_USB3) 554 + if (hcd->speed >= HCD_USB3) 555 555 vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER; 556 556 else 557 557 vhci_hcd->port_status[rhport] |= USB_PORT_STAT_POWER; ··· 564 564 goto error; 565 565 } 566 566 /* Applicable only for USB3.0 hub */ 567 - if (hcd->speed != HCD_USB3) { 567 + if (hcd->speed < HCD_USB3) { 568 568 pr_err("USB_PORT_FEAT_BH_PORT_RESET req not " 569 569 "supported for USB 2.0 roothub\n"); 570 570 goto error; ··· 578 578 goto error; 579 579 } 580 580 /* if it's already enabled, disable */ 581 - if (hcd->speed == HCD_USB3) { 581 + if (hcd->speed >= HCD_USB3) { 582 582 vhci_hcd->port_status[rhport] = 0; 583 583 vhci_hcd->port_status[rhport] = 584 584 (USB_SS_PORT_STAT_POWER | ··· 602 602 } 603 603 if (wValue >= 32) 604 604 goto error; 605 - if (hcd->speed == HCD_USB3) { 605 + if (hcd->speed >= HCD_USB3) { 606 606 if ((vhci_hcd->port_status[rhport] & 607 607 USB_SS_PORT_STAT_POWER) != 0) { 608 608 vhci_hcd->port_status[rhport] |= (1 << wValue); ··· 616 616 break; 617 617 case GetPortErrorCount: 618 618 usbip_dbg_vhci_rh(" GetPortErrorCount\n"); 619 - if (hcd->speed != HCD_USB3) { 619 + if (hcd->speed < HCD_USB3) { 620 620 pr_err("GetPortErrorCount req not " 621 621 "supported for USB 2.0 roothub\n"); 622 622 goto error; ··· 626 626 break; 627 627 case SetHubDepth: 628 628 usbip_dbg_vhci_rh(" SetHubDepth\n"); 629 - if (hcd->speed != HCD_USB3) { 629 + if (hcd->speed < HCD_USB3) { 630 630 pr_err("SetHubDepth req not supported for " 631 631 "USB 2.0 roothub\n"); 632 632 goto error; ··· 646 646 if (!invalid_rhport) { 647 647 dump_port_status_diff(prev_port_status[rhport], 648 648 vhci_hcd->port_status[rhport], 649 - hcd->speed == HCD_USB3); 649 + hcd->speed >= HCD_USB3); 650 650 } 651 651 } 652 652 usbip_dbg_vhci_rh(" bye\n"); ··· 1154 1154 } else { 1155 1155 vhci->vhci_hcd_ss = hcd_to_vhci_hcd(hcd); 1156 1156 vhci->vhci_hcd_ss->vhci = vhci; 1157 - hcd->speed = HCD_USB3; 1158 - hcd->self.root_hub->speed = USB_SPEED_SUPER; 1157 + hcd->speed = HCD_USB31; 1158 + hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; 1159 1159 } 1160 1160 1161 1161 /* ··· 1316 1316 .product_desc = driver_desc, 1317 1317 .hcd_priv_size = sizeof(struct vhci_hcd), 1318 1318 1319 - .flags = HCD_USB3 | HCD_SHARED, 1319 + .flags = HCD_USB31 | HCD_SHARED, 1320 1320 1321 1321 .reset = vhci_setup, 1322 1322 .start = vhci_start,
+2 -1
drivers/usb/usbip/vhci_sysfs.c
··· 283 283 case USB_SPEED_HIGH: 284 284 case USB_SPEED_WIRELESS: 285 285 case USB_SPEED_SUPER: 286 + case USB_SPEED_SUPER_PLUS: 286 287 break; 287 288 default: 288 289 pr_err("Failed attach request for unsupported USB speed: %s\n", ··· 350 349 vhci_hcd = hcd_to_vhci_hcd(hcd); 351 350 vhci = vhci_hcd->vhci; 352 351 353 - if (speed == USB_SPEED_SUPER) 352 + if (speed >= USB_SPEED_SUPER) 354 353 vdev = &vhci->vhci_hcd_ss->vdev[rhport]; 355 354 else 356 355 vdev = &vhci->vhci_hcd_hs->vdev[rhport];