WSL2-Linux-Kernel/drivers/usb
Weitao Wang 7596c4576a USB: Fix xhci event ring dequeue pointer ERDP update issue
[ Upstream commit e91ac20889 ]

In some situations software handles TRB events slower than adding TRBs.
If the number of TRB events to be processed in a given interrupt is exactly
the same as the event ring size 256, then the local variable
"event_ring_deq" that holds the initial dequeue position is equal to
software_dequeue after handling all 256 interrupts.

It will cause driver to not update ERDP to hardware,

Software dequeue pointer is out of sync with ERDP on interrupt exit.
On the next interrupt, the event ring may full but driver will not
update ERDP as software_dequeue is equal to ERDP.

[  536.377115] xhci_hcd 0000:00:12.0: ERROR unknown event type 37
[  566.933173] sd 8:0:0:0: [sdb] tag#27 uas_eh_abort_handler 0 uas-tag 7 inflight: CMD OUT
[  566.933181] sd 8:0:0:0: [sdb] tag#27 CDB: Write(10) 2a 00 17 71 e6 78 00 00 08 00
[  572.041186] xhci_hcd On some situataions,the0000:00:12.0: xHCI host not responding to stop endpoint command.
[  572.057193] xhci_hcd 0000:00:12.0: Host halt failed, -110
[  572.057196] xhci_hcd 0000:00:12.0: xHCI host controller not responding, assume dead
[  572.057236] sd 8:0:0:0: [sdb] tag#26 uas_eh_abort_handler 0 uas-tag 6 inflight: CMD
[  572.057240] sd 8:0:0:0: [sdb] tag#26 CDB: Write(10) 2a 00 38 eb cc d8 00 00 08 00
[  572.057244] sd 8:0:0:0: [sdb] tag#25 uas_eh_abort_handler 0 uas-tag 5 inflight: CMD

Hardware ERDP is updated mid event handling if there are more than 128
events in an interrupt (half of ring size).
Fix this by updating the software local variable at the same time as
hardware ERDP.

[commit message rewording -Mathias]

Fixes: dc0ffbea57 ("usb: host: xhci: update event ring dequeue pointer on purpose")
Reviewed-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20220408134823.2527272-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-05-09 09:14:32 +02:00
..
atm
c67x00
cdns3 usb: cdns3: Fix issue for clear halt endpoint 2022-05-09 09:14:29 +02:00
chipidea usb: chipidea: ci_hdrc_imx: fix potential error pointer dereference in probe 2021-12-01 09:04:40 +01:00
class usb: usbtmc: Fix bug in pipe direction for control transfers 2022-03-23 09:16:43 +01:00
common usb: ulpi: Call of_node_put correctly 2022-02-16 12:56:34 +01:00
core usb: core: Don't hold the device lock while sleeping in do_proc_control() 2022-05-09 09:14:28 +02:00
dwc2 usb: dwc2: drd: fix soft connect when gadget is unconfigured 2022-03-02 11:48:05 +01:00
dwc3 usb: dwc3: pci: add support for the Intel Meteor Lake-P 2022-05-09 09:14:29 +02:00
early Revert "usb: early: convert to readl_poll_timeout_atomic()" 2021-12-22 09:32:45 +01:00
gadget usb: gadget: configfs: clear deactivation flag in configfs_composite_unbind() 2022-05-09 09:14:29 +02:00
host USB: Fix xhci event ring dequeue pointer ERDP update issue 2022-05-09 09:14:32 +02:00
image
isp1760 usb: isp1760: otg control register access 2021-08-27 16:11:39 +02:00
misc usb: misc: fix improper handling of refcount in uss720_probe() 2022-05-09 09:14:28 +02:00
mon
mtu3 usb: mtu3: fix USB 3.0 dual-role-switch from device to host 2022-05-09 09:14:27 +02:00
musb usb: musb: tusb6010: check return value after calling platform_get_resource() 2021-11-25 09:48:25 +01:00
phy usb: phy: generic: Get the vbus supply 2022-05-09 09:14:29 +02:00
renesas_usbhs usb: renesas_usbhs: Fix spelling mistake "faile" -> "failed" 2021-08-27 10:29:32 +02:00
roles
serial USB: serial: option: add Telit 0x1057, 0x1058, 0x1075 compositions 2022-05-09 09:14:27 +02:00
storage USB: storage: ums-realtek: fix error code in rts51x_read_mem() 2022-04-08 14:23:40 +02:00
typec usb: typec: ucsi: Fix role swapping 2022-05-09 09:14:28 +02:00
usbip usbip:vhci_hcd USB port can get stuck in the disabled state 2021-08-26 13:29:27 +02:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile usb: host: remove line for obsolete config USB_HWA_HCD 2021-08-18 15:32:19 +02:00
usb-skeleton.c