usb: xhci: add VLI_SS_BULK_OUT_BUG quirk
authorJonathan Bell <jonathan@raspberrypi.com>
Thu, 8 Sep 2022 14:50:15 +0000 (15:50 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 19 Feb 2024 11:33:37 +0000 (11:33 +0000)
commit7bddeafb5f330de1200590514218bff0022b7aa6
treeb3d0d3a77ebbadd20df1896ddaaa3abf3cd9169c
parentce46110d1b4fbd49a17ad58e273857d604f22811
usb: xhci: add VLI_SS_BULK_OUT_BUG quirk

The VL805 can cause data corruption if a SS Bulk OUT endpoint enters a
flow-control condition and there are TRBs in the transfer ring that are
not an integral size of wMaxPacket and the endpoint is behind one or more
hubs.

This is frequently the case encountered when FAT32 filesystems are
present on mass-storage devices with cluster sizes of 1 sector, and the
filesystem is being written to with an aggregate of small files.

The initial implementation of this quirk separated TRBs that didn't
adhere to this limitation into two - the first a multiple of wMaxPacket
and the second the 512-byte remainder - in an attempt to force TD
fragments to align with packet boundaries. This reduced the incidence
rate of data corruption but did not resolve it.

The fix as recommended by VIA is to disable bursts if this sequence of
TRBs can occur.

Limit turning off bursts to just USB mass-storage devices by searching
the device's configuration for an interface with a class type of
USB_CLASS_MASS_STORAGE.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci.h