diff options
| author | Christoph Hellwig <[email protected]> | 2024-04-09 14:37:32 +0000 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2024-04-12 01:37:48 +0000 |
| commit | 5b7dfbeff92a4a00b55b2be580f057d533b65cd5 (patch) | |
| tree | 9e21994f89ae622706edf982c50d876ea7891216 /drivers/scsi/scsi_lib.c | |
| parent | scsi: core: Add a no_highmem flag to struct Scsi_Host (diff) | |
| download | kernel-5b7dfbeff92a4a00b55b2be580f057d533b65cd5.tar.gz kernel-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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Bart Van Assche <[email protected]>
Reviewed-by: John Garry <[email protected]>
Reviewed-by: Damien Le Moal <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 11 |
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; |
