fix SCSI bounce limit
PATCH 1/1 fix SCSI bounce limit
Hi,
Just had a case with a gdth adapter not working in a 16GB box. Seems to me that the SCSI bounce decision is completely screwy - it returns the device dma mask, if it is set only and the box doesn't have an iommu. So if we can't get the mask, we allow any io. Not so good. I think the logic should be more as follows:
if (isa) return bounce_above_isa; if (has_iommu) return bounce_nothing; if (we_know_device_dma_mask) return mask; else return default_to_32bit;
Patch corrects scsi_calculate_bounce_limit() to actually work partly sanely.
Signed-off-by Jens Axboe <[email protected]>
===== drivers/scsi/scsi_lib.c 1.137 vs edited =====
drivers/scsi/scsi_lib.c +9 -6
@@ -1326,19 +1326,22 @@u64 scsi_calculate_bounce_limit (struct Scsi_Host *shost) {struct device *host_dev; +u64 bounce_limit =0xffffffff ;if (shost->unchecked_isa_dma)return BLK_BOUNCE_ISA ; - - host_dev =scsi_get_device (shost); -if (PCI_DMA_BUS_IS_PHYS && host_dev && host_dev->dma_mask) -return *host_dev->dma_mask; -/* * Platforms with virtual-DMA translation * hardware have no practical limit. */ -return BLK_BOUNCE_ANY ; +if (!PCI_DMA_BUS_IS_PHYS ) +return BLK_BOUNCE_ANY ; + + host_dev =scsi_get_device (shost); +if (host_dev && host_dev->dma_mask) + bounce_limit = *host_dev->dma_mask; + +return bounce_limit; }struct request_queue *scsi_alloc_queue (struct scsi_device *sdev)
Signature · 1 line
Jens Axboe