1. 27 May, 2014 24 commits
  2. 23 May, 2014 11 commits
  3. 20 May, 2014 5 commits
    • Mathias Nyman's avatar
      xhci: rework command timeout and cancellation, · c311e391
      Mathias Nyman authored
      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: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c311e391
    • Mathias Nyman's avatar
      xhci: Use completion and status in global command queue · 9ea1833e
      Mathias Nyman authored
      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: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ea1833e
    • Mathias Nyman's avatar
      xhci: Add a global command queue · c9aa1a2d
      Mathias Nyman authored
      Create a list to store command structures, add a structure to it every time
      a command is submitted, and remove it from the list once we get a
      command completion event matching the command.
      
      Callers that wait for completion will free their command structures themselves.
      The other command structures are freed in the command completion event handler.
      
      Also add a check that prevents queuing commands if host is dying
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c9aa1a2d
    • Mathias Nyman's avatar
      xhci: Use command structures when queuing commands on the command ring · ddba5cd0
      Mathias Nyman authored
      To create a global command queue we require that each command put on the
      command ring is submitted with a command structure.
      
      Functions that queue commands and wait for completion need to allocate a command
      before submitting it, and free it once completed. The following command queuing
      functions need to be modified.
      
      xhci_configure_endpoint()
      xhci_address_device()
      xhci_queue_slot_control()
      xhci_queue_stop_endpoint()
      xhci_queue_new_dequeue_state()
      xhci_queue_reset_ep()
      xhci_configure_endpoint()
      
      xhci_configure_endpoint() could already be called with a command structure,
      and only xhci_check_maxpacket and xhci_check_bandwidth did not do so. These
      are changed and a command structure is now required. This change also simplifies
      the configure endpoint command completion handling and the "goto bandwidth_change"
      handling code can be removed.
      
      In some cases the command queuing function is called in interrupt context.
      These commands needs to be allocated atomically, and they can't wait for
      completion. These commands will in this patch be freed directly after queuing,
      but freeing will be moved to the command completion event handler in a later
      patch once we get the global command queue up.(Just so that we won't leak
      memory in the middle of the patch set)
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ddba5cd0
    • Sarah Sharp's avatar
      xhci: Report max device limit when Enable Slot command fails. · be982038
      Sarah Sharp authored
      xHCI host controllers may only support a limited number of device slot
      IDs, which is usually far less than the theoretical maximum number of
      devices (255) that the USB specifications advertise.  This is
      frustrating to consumers that expect to be able to plug in a large
      number of devices.
      
      Add a print statement when the Enable Slot command fails to show how
      many devices the host supports.  We can't change hardware manufacturer's
      design decisions, but hopefully we can save customers a little bit of
      time trying to debug why their host mysteriously fails when too many
      devices are plugged in.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Reported-by: default avatarAmund Hov <Amund.Hov@silabs.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be982038