Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: core: take the DMA max mapping size into account

We need to limit the device's max_sectors to what the DMA mapping
implementation can support. If not, we risk running out of swiotlb
buffers easily.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Christoph Hellwig and committed by
Martin K. Petersen
bdd17bde 7ad388d8

+2
+2
drivers/scsi/scsi_lib.c
··· 1784 1784 blk_queue_max_integrity_segments(q, shost->sg_prot_tablesize); 1785 1785 } 1786 1786 1787 + shost->max_sectors = min_t(unsigned int, shost->max_sectors, 1788 + dma_max_mapping_size(dev) << SECTOR_SHIFT); 1787 1789 blk_queue_max_hw_sectors(q, shost->max_sectors); 1788 1790 if (shost->unchecked_isa_dma) 1789 1791 blk_queue_bounce_limit(q, BLK_BOUNCE_ISA);