diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-11-15 04:04:31 -0500 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2014-03-04 18:38:26 -0500 |
commit | 37599f9603bed3d72becdc1a59c164576df9fbfc (patch) | |
tree | ebb571b8a52b0c708d889609a50e09b4897f204c | |
parent | 8e453155d7f8dfa53863ba6f8da6c68f7c17ece4 (diff) |
uas: Make sure sg elements are properly aligned
Copy the sg alignment trick from the usb-storage driver, without this I'm
seeing intermittent errors when using uas devices with an ehci controller.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
-rw-r--r-- | drivers/usb/storage/uas.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 62086829af14..ad97615b75b1 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -925,6 +925,24 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd) | |||
925 | static int uas_slave_alloc(struct scsi_device *sdev) | 925 | static int uas_slave_alloc(struct scsi_device *sdev) |
926 | { | 926 | { |
927 | sdev->hostdata = (void *)sdev->host->hostdata; | 927 | sdev->hostdata = (void *)sdev->host->hostdata; |
928 | |||
929 | /* USB has unusual DMA-alignment requirements: Although the | ||
930 | * starting address of each scatter-gather element doesn't matter, | ||
931 | * the length of each element except the last must be divisible | ||
932 | * by the Bulk maxpacket value. There's currently no way to | ||
933 | * express this by block-layer constraints, so we'll cop out | ||
934 | * and simply require addresses to be aligned at 512-byte | ||
935 | * boundaries. This is okay since most block I/O involves | ||
936 | * hardware sectors that are multiples of 512 bytes in length, | ||
937 | * and since host controllers up through USB 2.0 have maxpacket | ||
938 | * values no larger than 512. | ||
939 | * | ||
940 | * But it doesn't suffice for Wireless USB, where Bulk maxpacket | ||
941 | * values can be as large as 2048. To make that work properly | ||
942 | * will require changes to the block layer. | ||
943 | */ | ||
944 | blk_queue_update_dma_alignment(sdev->request_queue, (512 - 1)); | ||
945 | |||
928 | return 0; | 946 | return 0; |
929 | } | 947 | } |
930 | 948 | ||