diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-07-30 11:42:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-07-30 11:42:27 -0400 |
commit | 3ac52d0d219d5d973601c52e215f0e922b2b2d49 (patch) | |
tree | bf6754e2aefc89998236c0a7dd7ead295d31f0d4 /drivers/usb/storage/scsiglue.c | |
parent | a8f910ec66583bfb61558c3f333195b3960d832d (diff) | |
parent | 609488bc979f99f805f34e9a32c1e3b71179d10b (diff) |
Merge tag 'v5.3-rc2' into patchwork
Linux 5.3-rc2
* tag 'v5.3-rc2': (342 commits)
Linux 5.3-rc2
kbuild: remove unused single-used-m
gen_compile_commands: lower the entry count threshold
.gitignore: Add compilation database file
kbuild: remove unused objectify macro
dt-bindings: Fix more $id value mismatches filenames
dt-bindings: nvmem: SID: Fix the examples node names
dt-bindings: nvmem: Add YAML schemas for the generic NVMEM bindings
of: Fix typo in kerneldoc
block: fix max segment size handling in blk_queue_virt_boundary
docs: phy: Drop duplicate 'be made'
fix the struct mount leak in umount_tree()
MAINTAINERS: vfio-ccw: Remove myself as the maintainer
s390/mm: use shared variables for sysctl range check
virtio/s390: fix race on airq_areas[]
s390/dma: provide proper ARCH_ZONE_DMA_BITS value
btrfs: fix extent_state leak in btrfs_lock_and_flush_ordered_range
Makefile: Globally enable fall-through warning
drm/i915: Mark expected switch fall-throughs
drm/amd/display: Mark expected switch fall-throughs
...
Diffstat (limited to 'drivers/usb/storage/scsiglue.c')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 30790240aec6..05b80211290d 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -28,6 +28,8 @@ * status of a command. */ +#include <linux/blkdev.h> +#include <linux/dma-mapping.h> #include <linux/module.h> #include <linux/mutex.h> @@ -99,6 +101,7 @@ static int slave_alloc (struct scsi_device *sdev) static int slave_configure(struct scsi_device *sdev) { struct us_data *us = host_to_us(sdev->host); + struct device *dev = us->pusb_dev->bus->sysdev; /* * Many devices have trouble transferring more than 32KB at a time, @@ -129,6 +132,14 @@ static int slave_configure(struct scsi_device *sdev) } /* + * The max_hw_sectors should be up to maximum size of a mapping for + * the device. Otherwise, a DMA API might fail on swiotlb environment. + */ + blk_queue_max_hw_sectors(sdev->request_queue, + min_t(size_t, queue_max_hw_sectors(sdev->request_queue), + dma_max_mapping_size(dev) >> SECTOR_SHIFT)); + + /* * Some USB host controllers can't do DMA; they have to use PIO. * They indicate this by setting their dma_mask to NULL. For * such controllers we need to make sure the block layer sets |