linux/drivers/usb/storage
Yoshihiro Shimoda d74ffae8b8 usb-storage: Add a limitation for blk_queue_max_hw_sectors()
This patch fixes an issue that the following error happens on
swiotlb environment:

	xhci-hcd ee000000.usb: swiotlb buffer is full (sz: 524288 bytes), total 32768 (slots), used 1338 (slots)

On the kernel v5.1, block settings of a usb-storage with SuperSpeed
were the following so that the block layer will allocate buffers
up to 64 KiB, and then the issue didn't happen.

	max_segment_size = 65536
	max_hw_sectors_kb = 1024

After the commit 09324d32d2 ("block: force an unlimited segment
size on queues with a virt boundary") is applied, the block settings
are the following. So, the block layer will allocate buffers up to
1024 KiB, and then the issue happens:

	max_segment_size = 4294967295
	max_hw_sectors_kb = 1024

To fix the issue, the usb-storage driver checks the maximum size of
a mapping for the device and then adjusts the max_hw_sectors_kb
if required. After this patch is applied, the block settings will
be the following, and then the issue doesn't happen.

	max_segment_size = 4294967295
	max_hw_sectors_kb = 256

Fixes: 09324d32d2 ("block: force an unlimited segment size on queues with a virt boundary")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/1563793105-20597-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-25 10:40:02 +02:00
..
alauda.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
cypress_atacb.c USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
datafab.c USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
debug.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
debug.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
ene_ub6250.c USB: ene_usb6250: add missing indentation 2018-11-23 16:13:14 +01:00
freecom.c usb: storage: Replace mdelay with msleep in init_freecom 2018-04-22 15:49:42 +02:00
initializers.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
initializers.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
isd200.c USB: STORAGE: ISD200 Fixed coding style issue "space required in for loop" 2018-09-20 15:10:29 +02:00
jumpshot.c USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
karma.c USB: storage: karma: add whitespace after declarations 2019-01-22 09:08:17 +01:00
Kconfig USB: add missing SPDX lines to Kconfig and Makefiles 2019-01-22 09:08:17 +01:00
Makefile treewide: prefix header search paths with $(srctree)/ 2019-05-18 11:49:57 +09:00
onetouch.c USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
option_ms.c USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
option_ms.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
protocol.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
protocol.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
realtek_cr.c USB: core: Fix bug caused by duplicate interface PM usage counter 2019-04-19 21:15:13 +02:00
scsiglue.c usb-storage: Add a limitation for blk_queue_max_hw_sectors() 2019-07-25 10:40:02 +02:00
scsiglue.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
sddr09.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
sddr55.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
shuttle_usbat.c USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
sierra_ms.c usb: sierra: fix a missing check of device_create_file 2019-03-26 16:42:52 +09:00
sierra_ms.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
transport.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
transport.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
uas-detect.h uas: Always apply US_FL_NO_ATA_1X quirk to Seagate devices 2017-11-28 15:17:49 +01:00
uas.c UAS: fix alignment of scatter/gather segments 2019-04-30 17:51:42 +02:00
unusual_alauda.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_cypress.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_datafab.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_devs.h USB: storage: add quirk for SMI SM3350 2019-01-07 17:23:30 +01:00
unusual_ene_ub6250.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_freecom.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_isd200.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_jumpshot.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_karma.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_onetouch.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_realtek.h USB: usb-storage: Add new ID to ums-realtek 2019-06-05 11:52:42 +02:00
unusual_sddr09.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_sddr55.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
unusual_uas.h usb-storage: Add compatibility quirk flags for G-Technologies G-Drive 2018-05-24 18:19:39 +02:00
unusual_usbat.h USB: storage: Remove redundant license text 2017-11-04 11:55:38 +01:00
usb.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
usb.h USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00
usual-tables.c USB: storage: remove invalid URL from drivers 2018-01-23 10:22:34 +01:00