summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-04-09 16:37:32 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2024-04-12 03:37:48 +0200
commit5b7dfbeff92a4a00b55b2be580f057d533b65cd5 (patch)
tree9e21994f89ae622706edf982c50d876ea7891216 /drivers/scsi/scsi_lib.c
parentscsi: core: Add a no_highmem flag to struct Scsi_Host (diff)
downloadlinux-5b7dfbeff92a4a00b55b2be580f057d533b65cd5.tar.xz
linux-5b7dfbeff92a4a00b55b2be580f057d533b65cd5.zip
scsi: core: Add a dma_alignment field to the host and host template
Get drivers out of the business of having to call the block layer DMA alignment limits helpers themselves. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20240409143748.980206-8-hch@lst.de Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f1936f98abe3..26b51406c477 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1985,15 +1985,8 @@ void scsi_init_limits(struct Scsi_Host *shost, struct queue_limits *lim)
lim->seg_boundary_mask = shost->dma_boundary;
lim->max_segment_size = shost->max_segment_size;
lim->virt_boundary_mask = shost->virt_boundary_mask;
-
- /*
- * Set a reasonable default alignment: The larger of 32-byte (dword),
- * which is a common minimum for HBAs, and the minimum DMA alignment,
- * which is set by the platform.
- *
- * Devices that require a bigger alignment can increase it later.
- */
- lim->dma_alignment = max(4, dma_get_cache_alignment()) - 1;
+ lim->dma_alignment = max_t(unsigned int,
+ shost->dma_alignment, dma_get_cache_alignment() - 1);
if (shost->no_highmem)
lim->bounce = BLK_BOUNCE_HIGH;