1. 24 2月, 2013 1 次提交
    • M
      usb: forbid memory allocation with I/O during bus reset · 4d769def
      Ming Lei 提交于
      If one storage interface or usb network interface(iSCSI case) exists in
      current configuration, memory allocation with GFP_KERNEL during
      usb_device_reset() might trigger I/O transfer on the storage interface
      itself and cause deadlock because the 'us->dev_mutex' is held in
      .pre_reset() and the storage interface can't do I/O transfer when the
      reset is triggered by other interface, or the error handling can't be
      completed if the reset is triggered by the storage itself (error
      handling path).
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Decotigny <david.decotigny@google.com>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oneukum@suse.de>
      Reviewed-by: NJiri Kosina <jkosina@suse.cz>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4d769def
  2. 26 1月, 2013 2 次提交
    • L
      usb: add usb port auto power off mechanism · ad493e5e
      Lan Tianyu 提交于
      This patch is to add usb port auto power off mechanism.
      When usb device is suspending, usb core will suspend usb port and
      usb port runtime pm callback will clear PORT_POWER feature to
      power off port if all conditions were met. These conditions are
      remote wakeup disable, pm qos NO_POWER_OFF flag clear and persist
      enable. When it resumes, power on port again.
      
      Add did_runtime_put in the struct usb_port to ensure
      pm_runtime_get/put(portdev) to be called pairedly.  Set did_runtime_put
      to true when call pm_runtime_put(portdev) during suspending. The
      pm_runtime_get(portdev) only will be called when did_runtime_put
      is set to true during resuming. Set did_runtime_put to false after
      calling pm_runtime_get(portdev).
      
      Make clear_port_feature() and hdev_to_hub() as global symbol.
      Rename clear_port_feature() to usb_clear_port_feature() and
      hdev_to_hub() to usb_hub_to_struct_hub().
      
      Extend hub_port_debounce() with the fuction of debouncing to
      be connected. Add two wraps: hub_port_debounce_be_connected()
      and hub_port_debouce_be_stable().
      
      Increase HUB_DEBOUNCE_TIMEOUT to 2000 because some usb ssds
      needs around 1.5 or more to make the hub port status to be
      connected steadily after being powered off and powered on.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ad493e5e
    • L
      usb: add runtime pm support for usb port device · 971fcd49
      Lan Tianyu 提交于
      This patch is to add runtime pm callback for usb port device.
      Set/clear PORT_POWER feature in the resume/suspend callback.
      Add portnum for struct usb_port to record port number. Do
      pm_rumtime_get_sync/put(portdev) when a device is plugged/unplugged
      to prevent it from being powered off when it is active.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      971fcd49
  3. 25 1月, 2013 1 次提交
    • L
      usb: Using correct way to clear usb3.0 device's remote wakeup feature. · 54a3ac0c
      Lan Tianyu 提交于
      Usb3.0 device defines function remote wakeup which is only for interface
      recipient rather than device recipient. This is different with usb2.0 device's
      remote wakeup feature which is defined for device recipient. According usb3.0
      spec 9.4.5, the function remote wakeup can be modified by the SetFeature()
      requests using the FUNCTION_SUSPEND feature selector. This patch is to use
      correct way to disable usb3.0 device's function remote wakeup after suspend
      error and resuming.
      
      This should be backported to kernels as old as 3.4, that contain the
      commit 623bef9e "USB/xhci: Enable remote
      wakeup for USB3 devices."
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      54a3ac0c
  4. 22 1月, 2013 1 次提交
    • L
      USB: Set usb port's DeviceRemovable according acpi information · d2123fd9
      Lan Tianyu 提交于
      ACPI provide "_PLD" and "_UPC" aml methods to describe usb port
      visibility and connectability. This patch is to add usb_hub_adjust_DeviceRemovable()
      to adjust usb hub port's DeviceRemovable according ACPI information and invoke it in
      the rh_call_control(). When hub descriptor request is issued at first time,
      usb port device isn't created and usb port is not bound with acpi. So first
      hub descriptor request is not changed based on ACPI information. After usb
      port devices being created, call usb_hub_adjust_DeviceRemovable in the hub_configure()
      and then set hub port's DeviceRemovable according ACPI information and this also works
      for non-root hub.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2123fd9
  5. 21 1月, 2013 1 次提交
  6. 19 1月, 2013 1 次提交
  7. 12 1月, 2013 3 次提交
  8. 04 1月, 2013 12 次提交
    • S
      USB: Refactor hub_port_wait_reset. · 470f0be8
      Sarah Sharp 提交于
      Refactor hub_port_wait_reset into a small loop to wait for the port
      reset to be complete, and then a larger block to deal with the final
      port status.  This patch should not change any current behavior.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      470f0be8
    • S
      USB: Use helper function hub_set_port_link_state · c2f60db7
      Sarah Sharp 提交于
      Change the code that manually issues a Set Port Feature(Link State) to
      use the new helper function hub_set_port_link_state().
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      c2f60db7
    • S
      USB: Fix connected device switch to Inactive state. · d3b9d7a9
      Sarah Sharp 提交于
      A USB 3.0 device can transition to the Inactive state if a U1 or U2 exit
      transition fails.  The current code in hub_events simply issues a warm
      reset, but does not call any pre-reset or post-reset driver methods (or
      unbind/rebind drivers without them).  Therefore the drivers won't know
      their device has just been reset.
      
      hub_events should instead call usb_reset_device.  This means
      hub_port_reset now needs to figure out whether it should issue a warm
      reset or a hot reset.
      
      Remove the FIXME note about needing disconnect() for a NOTATTACHED
      device.  This patch fixes that.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      d3b9d7a9
    • S
      USB: Rip out recursive call on warm port reset. · a24a6078
      Sarah Sharp 提交于
      When a hot reset fails on a USB 3.0 port, the current port reset code
      recursively calls hub_port_reset inside hub_port_wait_reset.  This isn't
      ideal, since we should avoid recursive calls in the kernel, and it also
      doesn't allow us to issue multiple warm resets on reset failures.
      
      Rip out the recursive call.  Instead, add code to hub_port_reset to
      issue a warm reset if the hot reset fails, and try multiple warm resets
      before giving up on the port.
      
      In hub_port_wait_reset, remove the recursive call and re-indent.  The
      code is basically the same, except:
      
      1. It bails out early if the port has transitioned to Inactive or
      Compliance Mode after the reset completed.
      
      2. It doesn't consider a connect status change to be a failed reset.  If
      multiple warm resets needed to be issued, the connect status may have
      changed, so we need to ignore that and look at the port link state
      instead.  hub_port_reset will now do that.
      
      3. It unconditionally sets udev->speed on all types of successful
      resets.  The old recursive code would set the port speed when the second
      hub_port_reset returned.
      
      The old code did not handle connected devices needing a warm reset well.
      There were only two situations that the old code handled correctly: an
      empty port needing a warm reset, and a hot reset that migrated to a warm
      reset.
      
      When an empty port needed a warm reset, hub_port_reset was called with
      the warm variable set.  The code in hub_port_finish_reset would skip
      telling the USB core and the xHC host that the device was reset, because
      otherwise that would result in a NULL pointer dereference.
      
      When a USB 3.0 device reset migrated to a warm reset, the recursive call
      made the call stack look like this:
      
      hub_port_reset(warm = false)
              hub_wait_port_reset(warm = false)
                      hub_port_reset(warm = true)
                              hub_wait_port_reset(warm = true)
                              hub_port_finish_reset(warm = true)
                              (return up the call stack to the first wait)
      
              hub_port_finish_reset(warm = false)
      
      The old code didn't want to notify the USB core or the xHC host of device reset
      twice, so it only did it in the second call to hub_port_finish_reset,
      when warm was set to false.  This was necessary because
      before patch two ("USB: Ignore xHCI Reset Device status."), the USB core
      would pay attention to the xHC Reset Device command error status, and
      the second call would always fail.
      
      Now that we no longer have the recursive call, and warm can change from
      false to true in hub_port_reset, we need to have hub_port_finish_reset
      unconditionally notify the USB core and the xHC of the device reset.
      
      In hub_port_finish_reset, unconditionally clear the connect status
      change (CSC) bit for USB 3.0 hubs when the port reset is done.  If we
      had to issue multiple warm resets for a device, that bit may have been
      set if the device went into SS.Inactive and then was successfully warm
      reset.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      a24a6078
    • S
      USB: Prepare for refactoring by adding extra udev checks. · 2d4fa940
      Sarah Sharp 提交于
      The next patch will refactor the hub port code to rip out the recursive
      call to hub_port_reset on a failed hot reset.  In preparation for that,
      make sure all code paths can deal with being called with a NULL udev.
      The usb_device will not be valid if warm reset was issued because a port
      transitioned to the Inactive or Compliance Mode on a device connect.
      
      This patch should have no effect on current behavior.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      2d4fa940
    • S
      USB: Don't use EHCI port sempahore for USB 3.0 hubs. · 0fe51aa5
      Sarah Sharp 提交于
      The EHCI host controller needs to prevent EHCI initialization when the
      UHCI or OHCI companion controller is in the middle of a port reset.  It
      uses ehci_cf_port_reset_rwsem to do this.  USB 3.0 hubs can't be under
      an EHCI host controller, so it makes no sense to down the semaphore for
      USB 3.0 hubs.  It also makes the warm port reset code more complex.
      
      Don't down ehci_cf_port_reset_rwsem for USB 3.0 hubs.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      0fe51aa5
    • S
      USB: Handle warm reset failure on empty port. · 65bdac5e
      Sarah Sharp 提交于
      An empty port can transition to either Inactive or Compliance Mode if a
      newly connected USB 3.0 device fails to link train.  In that case, we
      issue a warm reset.  Some devices, such as John's Roseweil eusb3
      enclosure, slip back into Compliance Mode after the warm reset.
      
      The current warm reset code does not check for device connect status on
      warm reset completion, and it incorrectly reports the warm reset
      succeeded.  This causes the USB core to attempt to send a Set Address
      control transfer to a port in Compliance Mode, which will always fail.
      
      Make hub_port_wait_reset check the current connect status and link state
      after the warm reset completes.  Return a failure status if the device
      is disconnected or the link state is Compliance Mode or SS.Inactive.
      
      Make hub_events disable the port if warm reset fails.  This will disable
      the port, and then bring it back into the RxDetect state.  Make the USB
      core ignore the connect change until the device reconnects.
      
      Note that this patch does NOT handle connected devices slipping into the
      Inactive state very well.  This is a concern, because devices can go
      into the Inactive state on U1/U2 exit failure.  However, the fix for
      that case is too large for stable, so it will be submitted in a separate
      patch.
      
      This patch should be backported to kernels as old as 3.2, contain the
      commit ID 75d7cf72 "usbcore: refine warm
      reset logic"
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NJohn Covici <covici@ccs.covici.com>
      Cc: stable@vger.kernel.org
      65bdac5e
    • S
      USB: Ignore port state until reset completes. · 4f43447e
      Sarah Sharp 提交于
      The port reset code bails out early if the current connect status is
      cleared (device disconnected).  If we're issuing a hot reset, it may
      also look at the link state before the reset is finished.
      
      Section 10.14.2.6 of the USB 3.0 spec says that when a port enters the
      Error state or Resetting state, the port connection bit retains the
      value from the previous state.  Therefore we can't trust it until the
      reset finishes.  Also, the xHCI spec section 4.19.1.2.5 says software
      shall ignore the link state while the port is resetting, as it can be in
      an unknown state.
      
      The port state during reset is also unknown for USB 2.0 hubs.  The hub
      sends a reset signal by driving the bus into an SE0 state.  This
      overwhelms the "connect" signal from the device, so the port can't tell
      whether anything is connected or not.
      
      Fix the port reset code to ignore the port link state and current
      connect bit until the reset finishes, and USB_PORT_STAT_RESET is
      cleared.
      
      Remove the check for USB_PORT_STAT_C_BH_RESET in the warm reset case,
      because it's redundant.  When the warm reset finishes, the port reset
      bit will be cleared at the same time USB_PORT_STAT_C_BH_RESET is set.
      Remove the now-redundant check for a cleared USB_PORT_STAT_RESET bit
      in the code to deal with the finished reset.
      
      This patch should be backported to all stable kernels.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      4f43447e
    • S
      USB: Increase reset timeout. · 77c7f072
      Sarah Sharp 提交于
      John's NEC 0.96 xHCI host controller needs a longer timeout for a warm
      reset to complete.  The logs show it takes 650ms to complete the warm
      reset, so extend the hub reset timeout to 800ms to be on the safe side.
      
      This commit should be backported to kernels as old as 3.2, that contain
      the commit 75d7cf72 "usbcore: refine
      warm reset logic".
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NJohn Covici <covici@ccs.covici.com>
      Cc: stable@vger.kernel.org
      77c7f072
    • S
      USB: Allow USB 3.0 ports to be disabled. · 41e7e056
      Sarah Sharp 提交于
      If hot and warm reset fails, or a port remains in the Compliance Mode,
      the USB core needs to be able to disable a USB 3.0 port.  Unlike USB 2.0
      ports, once the port is placed into the Disabled link state, it will not
      report any new device connects.  To get device connect notifications, we
      need to put the link into the Disabled state, and then the RxDetect
      state.
      
      The xHCI driver needs to atomically clear all change bits on USB 3.0
      port disable, so that we get Port Status Change Events for future port
      changes.  We could technically do this in the USB core instead of in the
      xHCI roothub code, since the port state machine can't advance out of the
      disabled state until we set the link state to RxDetect.  However,
      external USB 3.0 hubs don't need this code.  They are level-triggered,
      not edge-triggered like xHCI, so they will continue to send interrupt
      events when any change bit is set.  Therefore it doesn't make sense to
      put this code in the USB core.
      
      This patch is part of a series to fix several reports of infinite loops
      on device enumeration failure.  This includes John, when he boots with
      a USB 3.0 device (Roseweil eusb3 enclosure) attached to his NEC 0.96
      host controller.  The fix requires warm reset support, so it does not
      make sense to backport this patch to stable kernels without warm reset
      support.
      
      This patch should be backported to kernels as old as 3.2, contain the
      commit ID 75d7cf72 "usbcore: refine warm
      reset logic"
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NJohn Covici <covici@ccs.covici.com>
      Cc: stable@vger.kernel.org
      41e7e056
    • S
      USB: Ignore xHCI Reset Device status. · 8b8132bc
      Sarah Sharp 提交于
      When the USB core finishes reseting a USB device, the xHCI driver sends
      a Reset Device command to the host.  The xHC then updates its internal
      representation of the USB device to the 'Default' device state.  If the
      device was already in the Default state, the xHC will complete the
      command with an error status.
      
      If a device needs to be reset several times during enumeration, the
      second reset will always fail because of the xHCI Reset Device command.
      This can cause issues during enumeration.
      
      For example, usb_reset_and_verify_device calls into hub_port_init in a
      loop.  Say that on the first call into hub_port_init, the device is
      successfully reset, but doesn't respond to several set address control
      transfers.  Then the port will be disabled, but the udev will remain in
      tact.  usb_reset_and_verify_device will call into hub_port_init again.
      
      On the second call into hub_port_init, the device will be reset, and the
      xHCI driver will issue a Reset Device command.  This command will fail
      (because the device is already in the Default state), and
      usb_reset_and_verify_device will fail.  The port will be disabled, and
      the device won't be able to enumerate.
      
      Fix this by ignoring the return value of the HCD reset_device callback.
      
      This commit should be backported to kernels as old as 3.2, that contain
      the commit 75d7cf72 "usbcore: refine
      warm reset logic".
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      8b8132bc
    • S
      USB: Handle auto-transition from hot to warm reset. · 1c7439c6
      Sarah Sharp 提交于
      USB 3.0 hubs and roothubs will automatically transition a failed hot
      reset to a warm (BH) reset.  In that case, the warm reset change bit
      will be set, and the link state change bit may also be set.  Change
      hub_port_finish_reset to unconditionally clear those change bits for USB
      3.0 hubs.  If these bits are not cleared, we may lose port change events
      from the roothub.
      
      This commit should be backported to kernels as old as 3.2, that contain
      the commit 75d7cf72 "usbcore: refine
      warm reset logic".
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      1c7439c6
  9. 16 11月, 2012 2 次提交
  10. 01 11月, 2012 1 次提交
  11. 31 10月, 2012 1 次提交
  12. 26 10月, 2012 2 次提交
    • M
      USB: set hub's default autosuspend delay as 0 · 596d789a
      Ming Lei 提交于
      This patch sets hub device's default autosuspend delay as 0 to
      speedup bus suspend, see comments in code for details.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      596d789a
    • M
      USB: check port changes before hub runtime suspend for some bug device · e6f30dea
      Ming Lei 提交于
      The hub status endpoint has a long 'bInterval', which is 255ms
      for FS/LS device and 256ms for HS device according to USB 2.0 spec,
      so the device connection change may be reported later more than 255ms
      via status pipe.
      
      The connection change in hub may have been happened already on the
      downstream ports, but no status URB completes when it is killed
      in hub_suspend(auto), so the connection change may be missed by some
      buggy hub devices, which won't generate remote wakeup signal after
      their remote wakeup is enabled and they are put into suspend state.
      
      The problem can be observed at least on the below Genesys Logic, Inc.
      hub devices:
      
      	0x05e3,0x0606
      	0x05e3,0x0608
      
      In theory, there is no way to fix the problem completely, but we
      can make it less likely to occur by this patch.
      
      This patch introduces one quirk of HUB_QUIRK_CHECK_PORTS_AUTOSUSPEND
      to check ports' change during hub_suspend(auto) for the buggy
      devices. If ports' change is found, terminate the auto suspend and
      return to working state.
      
      So for the buggy hubs, if the connection change happend before
      the ports' check, it can be handled correctly. If it happens between
      the ports' check and enabling remote wakeup/entering suspend, it
      will be missed. Considered the interval is quite short, it is very
      less likely to happen during the window.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6f30dea
  13. 25 10月, 2012 1 次提交
    • A
      USB: speed up usb_bus_resume() · bfd1e910
      Alan Stern 提交于
      This patch (as1620) speeds up USB root-hub resumes in the common case
      where every enabled port has its suspend feature set (which currently
      will be true for every runtime resume of the root hub).  If all the
      enabled ports are suspended then resuming the root hub won't resume
      any of the downstream devices.  In this case there's no need for a
      Resume Recovery delay, because that delay is meant to give devices a
      chance to get ready for active use.
      
      To keep track of the port suspend features, the patch adds a
      "port_is_suspended" flag to struct usb_device.  This has to be tracked
      separately from the device's state; it's entirely possible for a USB-2
      device to be suspended while the suspend feature on its parent port is
      clear.  The reason is that devices will go into suspend whenever their
      parent hub does.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reviewed-by: NPeter Chen <peter.chen@freescale.com>
      Tested-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bfd1e910
  14. 24 10月, 2012 1 次提交
  15. 23 10月, 2012 1 次提交
    • O
      usb hub: send clear_tt_buffer_complete events when canceling TT clear work · 3b6054da
      Octavian Purdila 提交于
      There is a race condition in the USB hub code with regard to handling
      TT clear requests that can get the HCD driver in a deadlock. Usually
      when an TT clear request is scheduled it will be executed immediately:
      
      <7>[    6.077583] usb 2-1.3: unlink qh1-0e01/f4d4db00 start 0 [1/2 us]
      <3>[    6.078041] usb 2-1: clear tt buffer port 3, a3 ep2 t04048d82
      <7>[    6.078299] hub_tt_work:731
      <7>[    9.309089] usb 2-1.5: link qh1-0e01/f4d506c0 start 0 [1/2 us]
      <7>[    9.324526] ehci_hcd 0000:00:1d.0: reused qh f4d4db00 schedule
      <7>[    9.324539] usb 2-1.3: link qh1-0e01/f4d4db00 start 0 [1/2 us]
      <7>[    9.341530] usb 1-1.1: link qh4-0e01/f397aec0 start 2 [1/2 us]
      <7>[   10.116159] usb 2-1.3: unlink qh1-0e01/f4d4db00 start 0 [1/2 us]
      <3>[   10.116459] usb 2-1: clear tt buffer port 3, a3 ep2 t04048d82
      <7>[   10.116537] hub_tt_work:731
      
      However, if a suspend operation is triggered before hub_tt_work is
      scheduled, hub_quiesce will cancel the work without notifying the HCD
      driver:
      
      <3>[   35.033941] usb 2-1: clear tt buffer port 3, a3 ep2 t04048d80
      <5>[   35.034022] sd 0:0:0:0: [sda] Stopping disk
      <7>[   35.034039] hub 2-1:1.0: hub_suspend
      <7>[   35.034067] usb 2-1: unlink qh256-0001/f3b1ab00 start 1 [1/0 us]
      <7>[   35.035085] hub 1-0:1.0: hub_suspend
      <7>[   35.035102] usb usb1: bus suspend, wakeup 0
      <7>[   35.035106] ehci_hcd 0000:00:1a.0: suspend root hub
      <7>[   35.035298] hub 2-0:1.0: hub_suspend
      <7>[   35.035313] usb usb2: bus suspend, wakeup 0
      <7>[   35.035315] ehci_hcd 0000:00:1d.0: suspend root hub
      <6>[   35.250017] PM: suspend of devices complete after 216.979 msecs
      <6>[   35.250822] PM: late suspend of devices complete after 0.799 msecs
      <7>[   35.252343] ehci_hcd 0000:00:1d.0: wakeup: 1
      <7>[   35.262923] ehci_hcd 0000:00:1d.0: --> PCI D3hot
      <7>[   35.263302] ehci_hcd 0000:00:1a.0: wakeup: 1
      <7>[   35.273912] ehci_hcd 0000:00:1a.0: --> PCI D3hot
      <6>[   35.274254] PM: noirq suspend of devices complete after 23.442 msecs
      <6>[   35.274975] ACPI: Preparing to enter system sleep state S3
      <6>[   35.292666] PM: Saving platform NVS memory
      <7>[   35.295030] Disabling non-boot CPUs ...
      <6>[   35.297351] CPU 1 is now offline
      <6>[   35.300345] CPU 2 is now offline
      <6>[   35.303929] CPU 3 is now offline
      <7>[   35.303931] lockdep: fixing up alternatives.
      <6>[   35.304825] Extended CMOS year: 2000
      
      When the device will resume the EHCI driver will get stuck in
      ehci_endpoint_disable waiting for the tt_clearing flag to reset:
      
      <0>[   47.610967] usb 2-1.3: **** DPM device timeout ****
      <7>[   47.610972]  f2f11c60 00000092 f2f11c0c c10624a5 00000003 f4c6e880 c1c8a4c0 c1c8a4c0
      <7>[   47.610983]  15c55698 0000000b f56b34c0 f2a45b70 f4c6e880 00000082 f2a4602c f2f11c30
      <7>[   47.610993]  c10787f8 f4cac000 f2a45b70 00000000 f4cac010 f2f11c58 00000046 00000001
      <7>[   47.611004] Call Trace:
      <7>[   47.611006]  [<c10624a5>] ? sched_clock_cpu+0xf5/0x160
      <7>[   47.611019]  [<c10787f8>] ? lock_release_holdtime.part.22+0x88/0xf0
      <7>[   47.611026]  [<c103ed46>] ? lock_timer_base.isra.35+0x26/0x50
      <7>[   47.611034]  [<c17592d3>] ? schedule_timeout+0x133/0x290
      <7>[   47.611044]  [<c175b43e>] schedule+0x1e/0x50
      <7>[   47.611051]  [<c17592d8>] schedule_timeout+0x138/0x290
      <7>[   47.611057]  [<c10624a5>] ? sched_clock_cpu+0xf5/0x160
      <7>[   47.611063]  [<c103e560>] ? usleep_range+0x40/0x40
      <7>[   47.611070]  [<c1759445>] schedule_timeout_uninterruptible+0x15/0x20
      <7>[   47.611077]  [<c14935f4>] ehci_endpoint_disable+0x64/0x160
      <7>[   47.611084]  [<c147d1ee>] ? usb_hcd_flush_endpoint+0x10e/0x1d0
      <7>[   47.611092]  [<c1165663>] ? sysfs_add_file+0x13/0x20
      <7>[   47.611100]  [<c147d5a9>] usb_hcd_disable_endpoint+0x29/0x40
      <7>[   47.611107]  [<c147fafc>] usb_disable_endpoint+0x5c/0x80
      <7>[   47.611111]  [<c147fb57>] usb_disable_interface+0x37/0x50
      <7>[   47.611116]  [<c1477650>] usb_reset_and_verify_device+0x4b0/0x640
      <7>[   47.611122]  [<c1474665>] ? hub_port_status+0xb5/0x100
      <7>[   47.611129]  [<c147a975>] usb_port_resume+0xd5/0x220
      <7>[   47.611136]  [<c148877f>] generic_resume+0xf/0x30
      <7>[   47.611142]  [<c14821a3>] usb_resume+0x133/0x180
      <7>[   47.611147]  [<c1473b10>] ? usb_dev_thaw+0x10/0x10
      <7>[   47.611152]  [<c1473b1d>] usb_dev_resume+0xd/0x10
      <7>[   47.611157]  [<c13baa60>] dpm_run_callback+0x40/0xb0
      <7>[   47.611164]  [<c13bdb03>] ? pm_runtime_enable+0x43/0x70
      <7>[   47.611171]  [<c13bafc6>] device_resume+0x1a6/0x2c0
      <7>[   47.611177]  [<c13ba940>] ? dpm_show_time+0xe0/0xe0
      <7>[   47.611183]  [<c13bb0f9>] async_resume+0x19/0x40
      <7>[   47.611189]  [<c10580c4>] async_run_entry_fn+0x64/0x160
      <7>[   47.611196]  [<c104a244>] ? process_one_work+0x104/0x480
      <7>[   47.611203]  [<c104a24c>] ? process_one_work+0x10c/0x480
      <7>[   47.611209]  [<c104a2c0>] process_one_work+0x180/0x480
      <7>[   47.611215]  [<c104a244>] ? process_one_work+0x104/0x480
      <7>[   47.611220]  [<c1058060>] ? async_schedule+0x10/0x10
      <7>[   47.611226]  [<c104c15c>] worker_thread+0x11c/0x2f0
      <7>[   47.611233]  [<c104c040>] ? manage_workers.isra.27+0x1f0/0x1f0
      <7>[   47.611239]  [<c10507f8>] kthread+0x78/0x80
      <7>[   47.611244]  [<c1750000>] ? timer_cpu_notify+0xd6/0x20d
      <7>[   47.611253]  [<c1050780>] ? __init_kthread_worker+0x60/0x60
      <7>[   47.611258]  [<c176357e>] kernel_thread_helper+0x6/0xd
      <7>[   47.611283] ------------[ cut here ]------------
      
      This patch changes hub_quiesce behavior to flush the TT clear work
      instead of canceling it, to make sure that no TT clear request remains
      uncompleted before suspend.
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b6054da
  16. 09 10月, 2012 3 次提交
    • S
      usb: trival: Fix debugging units mistake. · 1510a1a2
      Sarah Sharp 提交于
      SEL and PEL are in microseconds, not milliseconds.  Also, fix a split
      string that will trigger checkpatch warnings.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      1510a1a2
    • S
      usb: Send Set SEL before enabling parent U1/U2 timeout. · 65a95b75
      Sarah Sharp 提交于
      The Set SEL control transfer tells a device the exit latencies
      associated with a device-initated U1 or U2 exit.  Since a parent hub may
      initiate a transition to U1 soon after a downstream port's U1 timeout is
      set, we need to make sure the device receives the Set SEL transfer
      before the parent hub timeout is set.
      
      This patch should be backported to kernels as old as 3.5, that contain
      the commit 1ea7e0e8 "USB: Add support to
      enable/disable USB3 link states."
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      65a95b75
    • S
      usb: Don't enable LPM if the exit latency is zero. · ae8963ad
      Sarah Sharp 提交于
      Some USB 3.0 devices signal that they don't implement Link PM by having
      all zeroes in the U1/U2 exit latencies in their SuperSpeed BOS
      descriptor.  Don found that a Western Digital device he has experiences
      transfer errors when LPM is enabled.  The lsusb shows the U1/U2 exit
      latencies are set to zero:
      
      Binary Object Store Descriptor:
        bLength                 5
        bDescriptorType        15
        wTotalLength           22
        bNumDeviceCaps          2
        SuperSpeed USB Device Capability:
          bLength                10
          bDescriptorType        16
          bDevCapabilityType      3
          bmAttributes         0x00
            Latency Tolerance Messages (LTM) Supported
          wSpeedsSupported   0x000e
            Device can operate at Full Speed (12Mbps)
            Device can operate at High Speed (480Mbps)
            Device can operate at SuperSpeed (5Gbps)
          bFunctionalitySupport   1
            Lowest fully-functional device speed is Full Speed (12Mbps)
          bU1DevExitLat           0 micro seconds
          bU2DevExitLat           0 micro seconds
      
      The fix is to not enable LPM for a particular link state if we find its
      corresponding exit latency is zero.
      
      This patch should be backported to kernels as old as 3.5, that contain
      the commit 1ea7e0e8 "USB: Add support to
      enable/disable USB3 link states."
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Reported-by: NDon Zickus <dzickus@redhat.com>
      Tested-by: NDon Zickus <dzickus@redhat.com>
      Cc: stable@vger.kernel.org
      ae8963ad
  17. 25 9月, 2012 1 次提交
  18. 13 9月, 2012 1 次提交
  19. 11 9月, 2012 4 次提交
    • L
    • L
      usb : Add sysfs files to control port power. · ca9c9d0c
      Lan Tianyu 提交于
      This patch adds two sysfs files for each usb hub port to allow userspace
      to control the port power policy.
      
      For an upcoming Intel xHCI roothub, this will translate into ACPI calls
      to completely power off or power on the port.  As a reminder, when these
      ports are completely powered off, the USB host and device will see a
      physical disconnect.  All future USB device connections will be lost,
      and the device will not be able to signal a remote wakeup.
      
      The control sysfs file can be written to with two options:
      "on" - port power must be on.
      "off" - port must be off.
      
      The state sysfs file reports usb port's power state:
      "on" - powered on
      "off" - powered off
      "error" - can't get power state
      
      For now, let userspace dictate the port power off policy.  Future
      patches may add an in-kernel policy.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ca9c9d0c
    • L
      usb/acpi: Store info on device removability. · 05f91689
      Lan Tianyu 提交于
      In the upcoming USB port power off patches, we need to know whether a
      USB port can ever see a disconnect event.  Often USB ports are internal
      to a system, and users can't disconnect USB devices from that port.
      Sometimes those ports will remain empty, because the OEM chose not to
      connect an internal USB device to that port.
      
      According to ACPI Spec 9.13, PLD indicates whether USB port is
      user visible and _UPC indicates whether a USB device can be connected to
      the USB port (we'll call this "connectible").  Here's a matrix of the
      possible combinations:
      
      Visible Connectible
      		Name		Example
      -------------------------------------------------------------------------
      
      Yes	No	Unknown		(Invalid state.)
      
      Yes	Yes	Hot-plug	USB ports on the outside of a laptop.
      				A user could freely connect and disconnect
      				USB devices.
      
      No	Yes	Hard-wired	A USB modem hard-wired to a port on the
      				inside of a laptop.
      
      No	No	Not used	The port is internal to the system and
      				will remain empty.
      
      Represent each of these four states with an enum usb_port_connect_type.
      The four states are USB_PORT_CONNECT_TYPE_UNKNOWN,
      USB_PORT_CONNECT_TYPE_HOT_PLUG, USB_PORT_CONNECT_TYPE_HARD_WIRED, and
      USB_PORT_NOT_USED.  When we get the USB port's acpi_handle, store the
      state in connect_type in struct usb_port.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      05f91689
    • L
      usb/acpi: Bind ACPI node to USB port, not usb_device. · d5575424
      Lan Tianyu 提交于
      In the ACPI DSDT table, only usb root hub and usb ports are ACPI device
      nodes.  Originally, we bound the usb port's ACPI node to the usb device
      attached to the port.  However, we want to access those ACPI port
      methods when the port is empty, and there's no usb_device associated
      with that port.
      
      Now that the usb port is a real device, we can bind the port's ACPI node
      to struct usb_port instead.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d5575424