linux-stable/drivers/usb/host
Mathias Nyman 576667bad3 xhci: make sure TRB is fully written before giving it to the controller
Once the command ring doorbell is rung the xHC controller will parse all
command TRBs on the command ring that have the cycle bit set properly.

If the driver just started writing the next command TRB to the ring when
hardware finished the previous TRB, then HW might fetch an incomplete TRB
as long as its cycle bit set correctly.

A command TRB is 16 bytes (128 bits) long.
Driver writes the command TRB in four 32 bit chunks, with the chunk
containing the cycle bit last. This does however not guarantee that
chunks actually get written in that order.

This was detected in stress testing when canceling URBs with several
connected USB devices.
Two consecutive "Set TR Dequeue pointer" commands got queued right
after each other, and the second one was only partially written when
the controller parsed it, causing the dequeue pointer to be set
to bogus values. This was seen as error messages:

"Mismatch between completed Set TR Deq Ptr command & xHCI internal state"

Solution is to add a write memory barrier before writing the cycle bit.

Cc: <stable@vger.kernel.org>
Tested-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210115161907.2875631-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-15 17:27:31 +01:00
..
bcma-hcd.c USB: bcma: use module_bcma_driver to simplify the code 2020-09-22 10:37:13 +02:00
ehci-atmel.c
ehci-brcm.c usb: ehci: Add new EHCI driver for Broadcom STB SoC's 2020-05-13 14:28:01 +02:00
ehci-dbg.c usb: host: Use fallthrough pseudo-keyword 2020-07-10 08:55:18 +02:00
ehci-exynos.c usb: host: ehci-exynos: Fix error check in exynos_ehci_probe() 2020-06-18 10:40:57 +02:00
ehci-fsl.c usb: hosts: Remove in_interrupt() from comments 2020-10-28 12:32:12 +01:00
ehci-fsl.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
ehci-grlib.c
ehci-hcd.c ehci: fix EHCI host controller initialization sequence 2021-01-12 17:16:37 +01:00
ehci-hub.c USB: ehci: fix an interrupt calltrace error 2021-01-12 17:24:27 +01:00
ehci-mem.c
ehci-mv.c USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int 2020-05-19 15:11:43 +02:00
ehci-npcm7xx.c usb/host: ehci-npcm7xx: Use pm_ptr() macro 2020-09-04 16:54:47 +02:00
ehci-omap.c usb: ehci-omap: Fix PM disable depth umbalance in ehci_hcd_omap_probe 2020-12-09 14:33:45 +01:00
ehci-orion.c
ehci-pci.c USB: Remove pci-dma-compat wrapper APIs. 2020-07-15 16:48:10 +02:00
ehci-platform.c usb: host: ehci-platform: Add workaround for brcm, xgs-iproc-ehci 2020-09-14 16:45:28 +02:00
ehci-pmcmsp.c USB: host: ehci-pmcmsp: Cleanup usb_hcd_msp_remove() 2020-10-28 12:32:26 +01:00
ehci-ppc-of.c
ehci-ps3.c powerpc/ps3: make system bus's remove and shutdown callbacks return void 2020-12-04 01:01:22 +11:00
ehci-q.c usb: host: Use fallthrough pseudo-keyword 2020-07-10 08:55:18 +02:00
ehci-sched.c usb: host: ehci-sched: add comment about find_tt() not returning error 2020-10-28 12:21:38 +01:00
ehci-sh.c
ehci-spear.c usb/host: ehci-spear: Use pm_ptr() macro 2020-09-04 16:54:45 +02:00
ehci-st.c
ehci-sysfs.c
ehci-tegra.c usb: host: ehci-tegra: Fix error handling in tegra_ehci_probe() 2020-10-28 13:23:07 +01:00
ehci-timer.c
ehci-xilinx-of.c
ehci.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
fhci-dbg.c
fhci-hcd.c
fhci-hub.c
fhci-mem.c
fhci-q.c
fhci-sched.c USB/Thunderbolt patches for 5.9-rc1 2020-08-05 12:13:10 -07:00
fhci-tds.c usb: host: fhci-tds: Remove unused variables 'buf' and 'extra_data' 2020-07-09 17:19:59 +02:00
fhci.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
fotg210-hcd.c usb: fotg210-hcd: remove casting dma_alloc_coherent 2020-12-09 15:25:19 +01:00
fotg210.h
fsl-mph-dr-of.c usb: host: fsl-mph-dr-of: check return of dma_set_mask() 2020-10-28 13:19:31 +01:00
isp116x-hcd.c usb: Fix fall-through warnings for Clang 2020-11-23 17:46:01 +01:00
isp116x.h
isp1362-hcd.c usb: Use fallthrough pseudo-keyword 2020-07-10 08:55:17 +02:00
isp1362.h USB: host: isp1362: delete isp1362_show_regs() 2020-10-28 13:08:22 +01:00
Kconfig usb: host: ehci-mxc: Remove the driver 2020-11-14 00:28:16 +01:00
Makefile usb: host: ehci-mxc: Remove the driver 2020-11-14 00:28:16 +01:00
max3421-hcd.c usb: Fix fall-through warnings for Clang 2020-11-23 17:46:01 +01:00
ohci-at91.c usb: hosts: Remove in_interrupt() from comments 2020-10-28 12:32:12 +01:00
ohci-da8xx.c
ohci-dbg.c
ohci-exynos.c usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe() 2020-08-27 09:25:58 +02:00
ohci-hcd.c usb: fix a few cases of -Wfallthrough 2020-11-13 15:20:52 +01:00
ohci-hub.c usb: fix a few cases of -Wfallthrough 2020-11-13 15:20:52 +01:00
ohci-mem.c
ohci-nxp.c
ohci-omap.c Merge 5.10-rc7 into usb-next 2020-12-07 10:20:51 +01:00
ohci-pci.c USB: OHCI: remove obsolete FIXME comment 2020-06-19 08:58:44 +02:00
ohci-platform.c usb/ohci-platform: Fix a warning when hibernating 2020-05-18 18:15:39 +02:00
ohci-ppc-of.c
ohci-ps3.c powerpc/ps3: make system bus's remove and shutdown callbacks return void 2020-12-04 01:01:22 +11:00
ohci-pxa27x.c usb: hosts: Remove in_interrupt() from comments 2020-10-28 12:32:12 +01:00
ohci-q.c USB: OHCI: Use fallthrough pseudo-keyword 2020-07-10 08:55:18 +02:00
ohci-s3c2410.c usb: hosts: Remove in_interrupt() from comments 2020-10-28 12:32:12 +01:00
ohci-sa1111.c
ohci-sm501.c USB: ohci-sm501: Add missed iounmap() in remove 2020-06-18 10:42:53 +02:00
ohci-spear.c
ohci-st.c
ohci-tmio.c USB: OHCI: Use fallthrough pseudo-keyword 2020-07-10 08:55:18 +02:00
ohci.h usb: host: ohci: Mark cc_to_error as __maybe_unused 2020-07-03 10:18:40 +02:00
oxu210hp-hcd.c usb: oxu210hp-hcd: Fix memory leak in oxu_create 2020-12-09 15:25:21 +01:00
pci-quirks.c usb: pci-quirks: convert to readl_poll_timeout_atomic() 2020-09-25 16:30:05 +02:00
pci-quirks.h
r8a66597-hcd.c usb: host: r8a66597-hcd: Remove set, then over-written, but never used variable 'tmp' 2020-07-09 17:19:57 +02:00
r8a66597.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
sl811-hcd.c usb: host: sl811: Switch to use platform_get_mem_or_io() 2020-12-10 16:31:46 +01:00
sl811.h
sl811_cs.c
ssb-hcd.c
u132-hcd.c USB: host: u123-hcd: remove trailing semicolon in macro definition 2020-12-09 15:24:42 +01:00
uhci-debug.c
uhci-grlib.c
uhci-hcd.c
uhci-hcd.h
uhci-hub.c
uhci-pci.c usb: hci: add hc_driver as argument for usb_hcd_pci_probe 2020-05-15 15:44:34 +02:00
uhci-platform.c
uhci-q.c
xhci-dbg.c
xhci-dbgcap.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
xhci-dbgcap.h xhci: dbc: remove tty specific port structure from struct xhci_dbc 2020-07-23 17:05:29 +02:00
xhci-dbgtty.c usb: xhci: convert tasklets to use new tasklet_setup() API 2020-08-18 13:00:01 +02:00
xhci-debugfs.c usb: xhci: add debugfs support for ep with stream 2020-09-20 16:18:00 +02:00
xhci-debugfs.h usb: xhci: add debugfs support for ep with stream 2020-09-20 16:18:00 +02:00
xhci-ext-caps.c
xhci-ext-caps.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
xhci-histb.c xhci: hisilicon: fix refercence leak in xhci_histb_probe 2020-11-13 14:32:43 +01:00
xhci-hub.c xhci: Give USB2 ports time to enter U3 in bus suspend 2020-12-09 14:32:03 +01:00
xhci-mem.c Merge 5.10-rc2 into usb-next 2020-11-02 10:04:07 +01:00
xhci-mtk-sch.c usb: xhci-mtk: fix the failure of bandwidth allocation 2020-07-21 14:05:49 +02:00
xhci-mtk.c usb: xhci-mtk: Fix typo 2020-08-18 12:12:54 +02:00
xhci-mtk.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
xhci-mvebu.c
xhci-mvebu.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
xhci-pci-renesas.c usb: renesas-xhci: remove version check 2020-08-18 11:55:23 +02:00
xhci-pci.c xhci-pci: Allow host runtime PM as default for Intel Maple Ridge xHCI 2020-12-09 14:32:03 +01:00
xhci-pci.h usb: xhci: make symbols static 2020-05-19 14:11:55 +02:00
xhci-plat.c usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK 2020-12-09 14:32:00 +01:00
xhci-plat.h usb: host: xhci-plat: add .suspend_quirk for struct xhci_plat_priv 2020-09-20 16:18:00 +02:00
xhci-rcar.c usb: xhci-rcar: convert to readl_poll_timeout_atomic() 2020-09-25 16:30:05 +02:00
xhci-rcar.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
xhci-ring.c xhci: make sure TRB is fully written before giving it to the controller 2021-01-15 17:27:31 +01:00
xhci-tegra.c Linux 5.9-rc3 2020-08-31 07:11:45 +02:00
xhci-trace.c
xhci-trace.h USB: host: Use the correct style for SPDX License Identifier 2020-04-16 14:32:46 +02:00
xhci.c USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set 2020-12-28 15:44:32 +01:00
xhci.h usb: xhci: Use temporary buffer to consolidate SG 2020-12-09 14:32:03 +01:00