1. 02 6月, 2016 2 次提交
    • M
      xhci: fix platform quirks overwrite regression in 4.7-rc1 · 757de492
      Mathias Nyman 提交于
      commit b1c127ae ("usb: host: xhci: plat: make use of new methods in
      xhci_plat_priv") sets xhci->quirks before calling xhci_gen_setup(), which
      will overwrite them.
      
      Don't overwite the quirks, just add the new ones
      
      Fixes: b1c127ae ("usb: host: xhci: plat: make use of new methods in xhci_plat_priv")
      Reported-by: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      757de492
    • G
      xhci: Cleanup only when releasing primary hcd · 27a41a83
      Gabriel Krisman Bertazi 提交于
      Under stress occasions some TI devices might not return early when
      reading the status register during the quirk invocation of xhci_irq made
      by usb_hcd_pci_remove.  This means that instead of returning, we end up
      handling this interruption in the middle of a shutdown.  Since
      xhci->event_ring has already been freed in xhci_mem_cleanup, we end up
      accessing freed memory, causing the Oops below.
      
      commit 8c24d6d7 ("usb: xhci: stop everything on the first call to
      xhci_stop") is the one that changed the instant in which we clean up the
      event queue when stopping a device.  Before, we didn't call
      xhci_mem_cleanup at the first time xhci_stop is executed (for the shared
      HCD), instead, we only did it after the invocation for the primary HCD,
      much later at the removal path.  The code flow for this oops looks like
      this:
      
      xhci_pci_remove()
      	usb_remove_hcd(xhci->shared)
      	        xhci_stop(xhci->shared)
       			xhci_halt()
      			xhci_mem_cleanup(xhci);  // Free the event_queue
      	usb_hcd_pci_remove(primary)
      		xhci_irq()  // Access the event_queue if STS_EINT is set. Crash.
      		xhci_stop()
      			xhci_halt()
      			// return early
      
      The fix modifies xhci_stop to only cleanup the xhci data when releasing
      the primary HCD.  This way, we still have the event_queue configured
      when invoking xhci_irq.  We still halt the device on the first call to
      xhci_stop, though.
      
      I could reproduce this issue several times on the mainline kernel by
      doing a bind-unbind stress test with a specific storage gadget attached.
      I also ran the same test over-night with my patch applied and didn't
      observe the issue anymore.
      
      [  113.334124] Unable to handle kernel paging request for data at address 0x00000028
      [  113.335514] Faulting instruction address: 0xd00000000d4f767c
      [  113.336839] Oops: Kernel access of bad area, sig: 11 [#1]
      [  113.338214] SMP NR_CPUS=1024 NUMA PowerNV
      
      [c000000efe47ba90] c000000000720850 usb_hcd_irq+0x50/0x80
      [c000000efe47bac0] c00000000073d328 usb_hcd_pci_remove+0x68/0x1f0
      [c000000efe47bb00] d00000000daf0128 xhci_pci_remove+0x78/0xb0
      [xhci_pci]
      [c000000efe47bb30] c00000000055cf70 pci_device_remove+0x70/0x110
      [c000000efe47bb70] c00000000061c6bc __device_release_driver+0xbc/0x190
      [c000000efe47bba0] c00000000061c7d0 device_release_driver+0x40/0x70
      [c000000efe47bbd0] c000000000619510 unbind_store+0x120/0x150
      [c000000efe47bc20] c0000000006183c4 drv_attr_store+0x64/0xa0
      [c000000efe47bc60] c00000000039f1d0 sysfs_kf_write+0x80/0xb0
      [c000000efe47bca0] c00000000039e14c kernfs_fop_write+0x18c/0x1f0
      [c000000efe47bcf0] c0000000002e962c __vfs_write+0x6c/0x190
      [c000000efe47bd90] c0000000002eab40 vfs_write+0xc0/0x200
      [c000000efe47bde0] c0000000002ec85c SyS_write+0x6c/0x110
      [c000000efe47be30] c000000000009260 system_call+0x38/0x108
      Signed-off-by: NGabriel Krisman Bertazi <krisman@linux.vnet.ibm.com>
      Cc: Roger Quadros <rogerq@ti.com>
      Cc: joel@jms.id.au
      Cc: stable@vger.kernel.org
      Reviewed-by: NRoger Quadros <rogerq@ti.com>
      Cc: <stable@vger.kernel.org> #v4.3+
      Tested-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27a41a83
  2. 27 4月, 2016 1 次提交
  3. 14 4月, 2016 3 次提交
  4. 04 2月, 2016 3 次提交
  5. 05 12月, 2015 2 次提交
  6. 02 12月, 2015 2 次提交
  7. 19 11月, 2015 1 次提交
  8. 17 10月, 2015 1 次提交
  9. 04 10月, 2015 2 次提交
  10. 22 9月, 2015 4 次提交
    • R
      usb: xhci: exit early in xhci_setup_device() if we're halted or dying · 448116bf
      Roger Quadros 提交于
      During quick plug/removal of OTG adapter during dual-role testing
      it can happen that xhci_alloc_device() is called for the newly
      detected device after the DRD library has called xhci_stop to
      remove the HCD.
      
      If that is the case, just fail early to prevent the following warning.
      
      [  154.732649] hub 4-0:1.0: USB hub found
      [  154.742204] hub 4-0:1.0: 1 port detected
      [  154.824458] hub 3-0:1.0: state 7 ports 1 chg 0002 evt 0000
      [  154.854609] hub 4-0:1.0: state 7 ports 1 chg 0000 evt 0000
      [  154.944430] usb 3-1: new high-speed USB device number 2 using xhci-hcd
      [  154.951009] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
      [  155.038191] xhci-hcd xhci-hcd.0.auto: remove, state 4
      [  155.043315] usb usb4: USB disconnect, device number 1
      [  155.055270] xhci-hcd xhci-hcd.0.auto: xhci_stop
      [  155.060094] xhci-hcd xhci-hcd.0.auto: USB bus 4 deregistered
      [  155.066576] xhci-hcd xhci-hcd.0.auto: remove, state 1
      [  155.071710] usb usb3: USB disconnect, device number 1
      [  155.077124] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
      [  155.082389] ------------[ cut here ]------------
      [  155.087690] WARNING: CPU: 0 PID: 72 at drivers/usb/host/xhci.c:3800 xhci_setup_device+0x410/0x484 [xhci_hcd]()
      [  155.097861] Modules linked in: sd_mod usb_storage scsi_mod usb_f_ss_lb g_zero libcomposite ipv6 xhci_plat_hcd xhci_hcd usbcore dwc3 udc_core evdev ti_am335x_adc joydev kfifo_buf industrialio snd_soc_simple_cc
      [  155.146734] CPU: 0 PID: 72 Comm: kworker/0:3 Tainted: G        W       4.1.4-00834-gcd9380b-dirty #50
      [  155.156073] Hardware name: Generic AM43 (Flattened Device Tree)
      [  155.162117] Workqueue: usb_hub_wq hub_event [usbcore]
      [  155.167249] Backtrace:
      [  155.169751] [<c0012af0>] (dump_backtrace) from [<c0012c8c>] (show_stack+0x18/0x1c)
      [  155.177390]  r6:c089d4a4 r5:ffffffff r4:00000000 r3:ee46c000
      [  155.183137] [<c0012c74>] (show_stack) from [<c05f7c14>] (dump_stack+0x84/0xd0)
      [  155.190446] [<c05f7b90>] (dump_stack) from [<c00439ac>] (warn_slowpath_common+0x80/0xbc)
      [  155.198605]  r7:00000009 r6:00000ed8 r5:bf27eb70 r4:00000000
      [  155.204348] [<c004392c>] (warn_slowpath_common) from [<c0043a0c>] (warn_slowpath_null+0x24/0x2c)
      [  155.213202]  r8:ee49f000 r7:ee7c0004 r6:00000000 r5:ee7c0158 r4:ee7c0000
      [  155.220051] [<c00439e8>] (warn_slowpath_null) from [<bf27eb70>] (xhci_setup_device+0x410/0x484 [xhci_hcd])
      [  155.229816] [<bf27e760>] (xhci_setup_device [xhci_hcd]) from [<bf27ec10>] (xhci_address_device+0x14/0x18 [xhci_hcd])
      [  155.240415]  r10:ee598200 r9:00000001 r8:00000002 r7:00000001 r6:00000003 r5:00000002
      [  155.248363]  r4:ee49f000
      [  155.250978] [<bf27ebfc>] (xhci_address_device [xhci_hcd]) from [<bf20cb94>] (hub_port_init+0x1b8/0xa9c [usbcore])
      [  155.261403] [<bf20c9dc>] (hub_port_init [usbcore]) from [<bf2101e0>] (hub_event+0x738/0x1020 [usbcore])
      [  155.270874]  r10:ee598200 r9:ee7c0000 r8:ee7c0038 r7:ee518800 r6:ee49f000 r5:00000001
      [  155.278822]  r4:00000000
      [  155.281426] [<bf20faa8>] (hub_event [usbcore]) from [<c005754c>] (process_one_work+0x128/0x340)
      [  155.290196]  r10:00000000 r9:00000003 r8:00000000 r7:fedfa000 r6:eeec5400 r5:ee598314
      [  155.298151]  r4:ee434380
      [  155.300718] [<c0057424>] (process_one_work) from [<c00578f8>] (worker_thread+0x158/0x49c)
      [  155.308963]  r10:ee434380 r9:00000003 r8:eeec5400 r7:00000008 r6:ee434398 r5:eeec5400
      [  155.316913]  r4:eeec5414
      [  155.319482] [<c00577a0>] (worker_thread) from [<c005cc40>] (kthread+0xdc/0xf8)
      [  155.326765]  r10:00000000 r9:00000000 r8:00000000 r7:c00577a0 r6:ee434380 r5:ee4441c0
      [  155.334713]  r4:00000000 r3:00000000
      [  155.338341] [<c005cb64>] (kthread) from [<c000fc08>] (ret_from_fork+0x14/0x2c)
      [  155.345626]  r7:00000000 r6:00000000 r5:c005cb64 r4:ee4441c0
      [  155.356108] ---[ end trace a58d34c223b190e6 ]---
      [  155.360783] xhci-hcd xhci-hcd.0.auto: Virt dev invalid for slot_id 0x1!
      [  155.574404] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
      [  155.579667] ------------[ cut here ]------------
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      448116bf
    • R
      usb: xhci: stop everything on the first call to xhci_stop · 8c24d6d7
      Roger Quadros 提交于
      xhci_stop will be called twice, once for the shared hcd
      and again for the primary hcd.
      
      We stop the XHCI controller in any case so clean up
      everything on the first call else we can timeout
      waiting for pending requests to complete.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c24d6d7
    • R
      usb: xhci: Clear XHCI_STATE_DYING on start · e5bfeab0
      Roger Quadros 提交于
      For whatever reason if XHCI died in the previous instant
      then it will never recover on the next xhci_start unless we
      clear the DYING flag.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e5bfeab0
    • R
      usb: xhci: lock mutex on xhci_stop · 85ac90f8
      Roger Quadros 提交于
      Else it races with xhci_setup_device
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRoger Quadros <rogerq@ti.com>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85ac90f8
  11. 09 8月, 2015 1 次提交
  12. 06 8月, 2015 1 次提交
  13. 23 7月, 2015 2 次提交
  14. 31 5月, 2015 4 次提交
  15. 25 5月, 2015 2 次提交
    • C
      usb: host: xhci: add mutex for non-thread-safe data · a00918d0
      Chris Bainbridge 提交于
      Regression in commit 638139eb ("usb: hub: allow to process more usb
      hub events in parallel")
      
      The regression resulted in intermittent failure to initialise a 10-port
      hub (with three internal VL812 4-port hub controllers) on boot, with a
      failure rate of around 8%, due to multiple race conditions when
      accessing addr_dev and slot_id in struct xhci_hcd.
      
      This regression also exposed a problem with xhci_setup_device, which
      "should be protected by the usb_address0_mutex" but no longer is due to
      
      commit 6fecd4f2 ("USB: separate usb_address0 mutexes for each bus")
      
      With separate buses (and locks) it is no longer the case that a single
      lock will protect xhci_setup_device from accesses by two parallel
      threads processing events on the two buses.
      
      Fix this by adding a mutex to protect addr_dev and slot_id in struct
      xhci_hcd, and by making the assignment of slot_id atomic.
      
      Fixes multiple boot errors:
      
      [ 0.583008] xhci_hcd 0000:00:14.0: Bad Slot ID 2
      [ 0.583009] xhci_hcd 0000:00:14.0: Could not allocate xHCI USB device data structures
      [ 0.583012] usb usb1-port3: couldn't allocate usb_device
      
      And:
      
      [ 0.637409] xhci_hcd 0000:00:14.0: Error while assigning device slot ID
      [ 0.637417] xhci_hcd 0000:00:14.0: Max number of devices this xHCI host supports is 32.
      [ 0.637421] usb usb1-port1: couldn't allocate usb_device
      
      And:
      
      [ 0.753372] xhci_hcd 0000:00:14.0: ERROR: unexpected setup context command completion code 0x0.
      [ 0.753373] usb 1-3: hub failed to enable device, error -22
      [ 0.753400] xhci_hcd 0000:00:14.0: Error while assigning device slot ID
      [ 0.753402] xhci_hcd 0000:00:14.0: Max number of devices this xHCI host supports is 32.
      [ 0.753403] usb usb1-port3: couldn't allocate usb_device
      
      And:
      
      [ 11.018386] usb 1-3: device descriptor read/all, error -110
      
      And:
      
      [ 5.753838] xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command
      
      Tested with 200 reboots, resulting in no USB hub init related errors.
      
      Fixes: 638139eb ("usb: hub: allow to process more usb hub events in parallel")
      Link: https://lkml.kernel.org/g/CAP-bSRb=A0iEYobdGCLpwynS7pkxpt_9ZnwyZTPVAoy0Y=Zo3Q@mail.gmail.comSigned-off-by: NChris Bainbridge <chris.bainbridge@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.18+
      [changed git commit description style for checkpatch -Mathias]
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a00918d0
    • A
      usb: make module xhci_hcd removable · b04c846c
      Arthur Demchenkov 提交于
      Fixed regression. After commit 29e409f0 ("xhci: Allow xHCI drivers to
      be built as separate modules") the module xhci_hcd became non-removable.
      That behaviour is not expected and there're no notes about it in commit
      message. The module should be removable as it blocks PM suspend/resume
      functions (Debian Bug#666406).
      Signed-off-by: NArthur Demchenkov <spinal.by@gmail.com>
      Reviewed-by: NAndrew Bresticker <abrestic@chromium.org>
      Cc: <stable@vger.kernel.org> # v3.18+
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b04c846c
  16. 11 3月, 2015 1 次提交
  17. 25 2月, 2015 1 次提交
  18. 25 1月, 2015 2 次提交
  19. 10 1月, 2015 5 次提交