[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240824034925.1163244-2-hch@lst.de>
Date: Sat, 24 Aug 2024 05:49:12 +0200
From: Christoph Hellwig <hch@....de>
To: iommu@...ts.linux.dev
Cc: "Martin K. Petersen" <martin.petersen@...cle.com>,
Robin Murphy <robin.murphy@....com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
dmaengine@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
linux-media@...r.kernel.org,
linux-mmc@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-hyperv@...r.kernel.org,
netdev@...r.kernel.org
Subject: [PATCH 1/4] 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@....de>
---
drivers/scsi/scsi_lib.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3958a6d14bf457..7f0394c4492033 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);
--
2.43.0
Powered by blists - more mailing lists