linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* USB/swiotlb failure on arm64/RPi3
@ 2017-01-24 22:52 Aaro Koskinen
  2017-01-25  8:05 ` Stefan Wahren
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Aaro Koskinen @ 2017-01-24 22:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Booting Debian rootfs from USB hard disk (ext4) using 64-bit 4.9 kernel
on Raspberry Pi 3 fails early in the boot as follows:

[   15.162466] systemd[1]: Detected architecture arm64.

Welcome to Debian GNU/Linux 9 (stretch)!

[   15.200822] systemd[1]: Set hostname to <raspberrypi-3>.
[   46.135227] usb 1-1.5: reset high-speed USB device number 4 using dwc2
[   76.844211] usb 1-1.5: reset high-speed USB device number 4 using dwc2
[  105.257888] systemd[1]: system-generators terminated by signal ALRM.
[  108.087234] usb 1-1.5: reset high-speed USB device number 4 using dwc2
[  138.796224] usb 1-1.5: reset high-speed USB device number 4 using dwc2
[  170.039222] usb 1-1.5: reset high-speed USB device number 4 using dwc2
[  201.261222] usb 1-1.5: reset high-speed USB device number 4 using dwc2
[  201.405906] sd 0:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x05 driverbyte=0x00
[  201.414234] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 02 c7 c5 90 00 00 68 00
[  201.421951] blk_update_request: I/O error, dev sda, sector 46646672

Boot hangs and I/O does not recover.

I first suspected the dwc2 driver, but the cause turns out to be DMA
mapping error in usb_hcd_map_urb_for_dma(). This will cause usb_sg_wait()
to loop forever trying to re-try. On RPi3 dma_mapping_error() is:

int
swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
{
	return (dma_addr == phys_to_dma(hwdev, io_tlb_overflow_buffer));
}

On arm64, swiotlb is not initialized by default, so io_tlb_overflow_buffer
is 0. But phys_to_dma(hwdev, 0) should be a valid DMA address and not
be rejected. I tested this by initializing io_tlb_overflow_buffer with
INVALID_PHYS_ADDR, and then the boot passes and system runs fine.

Any ideas how this should be fixed properly?

A.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-01-27  9:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-24 22:52 USB/swiotlb failure on arm64/RPi3 Aaro Koskinen
2017-01-25  8:05 ` Stefan Wahren
2017-01-25 11:28 ` Arnd Bergmann
2017-01-25 12:03 ` [PATCH] arm64: dma-mapping: Fix dma_mapping_error() when bypassing SWIOTLB Robin Murphy
2017-01-25 12:37   ` Michael Zoran
2017-01-25 12:46     ` Robin Murphy
2017-01-25 12:51     ` Arnd Bergmann
2017-01-25 12:54       ` Robin Murphy
2017-01-25 13:35         ` Michael Zoran
2017-01-25 18:31 ` [PATCH v2] " Robin Murphy
2017-01-25 19:14   ` Robin Murphy
2017-01-25 19:31     ` Michael Zoran
2017-01-25 21:49   ` Aaro Koskinen
2017-01-26 12:52   ` Will Deacon
2017-01-26 13:04     ` Michael Zoran
2017-01-26 15:20     ` Robin Murphy
2017-01-26 20:35       ` Aaro Koskinen
2017-01-27  9:53       ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).