1. 24 9月, 2013 5 次提交
    • X
      usbcore: check usb device's state before sending a Set SEL control transfer · 38d7f688
      Xenia Ragiadakou 提交于
      Set SEL control urbs cannot be sent to a device in unconfigured state.
      This patch adds a check in usb_req_set_sel() to ensure the usb device's
      state is USB_STATE_CONFIGURED.
      Signed-off-by: NXenia Ragiadakou <burzalodowa@gmail.com>
      Reported-by: NMartin MOKREJS <mmokrejs@gmail.com>
      Suggested-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      38d7f688
    • F
      xhci: Fix race between ep halt and URB cancellation · 526867c3
      Florian Wolter 提交于
      The halted state of a endpoint cannot be cleared over CLEAR_HALT from a
      user process, because the stopped_td variable was overwritten in the
      handle_stopped_endpoint() function. So the xhci_endpoint_reset() function will
      refuse the reset and communication with device can not run over this endpoint.
      https://bugzilla.kernel.org/show_bug.cgi?id=60699Signed-off-by: NFlorian Wolter <wolly84@web.de>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      526867c3
    • S
      usb: Fix xHCI host issues on remote wakeup. · 8b3d4570
      Sarah Sharp 提交于
      When a device signals remote wakeup on a roothub, and the suspend change
      bit is set, the host controller driver must not give control back to the
      USB core until the port goes back into the active state.
      
      EHCI accomplishes this by waiting in the get port status function until
      the PORT_RESUME bit is cleared:
      
                              /* stop resume signaling */
                              temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME);
                              ehci_writel(ehci, temp, status_reg);
                              clear_bit(wIndex, &ehci->resuming_ports);
                              retval = ehci_handshake(ehci, status_reg,
                                              PORT_RESUME, 0, 2000 /* 2msec */);
      
      Similarly, the xHCI host should wait until the port goes into U0, before
      passing control up to the USB core.  When the port transitions from the
      RExit state to U0, the xHCI driver will get a port status change event.
      We need to wait for that event before passing control up to the USB
      core.
      
      After the port transitions to the active state, the USB core should time
      a recovery interval before it talks to the device.  The length of that
      recovery interval is TRSMRCY, 10 ms, mentioned in the USB 2.0 spec,
      section 7.1.7.7.  The previous xHCI code (which did not wait for the
      port to go into U0) would cause the USB core to violate that recovery
      interval.
      
      This bug caused numerous USB device disconnects on remote wakeup under
      ChromeOS and a Lynx Point LP xHCI host that takes up to 20 ms to move
      from RExit to U0.  ChromeOS is very aggressive about power savings, and
      sets the autosuspend_delay to 100 ms, and disables USB persist.
      
      I attempted to replicate this bug with Ubuntu 12.04, but could not.  I
      used Ubuntu 12.04 on the same platform, with the same BIOS that the bug
      was triggered on ChromeOS with.  I also changed the USB sysfs settings
      as described above, but still could not reproduce the bug under Ubuntu.
      It may be that ChromeOS userspace triggers this bug through additional
      settings.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      8b3d4570
    • M
      xhci: Ensure a command structure points to the correct trb on the command ring · ec7e43e2
      Mathias Nyman 提交于
      If a command on the command ring needs to be cancelled before it is handled
      it can be turned to a no-op operation when the ring is stopped.
      We want to store the command ring enqueue pointer in the command structure
      when the command in enqueued for the cancellation case.
      
      Some commands used to store the command ring dequeue pointers instead of enqueue
      (these often worked because enqueue happends to equal dequeue quite often)
      
      Other commands correctly used the enqueue pointer but did not check if it pointed
      to a valid trb or a link trb, this caused for example stop endpoint command to timeout in
      xhci_stop_device() in about 2% of suspend/resume cases.
      
      This should also solve some weird behavior happening in command cancellation cases.
      
      This patch is based on a patch submitted by Sarah Sharp to linux-usb, but
      then forgotten:
          http://marc.info/?l=linux-usb&m=136269803207465&w=2
      
      This patch should be backported to kernels as old as 3.7, that contain
      the commit b92cc66c "xHCI: add aborting
      command ring function"
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      ec7e43e2
    • M
      xhci: Fix oops happening after address device timeout · 284d2055
      Mathias Nyman 提交于
      When a command times out, the command ring is first aborted,
      and then stopped. If the command ring is empty when it is stopped
      the stop event will point to next command which is not yet set.
      xHCI tries to handle this next event often causing an oops.
      
      Don't handle command completion events on stopped cmd ring if ring is
      empty.
      
      This patch should be backported to kernels as old as 3.7, that contain
      the commit b92cc66c "xHCI: add aborting
      command ring function"
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Reported-by: NGiovanni <giovanni.nervi@yahoo.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      284d2055
  2. 18 9月, 2013 13 次提交
  3. 17 9月, 2013 5 次提交
  4. 13 9月, 2013 1 次提交
  5. 31 8月, 2013 9 次提交
  6. 29 8月, 2013 1 次提交
    • S
      xhci: Fix warning introduced by disabling runtime PM. · e7ecf069
      Sarah Sharp 提交于
      The 0day build server caught a new build warning that is triggered when
      CONFIG_USB_DEFAULT_PERSIST is turned on:
      
      tree:   git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci.git for-usb-next
      head:   0730d52a
      commit: c8476fb8 [1/3] usb: xhci: Disable runtime PM suspend for quirky controllers
      config: i386-randconfig-r6-0826 (attached as .config)
      
      All warnings:
      
         drivers/usb/host/xhci.c: In function 'xhci_free_dev':
      >> drivers/usb/host/xhci.c:3560:17: warning: unused variable 'dev' [-Wunused-variable]
           struct device *dev = hcd->self.controller;
                          ^
         drivers/usb/host/xhci.c: In function 'xhci_alloc_dev':
      >> drivers/usb/host/xhci.c:3648:17: warning: unused variable 'dev' [-Wunused-variable]
           struct device *dev = hcd->self.controller;
                          ^
      
      vim +/dev +3560 drivers/usb/host/xhci.c
      
        3554   * disabled.  Free any HC data structures associated with that device.
        3555   */
        3556  void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
        3557  {
        3558          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
        3559          struct xhci_virt_device *virt_dev;
      > 3560          struct device *dev = hcd->self.controller;
        3561          unsigned long flags;
        3562          u32 state;
        3563          int i, ret;
        3564
        3565  #ifndef CONFIG_USB_DEFAULT_PERSIST
        3566          /*
        3567           * We called pm_runtime_get_noresume when the device was attached.
        3568           * Decrement the counter here to allow controller to runtime suspend
        3569           * if no devices remain.
        3570           */
        3571          if (xhci->quirks & XHCI_RESET_ON_RESUME)
        3572                  pm_runtime_put_noidle(dev);
        3573  #endif
        3574
      ...
        3641  /*
        3642   * Returns 0 if the xHC ran out of device slots, the Enable Slot command
        3643   * timed out, or allocating memory failed.  Returns 1 on success.
        3644   */
        3645  int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
        3646  {
        3647          struct xhci_hcd *xhci = hcd_to_xhci(hcd);
      > 3648          struct device *dev = hcd->self.controller;
        3649          unsigned long flags;
        3650          int timeleft;
        3651          int ret;
      
      Fix this.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Shawn Nematbakhsh <shawnn@chromium.org>
      e7ecf069
  7. 28 8月, 2013 6 次提交