1. 17 1月, 2023 2 次提交
  2. 27 4月, 2022 1 次提交
    • K
      usb: hub: Add delay for SuperSpeed hub resume to let links transit to U0 · 71ca8fe5
      Kai-Heng Feng 提交于
      stable inclusion
      from stable-v5.10.94
      commit e10de31055479e81819645ac00434f695d357d0a
      bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e10de31055479e81819645ac00434f695d357d0a
      
      --------------------------------
      
      [ Upstream commit 00558586 ]
      
      When a new USB device gets plugged to nested hubs, the affected hub,
      which connects to usb 2-1.4-port2, doesn't report there's any change,
      hence the nested hubs go back to runtime suspend like nothing happened:
      [  281.032951] usb usb2: usb wakeup-resume
      [  281.032959] usb usb2: usb auto-resume
      [  281.032974] hub 2-0:1.0: hub_resume
      [  281.033011] usb usb2-port1: status 0263 change 0000
      [  281.033077] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000
      [  281.049797] usb 2-1: usb wakeup-resume
      [  281.069800] usb 2-1: Waited 0ms for CONNECT
      [  281.069810] usb 2-1: finish resume
      [  281.070026] hub 2-1:1.0: hub_resume
      [  281.070250] usb 2-1-port4: status 0203 change 0000
      [  281.070272] usb usb2-port1: resume, status 0
      [  281.070282] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000
      [  281.089813] usb 2-1.4: usb wakeup-resume
      [  281.109792] usb 2-1.4: Waited 0ms for CONNECT
      [  281.109801] usb 2-1.4: finish resume
      [  281.109991] hub 2-1.4:1.0: hub_resume
      [  281.110147] usb 2-1.4-port2: status 0263 change 0000
      [  281.110234] usb 2-1-port4: resume, status 0
      [  281.110239] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s
      [  281.110266] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000
      [  281.110426] hub 2-1.4:1.0: hub_suspend
      [  281.110565] usb 2-1.4: usb auto-suspend, wakeup 1
      [  281.130998] hub 2-1:1.0: hub_suspend
      [  281.137788] usb 2-1: usb auto-suspend, wakeup 1
      [  281.142935] hub 2-0:1.0: state 7 ports 4 chg 0000 evt 0000
      [  281.177828] usb 2-1: usb wakeup-resume
      [  281.197839] usb 2-1: Waited 0ms for CONNECT
      [  281.197850] usb 2-1: finish resume
      [  281.197984] hub 2-1:1.0: hub_resume
      [  281.198203] usb 2-1-port4: status 0203 change 0000
      [  281.198228] usb usb2-port1: resume, status 0
      [  281.198237] hub 2-1:1.0: state 7 ports 4 chg 0010 evt 0000
      [  281.217835] usb 2-1.4: usb wakeup-resume
      [  281.237834] usb 2-1.4: Waited 0ms for CONNECT
      [  281.237845] usb 2-1.4: finish resume
      [  281.237990] hub 2-1.4:1.0: hub_resume
      [  281.238067] usb 2-1.4-port2: status 0263 change 0000
      [  281.238148] usb 2-1-port4: resume, status 0
      [  281.238152] usb 2-1-port4: status 0203, change 0000, 10.0 Gb/s
      [  281.238166] hub 2-1.4:1.0: state 7 ports 4 chg 0000 evt 0000
      [  281.238385] hub 2-1.4:1.0: hub_suspend
      [  281.238523] usb 2-1.4: usb auto-suspend, wakeup 1
      [  281.258076] hub 2-1:1.0: hub_suspend
      [  281.265744] usb 2-1: usb auto-suspend, wakeup 1
      [  281.285976] hub 2-0:1.0: hub_suspend
      [  281.285988] usb usb2: bus auto-suspend, wakeup 1
      
      USB 3.2 spec, 9.2.5.4 "Changing Function Suspend State" says that "If
      the link is in a non-U0 state, then the device must transition the link
      to U0 prior to sending the remote wake message", but the hub only
      transits the link to U0 after signaling remote wakeup.
      
      So be more forgiving and use a 20ms delay to let the link transit to U0
      for remote wakeup.
      Suggested-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Link: https://lore.kernel.org/r/20211215120108.336597-1-kai.heng.feng@canonical.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      71ca8fe5
  3. 19 4月, 2022 1 次提交
    • A
      USB: core: Fix bug in resuming hub's handling of wakeup requests · ae7129f0
      Alan Stern 提交于
      stable inclusion
      from stable-v5.10.92
      commit 15982330b61d7d6aa53580aaff18d8db2972c094
      bugzilla: 186193 https://gitee.com/openeuler/kernel/issues/I53108
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=15982330b61d7d6aa53580aaff18d8db2972c094
      
      --------------------------------
      
      commit 0f663729 upstream.
      
      Bugzilla #213839 reports a 7-port hub that doesn't work properly when
      devices are plugged into some of the ports; the kernel goes into an
      unending disconnect/reinitialize loop as shown in the bug report.
      
      This "7-port hub" comprises two four-port hubs with one plugged into
      the other; the failures occur when a device is plugged into one of the
      downstream hub's ports.  (These hubs have other problems too.  For
      example, they bill themselves as USB-2.0 compliant but they only run
      at full speed.)
      
      It turns out that the failures are caused by bugs in both the kernel
      and the hub.  The hub's bug is that it reports a different
      bmAttributes value in its configuration descriptor following a remote
      wakeup (0xe0 before, 0xc0 after -- the wakeup-support bit has
      changed).
      
      The kernel's bug is inside the hub driver's resume handler.  When
      hub_activate() sees that one of the hub's downstream ports got a
      wakeup request from a child device, it notes this fact by setting the
      corresponding bit in the hub->change_bits variable.  But this variable
      is meant for connection changes, not wakeup events; setting it causes
      the driver to believe the downstream port has been disconnected and
      then connected again (in addition to having received a wakeup
      request).
      
      Because of this, the hub driver then tries to check whether the device
      currently plugged into the downstream port is the same as the device
      that had been attached there before.  Normally this check succeeds and
      wakeup handling continues with no harm done (which is why the bug
      remained undetected until now).  But with these dodgy hubs, the check
      fails because the config descriptor has changed.  This causes the hub
      driver to reinitialize the child device, leading to the
      disconnect/reinitialize loop described in the bug report.
      
      The proper way to note reception of a downstream wakeup request is
      to set a bit in the hub->event_bits variable instead of
      hub->change_bits.  That way the hub driver will realize that something
      has happened to the port but will not think the port and child device
      have been disconnected.  This patch makes that change.
      
      Cc: <stable@vger.kernel.org>
      Tested-by: NJonathan McDowell <noodles@earth.li>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/YdCw7nSfWYPKWQoD@rowland.harvard.eduSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      ae7129f0
  4. 14 1月, 2022 2 次提交
  5. 15 10月, 2021 2 次提交
  6. 06 7月, 2021 1 次提交
  7. 03 6月, 2021 2 次提交
  8. 02 10月, 2020 2 次提交
    • A
      USB: hub: Add Kconfig option to reduce number of port initialization retries · fb6f076d
      Alan Stern 提交于
      Description based on one by Yasushi Asano:
      
      According to 6.7.22 A-UUT “Device No Response” for connection timeout
      of USB OTG and EH automated compliance plan v1.2, enumeration failure
      has to be detected within 30 seconds.  However, the old and new
      enumeration schemes each make a total of 12 attempts, and each attempt
      can take 5 seconds to time out, so the PET test fails.
      
      This patch adds a new Kconfig option (CONFIG_USB_FEW_INIT_RETRIES);
      when the option is set all the initialization retry loops except the
      outermost are reduced to a single iteration.  This reduces the total
      number of attempts to four, allowing Linux hosts to pass the PET test.
      
      The new option is disabled by default to preserve the existing
      behavior.  The reduced number of retries may fail to initialize a few
      devices that currently do work, but for the most part there should be
      no change.  And in cases where the initialization does fail, it will
      fail much more quickly.
      Reported-and-tested-by: Nyasushi asano <yazzep@gmail.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20200928152217.GB134701@rowland.harvard.eduSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb6f076d
    • A
      USB: hub: Clean up use of port initialization schemes and retries · 19502e69
      Alan Stern 提交于
      The SET_CONFIG_TRIES macro in hub.c is badly named; it controls the
      number of port-initialization retry attempts rather than the number of
      Set-Configuration attempts.  Furthermore, the USE_NEW_SCHEME macro and
      use_new_scheme() function are written in a very confusing manner,
      making it almost impossible to figure out exactly what they do or
      check that they are correct.
      
      This patch renames SET_CONFIG_TRIES to PORT_INIT_TRIES, removes
      USE_NEW_SCHEME entirely, and rewrites use_new_scheme() to be much more
      transparent, with added comments explaining how it works.  The patch
      also pulls the single call site of use_new_scheme() out from the
      Get-Descriptor retry loop (where it returns the same value each time)
      and renames the local variable used to store the result.
      
      The overall effect is a minor cleanup.  However, there is one
      functional change: If the "use_both_schemes" module parameter isn't
      set (by default it is set), the existing code does only two retry
      iterations.  After this patch it will always perform four, regardless
      of the parameter's value.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20200928152050.GA134701@rowland.harvard.eduSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19502e69
  9. 25 9月, 2020 1 次提交
  10. 16 9月, 2020 1 次提交
  11. 24 8月, 2020 1 次提交
  12. 10 7月, 2020 1 次提交
  13. 19 6月, 2020 2 次提交
    • G
      USB: OTG: rename product list of devices · f8f02d5c
      Greg Kroah-Hartman 提交于
      Rename the list of specific devices that an OTG device could support to
      make it more obvious as to what this list is for and what it is doing.
      Also rename the configuration option to make it more obvious as well.
      
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: "Diego Elio Pettenò" <flameeyes@flameeyes.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
      Cc: Qi Zhou <atmgnd@outlook.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Hardik Gajjar <hgajjar@de.adit-jv.com>
      Cc: Harry Pan <harry.pan@intel.com>
      Cc: David Heinzelmann <heinzelmann.david@gmail.com>
      Cc: Nishad Kamdar <nishadkamdar@gmail.com>
      Link: https://lore.kernel.org/r/20200618094300.1887727-9-gregkh@linuxfoundation.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8f02d5c
    • G
      USB: rename USB OTG hub configuration option · 9af54301
      Greg Kroah-Hartman 提交于
      The USB OTG code has the ability to disable external hubs, but the
      configuration option for it is oddly named.  Rename it to be more
      obvious as to what it does.
      
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Bin Liu <b-liu@ti.com>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Eugeniu Rosca <erosca@de.adit-jv.com>
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: David Heinzelmann <heinzelmann.david@gmail.com>
      Cc: "Lee, Chiasheng" <chiasheng.lee@intel.com>
      Cc: Keiya Nobuta <nobuta.keiya@fujitsu.com>
      Cc: Hardik Gajjar <hgajjar@de.adit-jv.com>
      Link: https://lore.kernel.org/r/20200618094300.1887727-3-gregkh@linuxfoundation.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9af54301
  14. 15 5月, 2020 1 次提交
  15. 28 4月, 2020 1 次提交
  16. 23 4月, 2020 2 次提交
    • A
      USB: hub: Revert commit bd0e6c96 ("usb: hub: try old enumeration scheme... · 3155f4f4
      Alan Stern 提交于
      USB: hub: Revert commit bd0e6c96 ("usb: hub: try old enumeration scheme first for high speed devices")
      
      Commit bd0e6c96 ("usb: hub: try old enumeration scheme first for
      high speed devices") changed the way the hub driver enumerates
      high-speed devices.  Instead of using the "new" enumeration scheme
      first and switching to the "old" scheme if that doesn't work, we start
      with the "old" scheme.  In theory this is better because the "old"
      scheme is slightly faster -- it involves resetting the device only
      once instead of twice.
      
      However, for a long time Windows used only the "new" scheme.  Zeng Tao
      said that Windows 8 and later use the "old" scheme for high-speed
      devices, but apparently there are some devices that don't like it.
      William Bader reports that the Ricoh webcam built into his Sony Vaio
      laptop not only doesn't enumerate under the "old" scheme, it gets hung
      up so badly that it won't then enumerate under the "new" scheme!  Only
      a cold reset will fix it.
      
      Therefore we will revert the commit and go back to trying the "new"
      scheme first for high-speed devices.
      Reported-and-tested-by: NWilliam Bader <williambader@hotmail.com>
      Ref: https://bugzilla.kernel.org/show_bug.cgi?id=207219Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Fixes: bd0e6c96 ("usb: hub: try old enumeration scheme first for high speed devices")
      CC: Zeng Tao <prime.zeng@hisilicon.com>
      CC: <stable@vger.kernel.org>
      
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2004221611230.11262-100000@iolanthe.rowland.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3155f4f4
    • A
      USB: hub: Fix handling of connect changes during sleep · 9f952e26
      Alan Stern 提交于
      Commit 8099f58f ("USB: hub: Don't record a connect-change event
      during reset-resume") wasn't very well conceived.  The problem it
      tried to fix was that if a connect-change event occurred while the
      system was asleep (such as a device disconnecting itself from the bus
      when it is suspended and then reconnecting when it resumes)
      requiring a reset-resume during the system wakeup transition, the hub
      port's change_bit entry would remain set afterward.  This would cause
      the hub driver to believe another connect-change event had occurred
      after the reset-resume, which was wrong and would lead the driver to
      send unnecessary requests to the device (which could interfere with a
      firmware update).
      
      The commit tried to fix this by not setting the change_bit during the
      wakeup.  But this was the wrong thing to do; it means that when a
      device is unplugged while the system is asleep, the hub driver doesn't
      realize anything has happened: The change_bit flag which would tell it
      to handle the disconnect event is clear.
      
      The commit needs to be reverted and the problem fixed in a different
      way.  Fortunately an alternative solution was noted in the commit's
      Changelog: We can continue to set the change_bit entry in
      hub_activate() but then clear it when a reset-resume occurs.  That way
      the the hub driver will see the change_bit when a device is
      disconnected but won't see it when the device is still present.
      
      That's what this patch does.
      Reported-and-tested-by: NPeter Chen <peter.chen@nxp.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Fixes: 8099f58f ("USB: hub: Don't record a connect-change event during reset-resume")
      Tested-by: NPaul Zimmerman <pauldzim@gmail.com>
      CC: <stable@vger.kernel.org>
      
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2004221602480.11262-100000@iolanthe.rowland.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f952e26
  17. 04 3月, 2020 2 次提交
  18. 11 2月, 2020 2 次提交
    • A
      USB: hub: Don't record a connect-change event during reset-resume · 8099f58f
      Alan Stern 提交于
      Paul Zimmerman reports that his USB Bluetooth adapter sometimes
      crashes following system resume, when it receives a
      Get-Device-Descriptor request while it is busy doing something else.
      
      Such a request was added by commit a4f55d8b ("usb: hub: Check
      device descriptor before resusciation").  It gets sent when the hub
      driver's work thread checks whether a connect-change event on an
      enabled port really indicates a new device has been connected, as
      opposed to an old device momentarily disconnecting and then
      reconnecting (which can happen with xHCI host controllers, since they
      automatically enable connected ports).
      
      The same kind of thing occurs when a port's power session is lost
      during system suspend.  When the system wakes up it sees a
      connect-change event on the port, and if the child device's
      persist_enabled flag was set then hub_activate() sets the device's
      reset_resume flag as well as the port's bit in hub->change_bits.  The
      reset-resume code then takes responsibility for checking that the same
      device is still attached to the port, and it does this as part of the
      device's resume pathway.  By the time the hub driver's work thread
      starts up again, the device has already been fully reinitialized and
      is busy doing its own thing.  There's no need for the work thread to
      do the same check a second time, and in fact this unnecessary check is
      what caused the problem that Paul observed.
      
      Note that performing the unnecessary check is not actually a bug.
      Devices are supposed to be able to send descriptors back to the host
      even when they are busy doing something else.  The underlying cause of
      Paul's problem lies in his Bluetooth adapter.  Nevertheless, we
      shouldn't perform the same check twice in a row -- and as a nice side
      benefit, removing the extra check allows the Bluetooth adapter to work
      more reliably.
      
      The work thread performs its check when it sees that the port's bit is
      set in hub->change_bits.  In this situation that bit is interpreted as
      though a connect-change event had occurred on the port _after_ the
      reset-resume, which is not what actually happened.
      
      One possible fix would be to make the reset-resume code clear the
      port's bit in hub->change_bits.  But it seems simpler to just avoid
      setting the bit during hub_activate() in the first place.  That's what
      this patch does.
      
      (Proving that the patch is correct when CONFIG_PM is disabled requires
      a little thought.  In that setting hub_activate() will be called only
      for initialization and resets, since there won't be any resumes or
      reset-resumes.  During initialization and hub resets the hub doesn't
      have any child devices, and so this code path never gets executed.)
      Reported-and-tested-by: NPaul Zimmerman <pauldzim@gmail.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Link: https://marc.info/?t=157949360700001&r=1&w=2
      CC: David Heinzelmann <heinzelmann.david@gmail.com>
      CC: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2001311037460.1577-100000@iolanthe.rowland.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8099f58f
    • H
      USB: hub: Fix the broken detection of USB3 device in SMSC hub · 1208f9e1
      Hardik Gajjar 提交于
      Renesas R-Car H3ULCB + Kingfisher Infotainment Board is either not able
      to detect the USB3.0 mass storage devices or is detecting those as
      USB2.0 high speed devices.
      
      The explanation given by Renesas is that, due to a HW issue, the XHCI
      driver does not wake up after going to sleep on connecting a USB3.0
      device.
      
      In order to mitigate that, disable the auto-suspend feature
      specifically for SMSC hubs from hub_probe() function, as a quirk.
      
      Renesas Kingfisher Infotainment Board has two USB3.0 ports (CN2) which
      are connected via USB5534B 4-port SuperSpeed/Hi-Speed, low-power,
      configurable hub controller.
      
      [1] SanDisk USB 3.0 device detected as USB-2.0 before the patch
       [   74.036390] usb 5-1.1: new high-speed USB device number 4 using xhci-hcd
       [   74.061598] usb 5-1.1: New USB device found, idVendor=0781, idProduct=5581, bcdDevice= 1.00
       [   74.069976] usb 5-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
       [   74.077303] usb 5-1.1: Product: Ultra
       [   74.080980] usb 5-1.1: Manufacturer: SanDisk
       [   74.085263] usb 5-1.1: SerialNumber: 4C530001110208116550
      
      [2] SanDisk USB 3.0 device detected as USB-3.0 after the patch
       [   34.565078] usb 6-1.1: new SuperSpeed Gen 1 USB device number 3 using xhci-hcd
       [   34.588719] usb 6-1.1: New USB device found, idVendor=0781, idProduct=5581, bcdDevice= 1.00
       [   34.597098] usb 6-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
       [   34.604430] usb 6-1.1: Product: Ultra
       [   34.608110] usb 6-1.1: Manufacturer: SanDisk
       [   34.612397] usb 6-1.1: SerialNumber: 4C530001110208116550
      Suggested-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NHardik Gajjar <hgajjar@de.adit-jv.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NEugeniu Rosca <erosca@de.adit-jv.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/1580989763-32291-1-git-send-email-hgajjar@de.adit-jv.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1208f9e1
  19. 15 1月, 2020 1 次提交
    • K
      usb: core: hub: Improved device recognition on remote wakeup · 9c06ac4c
      Keiya Nobuta 提交于
      If hub_activate() is called before D+ has stabilized after remote
      wakeup, the following situation might occur:
      
               __      ___________________
              /  \    /
      D+   __/    \__/
      
      Hub  _______________________________
                |  ^   ^           ^
                |  |   |           |
      Host _____v__|___|___________|______
                |  |   |           |
                |  |   |           \-- Interrupt Transfer (*3)
                |  |    \-- ClearPortFeature (*2)
                |   \-- GetPortStatus (*1)
                \-- Host detects remote wakeup
      
      - D+ goes high, Host starts running by remote wakeup
      - D+ is not stable, goes low
      - Host requests GetPortStatus at (*1) and gets the following hub status:
        - Current Connect Status bit is 0
        - Connect Status Change bit is 1
      - D+ stabilizes, goes high
      - Host requests ClearPortFeature and thus Connect Status Change bit is
        cleared at (*2)
      - After waiting 100 ms, Host starts the Interrupt Transfer at (*3)
      - Since the Connect Status Change bit is 0, Hub returns NAK.
      
      In this case, port_event() is not called in hub_event() and Host cannot
      recognize device. To solve this issue, flag change_bits even if only
      Connect Status Change bit is 1 when got in the first GetPortStatus.
      
      This issue occurs rarely because it only if D+ changes during a very
      short time between GetPortStatus and ClearPortFeature. However, it is
      fatal if it occurs in embedded system.
      Signed-off-by: NKeiya Nobuta <nobuta.keiya@fujitsu.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20200109051448.28150-1-nobuta.keiya@fujitsu.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c06ac4c
  20. 09 1月, 2020 1 次提交
  21. 05 12月, 2019 1 次提交
  22. 07 11月, 2019 1 次提交
    • K
      usb: Allow USB device to be warm reset in suspended state · e76b3bf7
      Kai-Heng Feng 提交于
      On Dell WD15 dock, sometimes USB ethernet cannot be detected after plugging
      cable to the ethernet port, the hub and roothub get runtime resumed and
      runtime suspended immediately:
      ...
      [  433.315169] xhci_hcd 0000:3a:00.0: hcd_pci_runtime_resume: 0
      [  433.315204] usb usb4: usb auto-resume
      [  433.315226] hub 4-0:1.0: hub_resume
      [  433.315239] xhci_hcd 0000:3a:00.0: Get port status 4-1 read: 0x10202e2, return 0x10343
      [  433.315264] usb usb4-port1: status 0343 change 0001
      [  433.315279] xhci_hcd 0000:3a:00.0: clear port1 connect change, portsc: 0x10002e2
      [  433.315293] xhci_hcd 0000:3a:00.0: Get port status 4-2 read: 0x2a0, return 0x2a0
      [  433.317012] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
      [  433.422282] xhci_hcd 0000:3a:00.0: Get port status 4-1 read: 0x10002e2, return 0x343
      [  433.422307] usb usb4-port1: do warm reset
      [  433.422311] usb 4-1: device reset not allowed in state 8
      [  433.422339] hub 4-0:1.0: state 7 ports 2 chg 0002 evt 0000
      [  433.422346] xhci_hcd 0000:3a:00.0: Get port status 4-1 read: 0x10002e2, return 0x343
      [  433.422356] usb usb4-port1: do warm reset
      [  433.422358] usb 4-1: device reset not allowed in state 8
      [  433.422428] xhci_hcd 0000:3a:00.0: set port remote wake mask, actual port 0 status  = 0xf0002e2
      [  433.422455] xhci_hcd 0000:3a:00.0: set port remote wake mask, actual port 1 status  = 0xe0002a0
      [  433.422465] hub 4-0:1.0: hub_suspend
      [  433.422475] usb usb4: bus auto-suspend, wakeup 1
      [  433.426161] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
      [  433.466209] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.510204] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.554051] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.598235] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.642154] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.686204] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.730205] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.774203] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.818207] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.862040] xhci_hcd 0000:3a:00.0: port 0 polling in bus suspend, waiting
      [  433.862053] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
      [  433.862077] xhci_hcd 0000:3a:00.0: xhci_suspend: stopping port polling.
      [  433.862096] xhci_hcd 0000:3a:00.0: // Setting command ring address to 0x8578fc001
      [  433.862312] xhci_hcd 0000:3a:00.0: hcd_pci_runtime_suspend: 0
      [  433.862445] xhci_hcd 0000:3a:00.0: PME# enabled
      [  433.902376] xhci_hcd 0000:3a:00.0: restoring config space at offset 0xc (was 0x0, writing 0x20)
      [  433.902395] xhci_hcd 0000:3a:00.0: restoring config space at offset 0x4 (was 0x100000, writing 0x100403)
      [  433.902490] xhci_hcd 0000:3a:00.0: PME# disabled
      [  433.902504] xhci_hcd 0000:3a:00.0: enabling bus mastering
      [  433.902547] xhci_hcd 0000:3a:00.0: // Setting command ring address to 0x8578fc001
      [  433.902649] pcieport 0000:00:1b.0: PME: Spurious native interrupt!
      [  433.902839] xhci_hcd 0000:3a:00.0: Port change event, 4-1, id 3, portsc: 0xb0202e2
      [  433.902842] xhci_hcd 0000:3a:00.0: resume root hub
      [  433.902845] xhci_hcd 0000:3a:00.0: handle_port_status: starting port polling.
      [  433.902877] xhci_hcd 0000:3a:00.0: xhci_resume: starting port polling.
      [  433.902889] xhci_hcd 0000:3a:00.0: xhci_hub_status_data: stopping port polling.
      [  433.902891] xhci_hcd 0000:3a:00.0: hcd_pci_runtime_resume: 0
      [  433.902919] usb usb4: usb wakeup-resume
      [  433.902942] usb usb4: usb auto-resume
      [  433.902966] hub 4-0:1.0: hub_resume
      ...
      
      As Mathias pointed out, the hub enters Cold Attach Status state and
      requires a warm reset. However usb_reset_device() bails out early when
      the device is in suspended state, as its callers port_event() and
      hub_event() don't always resume the device.
      
      Since there's nothing wrong to reset a suspended device, allow
      usb_reset_device() to do so to solve the issue.
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20191106062710.29880-1-kai.heng.feng@canonical.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e76b3bf7
  23. 10 10月, 2019 1 次提交
  24. 04 7月, 2019 1 次提交
  25. 20 6月, 2019 1 次提交
  26. 05 6月, 2019 1 次提交
    • J
      usb: Add devaddr in struct usb_device · 4998f1ef
      Jim Lin 提交于
      The Clear_TT_Buffer request sent to the hub includes the address of
      the LS/FS child device in wValue field. usb_hub_clear_tt_buffer()
      uses udev->devnum to set the address wValue. This won't work for
      devices connected to xHC.
      
      For other host controllers udev->devnum is the same as the address of
      the usb device, chosen and set by usb core. With xHC the controller
      hardware assigns the address, and won't be the same as devnum.
      
      Here we add devaddr in "struct usb_device" for
      usb_hub_clear_tt_buffer() to use.
      Signed-off-by: NJim Lin <jilin@nvidia.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4998f1ef
  27. 21 5月, 2019 2 次提交
  28. 03 5月, 2019 1 次提交
  29. 17 4月, 2019 1 次提交
    • A
      USB: core: Don't unbind interfaces following device reset failure · 381419fa
      Alan Stern 提交于
      The SCSI core does not like to have devices or hosts unregistered
      while error recovery is in progress.  Trying to do so can lead to
      self-deadlock: Part of the removal code tries to obtain a lock already
      held by the error handler.
      
      This can cause problems for the usb-storage and uas drivers, because
      their error handler routines perform a USB reset, and if the reset
      fails then the USB core automatically goes on to unbind all drivers
      from the device's interfaces -- all while still in the context of the
      SCSI error handler.
      
      As it turns out, practically all the scenarios leading to a USB reset
      failure end up causing a device disconnect (the main error pathway in
      usb_reset_and_verify_device(), at the end of the routine, calls
      hub_port_logical_disconnect() before returning).  As a result, the
      hub_wq thread will soon become aware of the problem and will unbind
      all the device's drivers in its own context, not in the
      error-handler's context.
      
      This means that usb_reset_device() does not need to call
      usb_unbind_and_rebind_marked_interfaces() in cases where
      usb_reset_and_verify_device() has returned an error, because hub_wq
      will take care of everything anyway.
      
      This particular problem was observed in somewhat artificial
      circumstances, by using usbfs to tell a hub to power-down a port
      connected to a USB-3 mass storage device using the UAS protocol.  With
      the port turned off, the currently executing command timed out and the
      error handler started running.  The USB reset naturally failed,
      because the hub port was off, and the error handler deadlocked as
      described above.  Not carrying out the call to
      usb_unbind_and_rebind_marked_interfaces() fixes this issue.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NKento Kobayashi <Kento.A.Kobayashi@sony.com>
      Tested-by: NKento Kobayashi <Kento.A.Kobayashi@sony.com>
      CC: Bart Van Assche <bvanassche@acm.org>
      CC: Martin K. Petersen <martin.petersen@oracle.com>
      CC: Jacky Cao <Jacky.Cao@sony.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      381419fa
  30. 16 4月, 2019 1 次提交