FYI: RPi4B's and such: VLI_SS_BULK_OUT_BUG quirk handling vs. VL805 (linux example)

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 17 Sep 2022 16:09:10 UTC
https://github.com/raspberrypi/linux/pull/5173 reports:

QUOTE
After several months back-and-forth with VIA, we have a candidate root-cause for #4844 and a suggested fix. My known-bad pendrive now gets written to endlessly without suffering data corruption.
END QUOTE

and:

QUOTE
usb: xhci: expand mitigations for VLI_SS_BULK_OUT_BUG quirk … c9e051a

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>
END QUOTE

and the drivers/usb/host/xhci-mem.c change has the comments:


	/*
	 * VL805 errata - Bulk OUT bursts to superspeed mass-storage
	 * devices behind hub ports can cause data corruption with
	 * non-wMaxPacket-multiple transfers.
	 */
. . .

		/*
		 * Slight hack - look at interface altsetting 0, which
		 * should be the UMS bulk-only interface. If the class
		 * matches, then we disable out bursts for all OUT
		 * endpoints because endpoint assignments may change
		 * between alternate settings.
		 */

===
Mark Millard
marklmi at yahoo.com