scsi_lib: use correct DMA device in __scsi_alloc_queue
PATCH 1/1 scsi_lib: use correct DMA device in __scsi_alloc_queue
Currently, __scsi_alloc_queue uses SCSI host's parent device as DMA device to set segment boundary. But the parent device may not refer to the DMA device. For example, for ATA disk, SCSI host's parent device now refers to ATA port.
Since commit d139b9b([SCSI] scsi_lib_dma: fix bug with dma maps on nested scsi objects), a new field Scsi_Host->dma_device was introduced to refer to the real DMA device.
Use ->dma_device in __scsi_alloc_queue to correctly set segment boundary.
And use scsi_add_host_with_dma in ata_scsi_add_hosts to pass in the correct DMA device.
Bug report: http://marc.info/?l=linux-ide&m=133177818318187&w=2
--- drivers/ata/libata-scsi.c | 3 ++- drivers/scsi/scsi_lib.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +2 -1
@@ -3398,7 +3398,8 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)*/ shost->max_host_blocked =1 ; - rc =scsi_add_host (ap->scsi_host, &ap->tdev); + rc =scsi_add_host_with_dma (ap->scsi_host, + &ap->tdev, ap->host->dev);if (rc) goto err_add; }
drivers/scsi/scsi_lib.c +1 -1
@@ -1642,7 +1642,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, request_fn_proc *request_fn) {struct request_queue *q; -struct device *dev = shost->shost_gendev.parent; +struct device *dev = shost->dma_dev; q =blk_init_queue (request_fn,NULL );if (!q)
Signature · 1 line
1.7.2.5
Hello.
Quoted 7 lines · Lin Ming
Currently,
__scsi_alloc_queueuses SCSI host's parent device as DMA device to set segment boundary. But the parent device may not refer to the DMA device. For example, for ATA disk, SCSI host's parent device now refers to ATA port.Since commit
d139b9b([SCSI] scsi_lib_dma: fix bug with dma maps on nested scsi objects), a new fieldScsi_Host->dma_devicewas introduced
Only the field is named 'dma_dev', isn't it?
Quoted 7 lines
to refer to the real DMA device.
Use ->dma_device in
__scsi_alloc_queueto correctly set segment boundary.And use
scsi_add_host_with_dmainata_scsi_add_hoststo pass in the correct DMA device.
Perhaps this should be split into two patches.
Quoted 4 lines
Bug report: http://marc.info/?l=linux-ide&m=133177818318187&w=2
Reported-and-tested-by Jörg Sommer<[email protected]>Signed-off-by Lin Ming<[email protected]>
[...]
drivers/scsi/scsi_lib.c struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, · line 1648
Quoted 13 lines
drivers/scsi/scsi_lib.c +1
-1@@ -1642,7 +1642,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, request_fn_proc *request_fn) {struct request_queue *q; -struct device *dev = shost->shost_gendev.parent; +struct device *dev = shost->dma_dev; q =blk_init_queue (request_fn,NULL );if (!q)
WBR, Sergei
Quoted 11 lines · Sergei Shtylyov
Hello.
Quoted 4 lines · Lin Ming
Currently,
__scsi_alloc_queueuses SCSI host's parent device as DMA device to set segment boundary. But the parent device may not refer to the DMA device. For example, for ATA disk, SCSI host's parent device now refers to ATA port.
Quoted 5 lines
Quoted 2 lines
Since commit
d139b9b([SCSI] scsi_lib_dma: fix bug with dma maps on nested scsi objects), a new fieldScsi_Host->dma_devicewas introducedOnly the field is named '
dma_dev', isn't it?
Yes, my typo.
Quoted 9 lines
Quoted 7 lines
to refer to the real DMA device.
Use ->dma_device in
__scsi_alloc_queueto correctly set segment boundary.
Quoted 5 lines
Quoted 2 lines
And use
scsi_add_host_with_dmainata_scsi_add_hoststo pass in the correct DMA device.Perhaps this should be split into two patches.
Good idea.
Will split and resend.
Thanks,
Lin Ming
Quoted 23 lines
Quoted 7 lines
Bug report: http://marc.info/?l=linux-ide&m=133177818318187&w=2
Reported-and-tested-by Jörg Sommer<[email protected]>Signed-off-by Lin Ming<[email protected]>[...]
Quoted 12 lines
drivers/scsi/scsi_lib.c +1
-1@@ -1642,7 +1642,7 @@ struct request_queue *__scsi_alloc_queue(structScsi_Host *shost, request_fn_proc *request_fn) { struct request_queue *q; - struct device *dev = shost->shost_gendev.parent; + struct device *dev = shost->dma_dev;
Quoted 6 lines
Quoted 2 lines
drivers/scsi/scsi_lib.c +0
-0q = blk_init_queue(request_fn, NULL);if (!q)
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html