Commit 6cc68b05 authored by Jens Axboe's avatar Jens Axboe

[PATCH] fix SCSI bounce limit

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: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent d3654227
......@@ -1327,19 +1327,22 @@ static void scsi_request_fn(struct request_queue *q)
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment