On 10.10.2017 12:41, David Laight wrote:
From: Robin Murphy
Sent: 09 October 2017 18:39
...
  - without the IOMMU, block sizes >=128K all settle down into a
    suspiciously-periodic error every 2048 sectors.

That stinks of being a problem where either the link TRB is part
way through a USB packet or where a buffer fragment crosses
a 64k boundary.

Neither is allowed.


Those should be taken care of by the xhci driver already

xhci_align_td() should make sure the link TRB is at packet boundary, and
TRB_BUFF_LEN_UP_TO_BOUNDARY(addr) in xhci_queue_bulk_tx() should prevent
crossing 64k boundary in a TRB when queuing it.

more traces and logs of the VIA xhci controller could maybe tell something.

with the latest kernel:

echo 81920 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/xhci-hcd/enable
after failure:
cat /sys/kernel/debug/tracing/trace

The debug output from Robin shows URB asked 196808 bytes but gets exactly 64k, 
then stalls.
we then skip this TD to the next (TD is exactly 7 TRBs (7 * 16bytes) in this 
case, and continue the
same way.
so we keep jumping and stalling x70 bytes on the ring :

[  427.959235] xhci_hcd 0000:04:00.0: New dequeue pointer = 0xff0b0c40 (DMA)
[  428.083240] xhci_hcd 0000:04:00.0: New dequeue pointer = 0xff0b0cb0 (DMA)
[  428.207238] xhci_hcd 0000:04:00.0: New dequeue pointer = 0xff0b0d20 (DMA)
[  428.331237] xhci_hcd 0000:04:00.0: New dequeue pointer = 0xff0b0d90 (DMA)
...
[  428.409645] print_req_error: I/O error, dev sdb, sector 128
[  428.426612] arm-smmu 2b500000.iommu: Unhandled context fault: fsr=0x8, 
iova=0xff0b1000, fsynr=0x183, cb=0

a ring segment is 256 TRBS, each *16 bytes, that ring last TRB should be at 
0xff0b0ff0

If the adm-smmu iova 0xff0b1000 means something is poking that DMA address
it's ring after that ring.

-Mathias





--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to