1. 10 Jul, 2012 1 commit
    • Alan Stern's avatar
      PCI: EHCI: fix crash during suspend on ASUS computers · dbf0e4c7
      Alan Stern authored
      Quite a few ASUS computers experience a nasty problem, related to the
      EHCI controllers, when going into system suspend.  It was observed
      that the problem didn't occur if the controllers were not put into the
      D3 power state before starting the suspend, and commit
      151b6128 (USB: EHCI: fix crash during
      suspend on ASUS computers) was created to do this.
      
      It turned out this approach messed up other computers that didn't have
      the problem -- it prevented USB wakeup from working.  Consequently
      commit c2fb8a3f (USB: add
      NO_D3_DURING_SLEEP flag and revert 151b6128) was merged; it
      reverted the earlier commit and added a whitelist of known good board
      names.
      
      Now we know the actual cause of the problem.  Thanks to AceLan Kao for
      tracking it down.
      
      According to him, an engineer at ASUS explained that some of their
      BIOSes contain a bug that was added in an attempt to work around a
      problem in early versions of Windows.  When the computer goes into S3
      suspend, the BIOS tries to verify that the EHCI controllers were first
      quiesced by the OS.  Nothing's wrong with this, but the BIOS does it
      by checking that the PCI COMMAND registers contain 0 without checking
      the controllers' power state.  If the register isn't 0, the BIOS
      assumes the controller needs to be quiesced and tries to do so.  This
      involves making various MMIO accesses to the controller, which don't
      work very well if the controller is already in D3.  The end result is
      a system hang or memory corruption.
      
      Since the value in the PCI COMMAND register doesn't matter once the
      controller has been suspended, and since the value will be restored
      anyway when the controller is resumed, we can work around the BIOS bug
      simply by setting the register to 0 during system suspend.  This patch
      (as1590) does so and also reverts the second commit mentioned above,
      which is now unnecessary.
      
      In theory we could do this for every PCI device.  However to avoid
      introducing new problems, the patch restricts itself to EHCI host
      controllers.
      
      Finally the affected systems can suspend with USB wakeup working
      properly.
      
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=37632
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=42728Based-on-patch-by: default avatarAceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Tested-by: default avatarDâniel Fraga <fragabr@gmail.com>
      Tested-by: default avatarJavier Marcet <jmarcet@gmail.com>
      Tested-by: default avatarAndrey Rahmatullin <wrar@wrar.name>
      Tested-by: default avatarOleksij Rempel <bug-track@fisher-privat.net>
      Tested-by: default avatarPavel Pisa <pisa@cmp.felk.cvut.cz>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dbf0e4c7
  2. 05 Jul, 2012 5 commits
    • Bjørn Mork's avatar
      USB: cdc-wdm: fix lockup on error in wdm_read · b086b6b1
      Bjørn Mork authored
      Clear the WDM_READ flag on empty reads to avoid running
      forever in an infinite tight loop, causing lockups:
      
      Jul  1 21:58:11 nemi kernel: [ 3658.898647] qmi_wwan 2-1:1.2: Unexpected error -71
      Jul  1 21:58:36 nemi kernel: [ 3684.072021] BUG: soft lockup - CPU#0 stuck for 23s! [qmi.pl:12235]
      Jul  1 21:58:36 nemi kernel: [ 3684.072212] CPU 0
      Jul  1 21:58:36 nemi kernel: [ 3684.072355]
      Jul  1 21:58:36 nemi kernel: [ 3684.072367] Pid: 12235, comm: qmi.pl Tainted: P           O 3.5.0-rc2+ #13 LENOVO 2776LEG/2776LEG
      Jul  1 21:58:36 nemi kernel: [ 3684.072383] RIP: 0010:[<ffffffffa0635008>]  [<ffffffffa0635008>] spin_unlock_irq+0x8/0xc [cdc_wdm]
      Jul  1 21:58:36 nemi kernel: [ 3684.072388] RSP: 0018:ffff88022dca1e70  EFLAGS: 00000282
      Jul  1 21:58:36 nemi kernel: [ 3684.072393] RAX: ffff88022fc3f650 RBX: ffffffff811c56f7 RCX: 00000001000ce8c1
      Jul  1 21:58:36 nemi kernel: [ 3684.072398] RDX: 0000000000000010 RSI: 000000000267d810 RDI: ffff88022fc3f650
      Jul  1 21:58:36 nemi kernel: [ 3684.072403] RBP: ffff88022dca1eb0 R08: ffffffffa063578e R09: 0000000000000000
      Jul  1 21:58:36 nemi kernel: [ 3684.072407] R10: 0000000000000008 R11: 0000000000000246 R12: 0000000000000002
      Jul  1 21:58:36 nemi kernel: [ 3684.072412] R13: 0000000000000246 R14: ffffffff00000002 R15: ffff8802281d8c88
      Jul  1 21:58:36 nemi kernel: [ 3684.072418] FS:  00007f666a260700(0000) GS:ffff88023bc00000(0000) knlGS:0000000000000000
      Jul  1 21:58:36 nemi kernel: [ 3684.072423] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      Jul  1 21:58:36 nemi kernel: [ 3684.072428] CR2: 000000000270d9d8 CR3: 000000022e865000 CR4: 00000000000007f0
      Jul  1 21:58:36 nemi kernel: [ 3684.072433] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      Jul  1 21:58:36 nemi kernel: [ 3684.072438] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Jul  1 21:58:36 nemi kernel: [ 3684.072444] Process qmi.pl (pid: 12235, threadinfo ffff88022dca0000, task ffff88022ff76380)
      Jul  1 21:58:36 nemi kernel: [ 3684.072448] Stack:
      Jul  1 21:58:36 nemi kernel: [ 3684.072458]  ffffffffa063592e 0000000100020000 ffff88022fc3f650 ffff88022fc3f6a8
      Jul  1 21:58:36 nemi kernel: [ 3684.072466]  0000000000000200 0000000100000000 000000000267d810 0000000000000000
      Jul  1 21:58:36 nemi kernel: [ 3684.072475]  0000000000000000 ffff880212cfb6d0 0000000000000200 ffff880212cfb6c0
      Jul  1 21:58:36 nemi kernel: [ 3684.072479] Call Trace:
      Jul  1 21:58:36 nemi kernel: [ 3684.072489]  [<ffffffffa063592e>] ? wdm_read+0x1a0/0x263 [cdc_wdm]
      Jul  1 21:58:36 nemi kernel: [ 3684.072500]  [<ffffffff8110adb7>] ? vfs_read+0xa1/0xfb
      Jul  1 21:58:36 nemi kernel: [ 3684.072509]  [<ffffffff81040589>] ? alarm_setitimer+0x35/0x64
      Jul  1 21:58:36 nemi kernel: [ 3684.072517]  [<ffffffff8110aec7>] ? sys_read+0x45/0x6e
      Jul  1 21:58:36 nemi kernel: [ 3684.072525]  [<ffffffff813725f9>] ? system_call_fastpath+0x16/0x1b
      Jul  1 21:58:36 nemi kernel: [ 3684.072557] Code: <66> 66 90 c3 83 ff ed 89 f8 74 16 7f 06 83 ff a1 75 0a c3 83 ff f4
      
      The WDM_READ flag is normally cleared by wdm_int_callback
      before resubmitting the read urb, and set by wdm_in_callback
      when this urb returns with data or an error.  But a crashing
      device may cause both a read error and cancelling all urbs.
      Make sure that the flag is cleared by wdm_read if the buffer
      is empty.
      
      We don't clear the flag on errors, as there may be pending
      data in the buffer which should be processed.  The flag will
      instead be cleared on the next wdm_read call.
      
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Acked-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b086b6b1
    • Johan Hovold's avatar
      USB: metro-usb: fix tty_flip_buffer_push use · b7d28e32
      Johan Hovold authored
      Do not set low_latency flag at open as tty_flip_buffer_push must not be
      called in IRQ context with low_latency set.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7d28e32
    • Gaosen Zhang's avatar
      USB: option: Add MEDIATEK product ids · aacef9c5
      Gaosen Zhang authored
      Signed-off-by: default avatarGaosen Zhang <gaosen.zhang@mediatek.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aacef9c5
    • Bjørn Mork's avatar
      USB: option: add ZTE MF60 · 8e16e33c
      Bjørn Mork authored
      Switches into a composite device by ejecting the initial
      driver CD.  The four interfaces are: QCDM, AT, QMI/wwan
      and mass storage.  Let this driver manage the two serial
      interfaces:
      
      T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 28 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=19d2 ProdID=1402 Rev= 0.00
      S:  Manufacturer=ZTE,Incorporated
      S:  Product=ZTE WCDMA Technologies MSM
      S:  SerialNumber=xxxxx
      C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
      E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=83(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
      E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e16e33c
    • Greg Kroah-Hartman's avatar
      Merge tag 'for-usb-linus-2012-07-02' of... · d25ae369
      Greg Kroah-Hartman authored
      Merge tag 'for-usb-linus-2012-07-02' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-linus
      
      xhci: Fix driver hang and resume error path.
      
      Hi Greg,
      
      Here's two bug fixes for 3.5.  The first fixes an issue with port
      connections not being reported to the USB core after a system resume.
      The second fixes a driver hang when there are two back to back stalls on
      an endpoint.
      
      Sarah Sharp
      d25ae369
  3. 02 Jul, 2012 2 commits
    • Sarah Sharp's avatar
      xhci: Fix hang on back-to-back Set TR Deq Ptr commands. · 0d9f78a9
      Sarah Sharp authored
      The Microsoft LifeChat 3000 USB headset was causing a very reproducible
      hang whenever it was plugged in.  At first, I thought the host
      controller was producing bad transfer events, because the log was filled
      with errors like:
      
      xhci_hcd 0000:00:14.0: ERROR Transfer event TRB DMA ptr not part of current TD
      
      However, it turned out to be an xHCI driver bug in the ring expansion
      patches.  The bug is triggered When there are two ring segments, and a
      TD that ends just before a link TRB, like so:
      
       ______________                     _____________
      |              |              ---> | setup TRB B |
       ______________               |     _____________
      |              |              |    |  data TRB B |
       ______________               |     _____________
      | setup TRB A  | <-- deq      |    |  data TRB B |
       ______________               |     _____________
      | data TRB A   |              |    |             | <-- enq, deq''
       ______________               |     _____________
      | status TRB A |              |    |             |
       ______________               |     _____________
      |  link TRB    |---------------    |  link TRB   |
       _____________  <--- deq'           _____________
      
      TD A (the first control transfer) stalls on the data phase.  That halts
      the ring.  The xHCI driver moves the hardware dequeue pointer to the
      first TRB after the stalled transfer, which happens to be the link TRB.
      
      Once the Set TR dequeue pointer command completes, the function
      update_ring_for_set_deq_completion runs.  That function is supposed to
      update the xHCI driver's dequeue pointer to match the internal hardware
      dequeue pointer.  On the first call this would work fine, and the
      software dequeue pointer would move to deq'.
      
      However, if the transfer immediately after that stalled (TD B in this
      case), another Set TR Dequeue command would be issued.  That would move
      the hardware dequeue pointer to deq''.  Once that command completed,
      update_ring_for_set_deq_completion would run again.
      
      The original code would unconditionally increment the software dequeue
      pointer, which moved the pointer off the ring segment into la-la-land.
      The while loop would happy increment the dequeue pointer (possibly
      wrapping it) until it matched the hardware pointer value.
      
      The while loop would also access all the memory in between the first
      ring segment and the second ring segment to determine if it was a link
      TRB.  This could cause general protection faults, although it was
      unlikely because the ring segments came from a DMA pool, and would often
      have consecutive memory addresses.
      
      If nothing in that space looked like a link TRB, the deq_seg pointer for
      the ring would remain on the first segment.  Thus, the deq_seg and the
      software dequeue pointer would get out of sync.
      
      When the next transfer event came in after the stalled transfer, the
      xHCI driver code would attempt to convert the software dequeue pointer
      into a DMA address in order to compare the DMA address for the completed
      transfer.  Since the deq_seg and the dequeue pointer were out of sync,
      xhci_trb_virt_to_dma would return NULL.
      
      The transfer event would get ignored, the transfer would eventually
      timeout, and we would mistakenly convert the finished transfer to no-op
      TRBs.  Some kernel driver (maybe xHCI?) would then get stuck in an
      infinite loop in interrupt context, and the whole machine would hang.
      
      This patch should be backported to kernels as old as 3.4, that contain
      the commit b008df60 "xHCI: count free
      TRBs on transfer ring"
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Andiry Xu <andiry.xu@amd.com>
      Cc: stable@vger.kernel.org
      0d9f78a9
    • Stanislaw Ledwon's avatar
      usb: Add support for root hub port status CAS · 8bea2bd3
      Stanislaw Ledwon authored
      The host controller port status register supports CAS (Cold Attach
      Status) bit. This bit could be set when USB3.0 device is connected
      when system is in Sx state. When the system wakes to S0 this port
      status with CAS bit is reported and this port can't be used by any
      device.
      
      When CAS bit is set the port should be reset by warm reset. This
      was not supported by xhci driver.
      
      The issue was found when pendrive was connected to suspended
      platform. The link state of "Compliance Mode" was reported together
      with CAS bit. This link state was also not supported by xhci and
      core/hub.c.
      
      The CAS bit is defined only for xhci root hub port and it is
      not supported on regular hubs. The link status is used to force
      warm reset on port. Make the USB core issue a warm reset when port
      is in ether the 'inactive' or 'compliance mode'. Change the xHCI driver
      to report 'compliance mode' when the CAS is set. This force warm reset
      on the root hub port.
      
      This patch should be backported to stable kernels as old as 3.2, that
      contain the commit 10d674a8 "USB: When
      hot reset for USB3 fails, try warm reset."
      Signed-off-by: default avatarStanislaw Ledwon <staszek.ledwon@linux.intel.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: default avatarAndiry Xu <andiry.xu@amd.com>
      Cc: stable@vger.kernel.org
      8bea2bd3
  4. 30 Jun, 2012 13 commits
  5. 29 Jun, 2012 13 commits
  6. 28 Jun, 2012 6 commits