1. 29 1月, 2021 8 次提交
  2. 09 12月, 2020 2 次提交
    • T
      usb: xhci: Use temporary buffer to consolidate SG · 2017a1e5
      Tejas Joglekar 提交于
      The Synopsys xHC has an internal TRB cache of size TRB_CACHE_SIZE for
      each endpoint. The default value for TRB_CACHE_SIZE is 16 for SS and 8
      for HS. The controller loads and updates the TRB cache from the transfer
      ring in system memory whenever the driver issues a start transfer or
      update transfer command.
      
      For chained TRBs, the Synopsys xHC requires that the total amount of
      bytes for all TRBs loaded in the TRB cache be greater than or equal to 1
      MPS. Or the chain ends within the TRB cache (with a last TRB).
      
      If this requirement is not met, the controller will not be able to send
      or receive a packet and it will hang causing a driver timeout and error.
      
      This can be a problem if a class driver queues SG requests with many
      small-buffer entries. The XHCI driver will create a chained TRB for each
      entry which may trigger this issue.
      
      This patch adds logic to the XHCI driver to detect and prevent this from
      happening.
      
      For every (TRB_CACHE_SIZE - 2), we check the total buffer size of
      the SG list and if the last window of (TRB_CACHE_SIZE - 2) SG list length
      and we don't make up at least 1 MPS, we create a temporary buffer to
      consolidate full SG list into the buffer.
      
      We check at (TRB_CACHE_SIZE - 2) window because it is possible that there
      would be a link and/or event data TRB that take up to 2 of the cache
      entries.
      
      We discovered this issue with devices on other platforms but have not
      yet come across any device that triggers this on Linux. But it could be
      a real problem now or in the future. All it takes is N number of small
      chained TRBs. And other instances of the Synopsys IP may have smaller
      values for the TRB_CACHE_SIZE which would exacerbate the problem.
      Signed-off-by: NTejas Joglekar <joglekar@synopsys.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20201208092912.1773650-3-mathias.nyman@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2017a1e5
    • T
      usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK · bac1ec55
      Tejas Joglekar 提交于
      This commit uses the private data passed by parent device
      to set the quirk for Synopsys xHC. This patch fixes the
      SNPS xHC hang issue when the data is scattered across
      small buffers which does not make atleast MPS size for
      given TRB cache size of SNPS xHC.
      Signed-off-by: NTejas Joglekar <joglekar@synopsys.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20201208092912.1773650-2-mathias.nyman@linux.intel.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bac1ec55
  3. 29 10月, 2020 1 次提交
  4. 20 9月, 2020 1 次提交
  5. 18 8月, 2020 1 次提交
  6. 23 7月, 2020 1 次提交
  7. 24 6月, 2020 1 次提交
  8. 15 5月, 2020 1 次提交
  9. 21 4月, 2020 1 次提交
  10. 16 4月, 2020 1 次提交
  11. 13 3月, 2020 2 次提交
  12. 24 2月, 2020 1 次提交
  13. 13 2月, 2020 2 次提交
  14. 10 2月, 2020 1 次提交
  15. 11 12月, 2019 1 次提交
  16. 16 11月, 2019 1 次提交
  17. 03 9月, 2019 1 次提交
  18. 25 7月, 2019 1 次提交
  19. 19 6月, 2019 1 次提交
    • M
      usb: xhci: Don't try to recover an endpoint if port is in error state. · b8c3b718
      Mathias Nyman 提交于
      A USB3 device needs to be reset and re-enumarated if the port it
      connects to goes to a error state, with link state inactive.
      
      There is no use in trying to recover failed transactions by resetting
      endpoints at this stage. Tests show that in rare cases, after multiple
      endpoint resets of a roothub port the whole host controller might stop
      completely.
      
      Several retries to recover from transaction error can happen as
      it can take a long time before the hub thread discovers the USB3
      port error and inactive link.
      
      We can't reliably detect the port error from slot or endpoint context
      due to a limitation in xhci, see xhci specs section 4.8.3:
      "There are several cases where the EP State field in the Output
      Endpoint Context may not reflect the current state of an endpoint"
      and
      "Software should maintain an accurate value for EP State, by tracking it
      with an internal variable that is driven by Events and Doorbell accesses"
      
      Same appears to be true for slot state.
      
      set a flag to the corresponding slot if a USB3 roothub port link goes
      inactive to prevent both queueing new URBs and resetting endpoints.
      Reported-by: NRapolu Chiranjeevi <chiranjeevi.rapolu@intel.com>
      Tested-by: NRapolu Chiranjeevi <chiranjeevi.rapolu@intel.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>
      b8c3b718
  20. 05 6月, 2019 1 次提交
    • J
      usb: xhci: Add Clear_TT_Buffer · ef513be0
      Jim Lin 提交于
      USB 2.0 specification chapter 11.17.5 says "as part of endpoint halt
      processing for full-/low-speed endpoints connected via a TT, the host
      software must use the Clear_TT_Buffer request to the TT to ensure
      that the buffer is not in the busy state".
      
      In our case, a full-speed speaker (ConferenceCam) is behind a high-
      speed hub (ConferenceCam Connect), sometimes once we get STALL on a
      request we may continue to get STALL with the folllowing requests,
      like Set_Interface.
      
      Here we invoke usb_hub_clear_tt_buffer() to send Clear_TT_Buffer
      request to the hub of the device for the following Set_Interface
      requests to the device to get ACK successfully.
      Signed-off-by: NJim Lin <jilin@nvidia.com>
      Acked-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef513be0
  21. 22 5月, 2019 1 次提交
  22. 27 4月, 2019 2 次提交
  23. 23 3月, 2019 1 次提交
    • M
      xhci: Don't let USB3 ports stuck in polling state prevent suspend · d92f2c59
      Mathias Nyman 提交于
      Commit 2f31a67f ("usb: xhci: Prevent bus suspend if a port connect
      change or polling state is detected") was intended to prevent ports that
      were still link training from being forced to U3 suspend state mid
      enumeration.
      This solved enumeration issues for devices with slow link training.
      
      Turns out some devices are stuck in the link training/polling state,
      and thus that patch will prevent suspend completely for these devices.
      This is seen with USB3 card readers in some MacBooks.
      
      Instead of preventing suspend, give some time to complete the link
      training. On successful training the port will end up as connected
      and enabled.
      If port instead is stuck in link training the bus suspend will continue
      suspending after 360ms (10 * 36ms) timeout (tPollingLFPSTimeout).
      
      Original patch was sent to stable, this one should go there as well
      
      Fixes: 2f31a67f ("usb: xhci: Prevent bus suspend if a port connect change or polling state is detected")
      Cc: stable@vger.kernel.org
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d92f2c59
  24. 17 12月, 2018 1 次提交
  25. 07 12月, 2018 3 次提交
  26. 06 12月, 2018 1 次提交
  27. 10 11月, 2018 1 次提交