summaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-08-22 06:56:31 +0200
committerChristoph Hellwig <hch@lst.de>2024-08-29 07:22:12 +0300
commitb5a73bf4d1de95e620bf5f592557b81f71c76f0e (patch)
treeccd96b9293be16fb7fe882213e22898c456c092e /drivers/scsi
parent833bd284a45448f04ab9fcd4fdf7ef594d458eed (diff)
scsi: check that busses support the DMA API before setting dma parameters
We'll start throwing warnings soon when dma_set_seg_boundary and dma_set_max_seg_size are called on devices for buses that don't fully support the DMA API. Prepare for that by making the calls in the SCSI midlayer conditional. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3958a6d14bf4..7f0394c44920 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1988,8 +1988,15 @@ void scsi_init_limits(struct Scsi_Host *shost, struct queue_limits *lim)
if (shost->no_highmem)
lim->features |= BLK_FEAT_BOUNCE_HIGH;
- dma_set_seg_boundary(dev, shost->dma_boundary);
- dma_set_max_seg_size(dev, shost->max_segment_size);
+ /*
+ * Propagate the DMA formation properties to the dma-mapping layer as
+ * a courtesy service to the LLDDs. This needs to check that the buses
+ * actually support the DMA API first, though.
+ */
+ if (dev->dma_parms) {
+ dma_set_seg_boundary(dev, shost->dma_boundary);
+ dma_set_max_seg_size(dev, shost->max_segment_size);
+ }
}
EXPORT_SYMBOL_GPL(scsi_init_limits);