1. 28 8月, 2017 1 次提交
    • J
      usb: xhci: Support enabling of compliance mode for xhci 1.1 · 4b562bd2
      Jack Pham 提交于
      To perform SuperSpeed compliance testing the port should first
      be placed into compliance mode. For xHCI 1.0 and prior this
      transition happens automatically when the port is in Training
      and encounters an LFPS timeout. Thus running compliance tests
      against a test appliance may simply just work by simply plugging
      in to the downstream port.
      
      However starting with xHCI 1.1 the transition from Polling.LFPS
      to compliance mode may be disabled by default and needs to be
      explicitly enabled by writing to the PLS field of the PORTSC
      register, which sets an internal 'CTE' (Compliance Transition
      Enabled) flag so that the port will perform the transition the
      next time it encounters LFPS timeout. Whether this is disabled or
      not is determined by the 'CTC' (Compliance Transition Capability)
      bit in the HCCPARAMS2 capability register.
      
      In order to allow a test operator to change this if needed, allow
      a test driver (such as drivers/usb/misc/lvstest.c) to send a
      SET_FEATURE(PORT_LINK_STATE) control message to the root hub to
      update the link state prior to connecting to the port. Subsequently,
      placing the port in warm reset would then disable the flag.
      Signed-off-by: NJack Pham <jackp@codeaurora.org>
      Acked-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b562bd2
  2. 17 8月, 2017 1 次提交
  3. 20 7月, 2017 3 次提交
  4. 20 6月, 2017 1 次提交
  5. 18 5月, 2017 1 次提交
  6. 18 4月, 2017 1 次提交
  7. 08 4月, 2017 4 次提交
  8. 25 1月, 2017 4 次提交
  9. 20 10月, 2016 2 次提交
  10. 16 8月, 2016 1 次提交
    • J
      usb: xhci: Fix panic if disconnect · 88716a93
      Jim Lin 提交于
      After a device is disconnected, xhci_stop_device() will be invoked
      in xhci_bus_suspend().
      Also the "disconnect" IRQ will have ISR to invoke
      xhci_free_virt_device() in this sequence.
      xhci_irq -> xhci_handle_event -> handle_cmd_completion ->
      xhci_handle_cmd_disable_slot -> xhci_free_virt_device
      
      If xhci->devs[slot_id] has been assigned to NULL in
      xhci_free_virt_device(), then virt_dev->eps[i].ring in
      xhci_stop_device() may point to an invlid address to cause kernel
      panic.
      
      virt_dev = xhci->devs[slot_id];
      :
      if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue)
      
      [] Unable to handle kernel paging request at virtual address 00001a68
      [] pgd=ffffffc001430000
      [] [00001a68] *pgd=000000013c807003, *pud=000000013c807003,
      *pmd=000000013c808003, *pte=0000000000000000
      [] Internal error: Oops: 96000006 [#1] PREEMPT SMP
      [] CPU: 0 PID: 39 Comm: kworker/0:1 Tainted: G     U
      [] Workqueue: pm pm_runtime_work
      [] task: ffffffc0bc0e0bc0 ti: ffffffc0bc0ec000 task.ti:
      ffffffc0bc0ec000
      [] PC is at xhci_stop_device.constprop.11+0xb4/0x1a4
      
      This issue is found when running with realtek ethernet device
      (0bda:8153).
      Signed-off-by: NJim Lin <jilin@nvidia.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88716a93
  11. 04 2月, 2016 1 次提交
  12. 12 12月, 2015 1 次提交
    • M
      xhci: fix usb2 resume timing and races. · f69115fd
      Mathias Nyman 提交于
      According to USB 2 specs ports need to signal resume for at least 20ms,
      in practice even longer, before moving to U0 state.
      Both host and devices can initiate resume.
      
      On device initiated resume, a port status interrupt with the port in resume
      state in issued. The interrupt handler tags a resume_done[port]
      timestamp with current time + USB_RESUME_TIMEOUT, and kick roothub timer.
      Root hub timer requests for port status, finds the port in resume state,
      checks if resume_done[port] timestamp passed, and set port to U0 state.
      
      On host initiated resume, current code sets the port to resume state,
      sleep 20ms, and finally sets the port to U0 state. This should also
      be changed to work in a similar way as the device initiated resume, with
      timestamp tagging, but that is not yet tested and will be a separate
      fix later.
      
      There are a few issues with this approach
      
      1. A host initiated resume will also generate a resume event. The event
         handler will find the port in resume state, believe it's a device
         initiated resume, and act accordingly.
      
      2. A port status request might cut the resume signalling short if a
         get_port_status request is handled during the host resume signalling.
         The port will be found in resume state. The timestamp is not set leading
         to time_after_eq(jiffies, timestamp) returning true, as timestamp = 0.
         get_port_status will proceed with moving the port to U0.
      
      3. If an error, or anything else happens to the port during device
         initiated resume signalling it will leave all the device resume
         parameters hanging uncleared, preventing further suspend, returning
         -EBUSY, and cause the pm thread to busyloop trying to enter suspend.
      
      Fix this by using the existing resuming_ports bitfield to indicate that
      resume signalling timing is taken care of.
      Check if the resume_done[port] is set before using it for timestamp
      comparison, and also clear out any resume signalling related variables
      if port is not in U0 or Resume state
      
      This issue was discovered when a PM thread busylooped, trying to runtime
      suspend the xhci USB 2 roothub on a Dell XPS
      
      Cc: stable <stable@vger.kernel.org>
      Reported-by: NDaniel J Blueman <daniel@quora.org>
      Tested-by: NDaniel J Blueman <daniel@quora.org>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f69115fd
  13. 02 12月, 2015 1 次提交
  14. 19 11月, 2015 1 次提交
    • M
      xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices · dad67d5f
      Mathias Nyman 提交于
      Clear device initiated resume variables once device is fully up and running
      in U0 state.
      
      Resume needs to be signaled for 20ms for usb2 devices before they can be
      moved to U0 state.
      
      An interrupt is triggered if a device initiates resume. As we handle the
      event in interrupt context we can not sleep for 20ms, so we instead set
      a resume flag, a timestamp, and start the roothub polling.
      
      The roothub code will later move the port to U0 when it finds a port in
      resume state with the resume flag set, and timestamp passed by 20ms.
      
      A host initiated resume is however not done in interrupt context, and
      host initiated resume code will directly signal resume, wait 20ms and then
      move the port to U0.
      
      These two codepaths can race, if we are in the middle of a host initated
      resume, while sleeping for 20ms, we may handle a port event and find the
      port in resume state. The port event handling code will assume the resume
      was device initiated and set the resume flag and timestamp.
      
      Root hub code will however not catch the port in resume state again as the
      host initated resume code has already moved the port to U0.
      The resume flag and timestamp will remain set for this port preventing port
      from suspending again  (LPM setting port to U3)
      
      Fix this for now by always clearing the device initated resume parameters
      once port is in U0
      
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dad67d5f
  15. 04 10月, 2015 4 次提交
  16. 23 7月, 2015 3 次提交
  17. 31 5月, 2015 1 次提交
  18. 24 3月, 2015 1 次提交
  19. 04 12月, 2014 1 次提交
  20. 22 11月, 2014 1 次提交
  21. 24 9月, 2014 2 次提交
  22. 09 9月, 2014 1 次提交
    • F
      usb: host: xhci: fix compliance mode workaround · 96908589
      Felipe Balbi 提交于
      Commit 71c731a2 (usb: host: xhci: Fix Compliance Mode
      on SN65LVP3502CP Hardware) implemented a workaround
      for a known issue with Texas Instruments' USB 3.0
      redriver IC but it left a condition where any xHCI
      host would be taken out of reset if port was placed
      in compliance mode and there was no device connected
      to the port.
      
      That condition would trigger a fake connection to a
      non-existent device so that usbcore would trigger a
      warm reset of the port, thus taking the link out of
      reset.
      
      This has the side-effect of preventing any xHCI host
      connected to a Linux machine from starting and running
      the USB 3.0 Electrical Compliance Suite because the
      port will mysteriously taken out of compliance mode
      and, thus, xHCI won't step through the necessary
      compliance patterns for link validation.
      
      This patch fixes the issue by just adding a missing
      check for XHCI_COMP_MODE_QUIRK inside
      xhci_hub_report_usb3_link_state() when PORT_CAS isn't
      set.
      
      This patch should be backported to all kernels containing
      commit 71c731a2.
      
      Fixes: 71c731a2 (usb: host: xhci: Fix Compliance Mode on SN65LVP3502CP Hardware)
      Cc: Alexis R. Cortes <alexis.cortes@ti.com>
      Cc: <stable@vger.kernel.org> # v3.2+
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      Acked-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      96908589
  23. 25 6月, 2014 1 次提交
  24. 18 6月, 2014 1 次提交
  25. 20 5月, 2014 1 次提交
    • 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