1. 06 8月, 2015 1 次提交
  2. 23 7月, 2015 2 次提交
  3. 31 5月, 2015 4 次提交
  4. 25 5月, 2015 2 次提交
    • C
      usb: host: xhci: add mutex for non-thread-safe data · a00918d0
      Chris Bainbridge 提交于
      Regression in commit 638139eb ("usb: hub: allow to process more usb
      hub events in parallel")
      
      The regression resulted in intermittent failure to initialise a 10-port
      hub (with three internal VL812 4-port hub controllers) on boot, with a
      failure rate of around 8%, due to multiple race conditions when
      accessing addr_dev and slot_id in struct xhci_hcd.
      
      This regression also exposed a problem with xhci_setup_device, which
      "should be protected by the usb_address0_mutex" but no longer is due to
      
      commit 6fecd4f2 ("USB: separate usb_address0 mutexes for each bus")
      
      With separate buses (and locks) it is no longer the case that a single
      lock will protect xhci_setup_device from accesses by two parallel
      threads processing events on the two buses.
      
      Fix this by adding a mutex to protect addr_dev and slot_id in struct
      xhci_hcd, and by making the assignment of slot_id atomic.
      
      Fixes multiple boot errors:
      
      [ 0.583008] xhci_hcd 0000:00:14.0: Bad Slot ID 2
      [ 0.583009] xhci_hcd 0000:00:14.0: Could not allocate xHCI USB device data structures
      [ 0.583012] usb usb1-port3: couldn't allocate usb_device
      
      And:
      
      [ 0.637409] xhci_hcd 0000:00:14.0: Error while assigning device slot ID
      [ 0.637417] xhci_hcd 0000:00:14.0: Max number of devices this xHCI host supports is 32.
      [ 0.637421] usb usb1-port1: couldn't allocate usb_device
      
      And:
      
      [ 0.753372] xhci_hcd 0000:00:14.0: ERROR: unexpected setup context command completion code 0x0.
      [ 0.753373] usb 1-3: hub failed to enable device, error -22
      [ 0.753400] xhci_hcd 0000:00:14.0: Error while assigning device slot ID
      [ 0.753402] xhci_hcd 0000:00:14.0: Max number of devices this xHCI host supports is 32.
      [ 0.753403] usb usb1-port3: couldn't allocate usb_device
      
      And:
      
      [ 11.018386] usb 1-3: device descriptor read/all, error -110
      
      And:
      
      [ 5.753838] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
      
      Tested with 200 reboots, resulting in no USB hub init related errors.
      
      Fixes: 638139eb ("usb: hub: allow to process more usb hub events in parallel")
      Link: https://lkml.kernel.org/g/CAP-bSRb=A0iEYobdGCLpwynS7pkxpt_9ZnwyZTPVAoy0Y=Zo3Q@mail.gmail.comSigned-off-by: NChris Bainbridge <chris.bainbridge@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.18+
      [changed git commit description style for checkpatch -Mathias]
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a00918d0
    • A
      usb: make module xhci_hcd removable · b04c846c
      Arthur Demchenkov 提交于
      Fixed regression. After commit 29e409f0 ("xhci: Allow xHCI drivers to
      be built as separate modules") the module xhci_hcd became non-removable.
      That behaviour is not expected and there're no notes about it in commit
      message. The module should be removable as it blocks PM suspend/resume
      functions (Debian Bug#666406).
      Signed-off-by: NArthur Demchenkov <spinal.by@gmail.com>
      Reviewed-by: NAndrew Bresticker <abrestic@chromium.org>
      Cc: <stable@vger.kernel.org> # v3.18+
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b04c846c
  5. 11 3月, 2015 1 次提交
  6. 25 2月, 2015 1 次提交
  7. 25 1月, 2015 2 次提交
  8. 10 1月, 2015 5 次提交
  9. 04 12月, 2014 1 次提交
  10. 03 12月, 2014 2 次提交
  11. 22 11月, 2014 2 次提交
  12. 04 10月, 2014 4 次提交
  13. 24 9月, 2014 3 次提交
  14. 12 9月, 2014 1 次提交
  15. 20 8月, 2014 1 次提交
  16. 02 8月, 2014 2 次提交
    • H
    • H
      xhci: Blacklist using streams on the Etron EJ168 controller · 8f873c1f
      Hans de Goede 提交于
      Streams on the EJ168 do not work as they should. I've spend 2 days trying
      to get them to work, but without success.
      
      The first problem is that when ever you ring the stream-ring doorbell, the
      controller starts executing trbs at the beginning of the first ring segment,
      event if it ended somewhere else previously. This can be worked around by
      allowing enqueing only one td (not a problem with how streams are typically
      used) and then resetting our copies of the enqueueing en dequeueing pointers
      on a td completion to match what the controller seems to be doing.
      
      This way things seem to start working with uas and instead of being able
      to complete only the very first scsi command, the scsi core can probe the disk.
      
      But then things break later on when td-s get enqueued with more then one
      trb. The controller does seem to increase its dequeue pointer while executing
      a stream-ring (data transfer events I inserted for debugging do trigger).
      However execution seems to stop at the final normal trb of a multi trb td,
      even if there is a data transfer event inserted after the final trb.
      
      The first problem alone is a serious deviation from the spec, and esp.
      dealing with cancellation would have been very tricky if not outright
      impossible, but the second problem simply is a deal breaker altogether,
      so this patch simply disables streams.
      
      Note this will cause the usb-storage + uas driver pair to automatically switch
      to using usb-storage instead of uas on these devices, essentially reverting
      to the 3.14 and earlier behavior when uas was marked CONFIG_BROKEN.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1121288
      https://bugzilla.kernel.org/show_bug.cgi?id=80101
      
      Cc: stable@vger.kernel.org # 3.15
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f873c1f
  17. 10 7月, 2014 2 次提交
  18. 25 6月, 2014 2 次提交
    • J
      usb: xhci: Correct last context entry calculation for Configure Endpoint · d6759133
      Julius Werner 提交于
      The current XHCI driver recalculates the Context Entries field in the
      Slot Context on every add_endpoint() and drop_endpoint() call. In the
      case of drop_endpoint(), it seems to assume that the add_flags will
      always contain every endpoint for the new configuration, which is not
      necessarily correct if you don't make assumptions about how the USB core
      uses the add_endpoint/drop_endpoint interface (add_flags only contains
      endpoints that are new additions in the new configuration).
      
      Furthermore, EP0_FLAG is not consistently set in add_flags throughout
      the lifetime of a device. This means that when all endpoints are
      dropped, the Context Entries field can be set to 0 (which is invalid and
      may cause a Parameter Error) or -1 (which is interpreted as 31 and
      causes the driver to keep using the old, incorrect value).
      
      The only surefire way to set this field right is to also take all
      existing endpoints into account, and to force the value to 1 (meaning
      only EP0 is active) if no other endpoint is found. This patch implements
      that as a single step in the final check_bandwidth() call and removes
      the intermediary calculations from add_endpoint() and drop_endpoint().
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6759133
    • W
      xhci: Fix runtime suspended xhci from blocking system suspend. · d6236f6d
      Wang, Yu 提交于
      The system suspend flow as following:
      1, Freeze all user processes and kenrel threads.
      
      2, Try to suspend all devices.
      
      2.1, If pci device is in RPM suspended state, then pci driver will try
      to resume it to RPM active state in the prepare stage.
      
      2.2, xhci_resume function calls usb_hcd_resume_root_hub to queue two
      workqueue items to resume usb2&usb3 roothub devices.
      
      2.3, Call suspend callbacks of devices.
      
      2.3.1, All suspend callbacks of all hcd's children, including
      roothub devices are called.
      
      2.3.2, Finally, hcd_pci_suspend callback is called.
      
      Due to workqueue threads were already frozen in step 1, the workqueue
      items can't be scheduled, and the roothub devices can't be resumed in
      this flow. The HCD_FLAG_WAKEUP_PENDING flag which is set in
      usb_hcd_resume_root_hub won't be cleared. Finally,
      hcd_pci_suspend will return -EBUSY, and system suspend fails.
      
      The reason why this issue doesn't show up very often is due to that
      choose_wakeup will be called in step 2.3.1. In step 2.3.1, if
      udev->do_remote_wakeup is not equal to device_may_wakeup(&udev->dev), then
      udev will resume to RPM active for changing the wakeup settings. This
      has been a lucky hit which hides this issue.
      
      For some special xHCI controllers which have no USB2 port, then roothub
      will not match hub driver due to probe failed. Then its
      do_remote_wakeup will be set to zero, and we won't be as lucky.
      
      xhci driver doesn't need to resume roothub devices everytime like in
      the above case. It's only needed when there are pending event TRBs.
      
      This patch should be back-ported to kernels as old as 3.2, that
      contains the commit f69e3120
      "USB: XHCI: resume root hubs when the controller resumes"
      
      Cc: stable@vger.kernel.org # 3.2
      Signed-off-by: NWang, Yu <yu.y.wang@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      [use readl() instead of removed xhci_readl(), reword commit message -Mathias]
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6236f6d
  19. 20 5月, 2014 2 次提交
    • M
      xhci: rework command timeout and cancellation, · c311e391
      Mathias Nyman 提交于
      Use one timer to control command timeout.
      
      start/kick the timer every time a command is completed and a
      new command is waiting, or a new command is added to a empty list.
      
      If the timer runs out, then tag the current command as "aborted", and
      start the xhci command abortion process.
      
      Previously each function that submitted a command had its own timer.
      If that command timed out, a new command structure for the
      command was created and it was put on a cancel_cmd_list list,
      then a pci write to abort the command ring was issued.
      
      when the ring was aborted, it checked if the current command
      was the one to be canceled, later when the ring was stopped the
      driver got ownership of the TRBs in the command ring,
      compared then to the TRBs in the cancel_cmd_list,
      and turned them into No-ops.
      
      Now, instead, at timeout we tag the status of the command in the
      command queue to be aborted, and start the ring abortion.
      Ring abortion stops the command ring and gives control of the
      commands to us.
      All the aborted commands are now turned into No-ops.
      
      If the ring is already stopped when the command times outs its not possible
      to start the ring abortion, in this case the command is turnd to No-op
      right away.
      
      All these changes allows us to remove the entire cancel_cmd_list code.
      
      The functions waiting for a command to finish no longer have their own timeouts.
      They will wait either until the command completes normally,
      or until the whole command abortion is done.
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c311e391
    • M
      xhci: Use completion and status in global command queue · 9ea1833e
      Mathias Nyman 提交于
      Remove the per-device command list and handle_cmd_in_cmd_wait_list()
      and use the completion and status variables found in the
      command structure in the global command list.
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ea1833e