Skip to content

Commit fce54ed

Browse files
John Garrymartinkpetersen
authored andcommitted
scsi: hisi_sas: Limit max hw sectors for v3 HW
If the controller is behind an IOMMU then the IOMMU IOVA caching range can affect performance, as discussed in [0]. Limit the max HW sectors to not exceed this limit. We need to hardcode the value until a proper DMA mapping API is available. [0] https://lore.kernel.org/linux-iommu/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent aeaadcd commit fce54ed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,6 +2782,7 @@ static int slave_configure_v3_hw(struct scsi_device *sdev)
27822782
struct hisi_hba *hisi_hba = shost_priv(shost);
27832783
struct device *dev = hisi_hba->dev;
27842784
int ret = sas_slave_configure(sdev);
2785+
unsigned int max_sectors;
27852786

27862787
if (ret)
27872788
return ret;
@@ -2799,6 +2800,12 @@ static int slave_configure_v3_hw(struct scsi_device *sdev)
27992800
}
28002801
}
28012802

2803+
/* Set according to IOMMU IOVA caching limit */
2804+
max_sectors = min_t(size_t, queue_max_hw_sectors(sdev->request_queue),
2805+
(PAGE_SIZE * 32) >> SECTOR_SHIFT);
2806+
2807+
blk_queue_max_hw_sectors(sdev->request_queue, max_sectors);
2808+
28022809
return 0;
28032810
}
28042811

0 commit comments

Comments
 (0)