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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'usb-4.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB driver fixes from Greg KH:
"Here are some small USB fixes for 4.6-rc4.

Mostly xhci fixes for reported issues, a UAS bug that has hit a number
of people, including stable tree users, and a few other minor things.

All have been in linux-next for a while with no reported issues"

* tag 'usb-4.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: hcd: out of bounds access in for_each_companion
USB: uas: Add a new NO_REPORT_LUNS quirk
USB: uas: Limit qdepth at the scsi-host level
doc: usb: Fix typo in gadget_multi documentation
usb: host: xhci-plat: Make enum xhci_plat_type start at a non zero value
xhci: fix 10 second timeout on removal of PCI hotpluggable xhci controllers
usb: xhci: fix wild pointers in xhci_mem_cleanup
usb: host: xhci-plat: fix cannot work if R-Car Gen2/3 run on above 4GB phys
usb: host: xhci: add a new quirk XHCI_NO_64BIT_SUPPORT
xhci: resume USB 3 roothub first
usb: xhci: applying XHCI_PME_STUCK_QUIRK to Intel BXT B0 host
cdc-acm: fix crash if flushed with nothing buffered

+94 -13
+2
Documentation/kernel-parameters.txt
··· 4077 4077 sector if the number is odd); 4078 4078 i = IGNORE_DEVICE (don't bind to this 4079 4079 device); 4080 + j = NO_REPORT_LUNS (don't use report luns 4081 + command, uas only); 4080 4082 l = NOT_LOCKABLE (don't try to lock and 4081 4083 unlock ejectable media); 4082 4084 m = MAX_SECTORS_64 (don't transfer more
+1 -1
Documentation/usb/gadget_multi.txt
··· 43 43 First of all, Windows need to detect the gadget as an USB composite 44 44 gadget which on its own have some conditions[4]. If they are met, 45 45 Windows lets USB Generic Parent Driver[5] handle the device which then 46 - tries to much drivers for each individual interface (sort of, don't 46 + tries to match drivers for each individual interface (sort of, don't 47 47 get into too many details). 48 48 49 49 The good news is: you do not have to worry about most of the
+4
drivers/usb/class/cdc-acm.c
··· 744 744 int err; 745 745 unsigned long flags; 746 746 747 + if (!cur) /* nothing to do */ 748 + return; 749 + 747 750 acm->putbuffer = NULL; 748 751 err = usb_autopm_get_interface_async(acm->control); 749 752 spin_lock_irqsave(&acm->write_lock, flags); 750 753 if (err < 0) { 751 754 cur->use = 0; 755 + acm->putbuffer = cur; 752 756 goto out; 753 757 } 754 758
+9
drivers/usb/core/hcd-pci.c
··· 73 73 if (companion->bus != pdev->bus || 74 74 PCI_SLOT(companion->devfn) != slot) 75 75 continue; 76 + 77 + /* 78 + * Companion device should be either UHCI,OHCI or EHCI host 79 + * controller, otherwise skip. 80 + */ 81 + if (companion->class != CL_UHCI && companion->class != CL_OHCI && 82 + companion->class != CL_EHCI) 83 + continue; 84 + 76 85 companion_hcd = pci_get_drvdata(companion); 77 86 if (!companion_hcd || !companion_hcd->self.root_hub) 78 87 continue;
+6
drivers/usb/host/xhci-mem.c
··· 1861 1861 kfree(xhci->rh_bw); 1862 1862 kfree(xhci->ext_caps); 1863 1863 1864 + xhci->usb2_ports = NULL; 1865 + xhci->usb3_ports = NULL; 1866 + xhci->port_array = NULL; 1867 + xhci->rh_bw = NULL; 1868 + xhci->ext_caps = NULL; 1869 + 1864 1870 xhci->page_size = 0; 1865 1871 xhci->page_shift = 0; 1866 1872 xhci->bus_state[0].bus_suspended = 0;
+4 -1
drivers/usb/host/xhci-pci.c
··· 48 48 #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f 49 49 #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2f 50 50 #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI 0x0aa8 51 + #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI 0x1aa8 51 52 52 53 static const char hcd_name[] = "xhci_hcd"; 53 54 ··· 156 155 (pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || 157 156 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || 158 157 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || 159 - pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI)) { 158 + pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI || 159 + pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) { 160 160 xhci->quirks |= XHCI_PME_STUCK_QUIRK; 161 161 } 162 162 if (pdev->vendor == PCI_VENDOR_ID_INTEL && ··· 304 302 struct xhci_hcd *xhci; 305 303 306 304 xhci = hcd_to_xhci(pci_get_drvdata(dev)); 305 + xhci->xhc_state |= XHCI_STATE_REMOVING; 307 306 if (xhci->shared_hcd) { 308 307 usb_remove_hcd(xhci->shared_hcd); 309 308 usb_put_hcd(xhci->shared_hcd);
+13
drivers/usb/host/xhci-plat.c
··· 39 39 40 40 static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) 41 41 { 42 + struct usb_hcd *hcd = xhci_to_hcd(xhci); 43 + 42 44 /* 43 45 * As of now platform drivers don't provide MSI support so we ensure 44 46 * here that the generic code does not try to make a pci_dev from our 45 47 * dev struct in order to setup MSI 46 48 */ 47 49 xhci->quirks |= XHCI_PLAT; 50 + 51 + /* 52 + * On R-Car Gen2 and Gen3, the AC64 bit (bit 0) of HCCPARAMS1 is set 53 + * to 1. However, these SoCs don't support 64-bit address memory 54 + * pointers. So, this driver clears the AC64 bit of xhci->hcc_params 55 + * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in 56 + * xhci_gen_setup(). 57 + */ 58 + if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) || 59 + xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) 60 + xhci->quirks |= XHCI_NO_64BIT_SUPPORT; 48 61 } 49 62 50 63 /* called during probe() after chip reset completes */
+1 -1
drivers/usb/host/xhci-plat.h
··· 14 14 #include "xhci.h" /* for hcd_to_xhci() */ 15 15 16 16 enum xhci_plat_type { 17 - XHCI_PLAT_TYPE_MARVELL_ARMADA, 17 + XHCI_PLAT_TYPE_MARVELL_ARMADA = 1, 18 18 XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2, 19 19 XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3, 20 20 };
+2 -1
drivers/usb/host/xhci-ring.c
··· 4004 4004 int reserved_trbs = xhci->cmd_ring_reserved_trbs; 4005 4005 int ret; 4006 4006 4007 - if (xhci->xhc_state) { 4007 + if ((xhci->xhc_state & XHCI_STATE_DYING) || 4008 + (xhci->xhc_state & XHCI_STATE_HALTED)) { 4008 4009 xhci_dbg(xhci, "xHCI dying or halted, can't queue_command\n"); 4009 4010 return -ESHUTDOWN; 4010 4011 }
+18 -6
drivers/usb/host/xhci.c
··· 147 147 "waited %u microseconds.\n", 148 148 XHCI_MAX_HALT_USEC); 149 149 if (!ret) 150 - xhci->xhc_state &= ~(XHCI_STATE_HALTED | XHCI_STATE_DYING); 150 + /* clear state flags. Including dying, halted or removing */ 151 + xhci->xhc_state = 0; 151 152 152 153 return ret; 153 154 } ··· 1109 1108 /* Resume root hubs only when have pending events. */ 1110 1109 status = readl(&xhci->op_regs->status); 1111 1110 if (status & STS_EINT) { 1112 - usb_hcd_resume_root_hub(hcd); 1113 1111 usb_hcd_resume_root_hub(xhci->shared_hcd); 1112 + usb_hcd_resume_root_hub(hcd); 1114 1113 } 1115 1114 } 1116 1115 ··· 1125 1124 1126 1125 /* Re-enable port polling. */ 1127 1126 xhci_dbg(xhci, "%s: starting port polling.\n", __func__); 1128 - set_bit(HCD_FLAG_POLL_RH, &hcd->flags); 1129 - usb_hcd_poll_rh_status(hcd); 1130 1127 set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); 1131 1128 usb_hcd_poll_rh_status(xhci->shared_hcd); 1129 + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); 1130 + usb_hcd_poll_rh_status(hcd); 1132 1131 1133 1132 return retval; 1134 1133 } ··· 2774 2773 if (ret <= 0) 2775 2774 return ret; 2776 2775 xhci = hcd_to_xhci(hcd); 2777 - if (xhci->xhc_state & XHCI_STATE_DYING) 2776 + if ((xhci->xhc_state & XHCI_STATE_DYING) || 2777 + (xhci->xhc_state & XHCI_STATE_REMOVING)) 2778 2778 return -ENODEV; 2779 2779 2780 2780 xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); ··· 3822 3820 3823 3821 mutex_lock(&xhci->mutex); 3824 3822 3825 - if (xhci->xhc_state) /* dying or halted */ 3823 + if (xhci->xhc_state) /* dying, removing or halted */ 3826 3824 goto out; 3827 3825 3828 3826 if (!udev->slot_id) { ··· 4949 4947 if (retval) 4950 4948 return retval; 4951 4949 xhci_dbg(xhci, "Reset complete\n"); 4950 + 4951 + /* 4952 + * On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) 4953 + * of HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit 4954 + * address memory pointers actually. So, this driver clears the AC64 4955 + * bit of xhci->hcc_params to call dma_set_coherent_mask(dev, 4956 + * DMA_BIT_MASK(32)) in this xhci_gen_setup(). 4957 + */ 4958 + if (xhci->quirks & XHCI_NO_64BIT_SUPPORT) 4959 + xhci->hcc_params &= ~BIT(0); 4952 4960 4953 4961 /* Set dma_mask and coherent_dma_mask to 64-bits, 4954 4962 * if xHC supports 64-bit addressing */
+2
drivers/usb/host/xhci.h
··· 1605 1605 */ 1606 1606 #define XHCI_STATE_DYING (1 << 0) 1607 1607 #define XHCI_STATE_HALTED (1 << 1) 1608 + #define XHCI_STATE_REMOVING (1 << 2) 1608 1609 /* Statistics */ 1609 1610 int error_bitmask; 1610 1611 unsigned int quirks; ··· 1642 1641 #define XHCI_PME_STUCK_QUIRK (1 << 20) 1643 1642 #define XHCI_MTK_HOST (1 << 21) 1644 1643 #define XHCI_SSIC_PORT_UNUSED (1 << 22) 1644 + #define XHCI_NO_64BIT_SUPPORT (1 << 23) 1645 1645 unsigned int num_active_eps; 1646 1646 unsigned int limit_active_eps; 1647 1647 /* There are two roothubs to keep track of bus suspend info for */
+19 -2
drivers/usb/storage/uas.c
··· 2 2 * USB Attached SCSI 3 3 * Note that this is not the same as the USB Mass Storage driver 4 4 * 5 - * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2014 5 + * Copyright Hans de Goede <hdegoede@redhat.com> for Red Hat, Inc. 2013 - 2016 6 6 * Copyright Matthew Wilcox for Intel Corp, 2010 7 7 * Copyright Sarah Sharp for Intel Corp, 2010 8 8 * ··· 781 781 return SUCCESS; 782 782 } 783 783 784 + static int uas_target_alloc(struct scsi_target *starget) 785 + { 786 + struct uas_dev_info *devinfo = (struct uas_dev_info *) 787 + dev_to_shost(starget->dev.parent)->hostdata; 788 + 789 + if (devinfo->flags & US_FL_NO_REPORT_LUNS) 790 + starget->no_report_luns = 1; 791 + 792 + return 0; 793 + } 794 + 784 795 static int uas_slave_alloc(struct scsi_device *sdev) 785 796 { 786 797 struct uas_dev_info *devinfo = ··· 835 824 if (devinfo->flags & US_FL_BROKEN_FUA) 836 825 sdev->broken_fua = 1; 837 826 838 - scsi_change_queue_depth(sdev, devinfo->qdepth - 2); 839 827 return 0; 840 828 } 841 829 ··· 842 832 .module = THIS_MODULE, 843 833 .name = "uas", 844 834 .queuecommand = uas_queuecommand, 835 + .target_alloc = uas_target_alloc, 845 836 .slave_alloc = uas_slave_alloc, 846 837 .slave_configure = uas_slave_configure, 847 838 .eh_abort_handler = uas_eh_abort_handler, ··· 966 955 result = uas_configure_endpoints(devinfo); 967 956 if (result) 968 957 goto set_alt0; 958 + 959 + /* 960 + * 1 tag is reserved for untagged commands + 961 + * 1 tag to avoid off by one errors in some bridge firmwares 962 + */ 963 + shost->can_queue = devinfo->qdepth - 2; 969 964 970 965 usb_set_intfdata(intf, shost); 971 966 result = scsi_add_host(shost, &intf->dev);
+7
drivers/usb/storage/unusual_uas.h
··· 64 64 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 65 65 US_FL_NO_ATA_1X), 66 66 67 + /* Reported-by: David Webb <djw@noc.ac.uk> */ 68 + UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x9999, 69 + "Seagate", 70 + "Expansion Desk", 71 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 72 + US_FL_NO_REPORT_LUNS), 73 + 67 74 /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ 68 75 UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, 69 76 "Seagate",
+4 -1
drivers/usb/storage/usb.c
··· 482 482 US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | 483 483 US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | 484 484 US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | 485 - US_FL_MAX_SECTORS_240); 485 + US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS); 486 486 487 487 p = quirks; 488 488 while (*p) { ··· 531 531 break; 532 532 case 'i': 533 533 f |= US_FL_IGNORE_DEVICE; 534 + break; 535 + case 'j': 536 + f |= US_FL_NO_REPORT_LUNS; 534 537 break; 535 538 case 'l': 536 539 f |= US_FL_NOT_LOCKABLE;
+2
include/linux/usb_usual.h
··· 79 79 /* Cannot handle MI_REPORT_SUPPORTED_OPERATION_CODES */ \ 80 80 US_FLAG(MAX_SECTORS_240, 0x08000000) \ 81 81 /* Sets max_sectors to 240 */ \ 82 + US_FLAG(NO_REPORT_LUNS, 0x10000000) \ 83 + /* Cannot handle REPORT_LUNS */ \ 82 84 83 85 #define US_FLAG(name, value) US_FL_##name = value , 84 86 enum { US_DO_ALL_FLAGS };