Skip to content

Commit 16fd4a7

Browse files
Xiang Chenmartinkpetersen
authored andcommitted
scsi: hisi_sas: Add device link between SCSI devices and hisi_hba
Runtime PM of SCSI devices is already supported in SCSI layer, we can suspend/resume every SCSI device separately. But if there is no link between hisi_hba and SCSI devices or SCSI targets it will cause issues if the controller is suspended while SCSI devices are still resuming. Only when all the SCSI devices under the controller are suspended, the controller can be suspended. Add the device link between SCSI devices and the controller. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Xiang Chen <[email protected]> Signed-off-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e06596d commit 16fd4a7

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2758,6 +2758,33 @@ static ssize_t intr_coal_count_v3_hw_store(struct device *dev,
27582758
}
27592759
static DEVICE_ATTR_RW(intr_coal_count_v3_hw);
27602760

2761+
static int slave_configure_v3_hw(struct scsi_device *sdev)
2762+
{
2763+
struct Scsi_Host *shost = dev_to_shost(&sdev->sdev_gendev);
2764+
struct domain_device *ddev = sdev_to_domain_dev(sdev);
2765+
struct hisi_hba *hisi_hba = shost_priv(shost);
2766+
struct device *dev = hisi_hba->dev;
2767+
int ret = sas_slave_configure(sdev);
2768+
2769+
if (ret)
2770+
return ret;
2771+
if (!dev_is_sata(ddev))
2772+
sas_change_queue_depth(sdev, 64);
2773+
2774+
if (sdev->type == TYPE_ENCLOSURE)
2775+
return 0;
2776+
2777+
if (!device_link_add(&sdev->sdev_gendev, dev,
2778+
DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE)) {
2779+
if (pm_runtime_enabled(dev)) {
2780+
dev_info(dev, "add device link failed, disable runtime PM for the host\n");
2781+
pm_runtime_disable(dev);
2782+
}
2783+
}
2784+
2785+
return 0;
2786+
}
2787+
27612788
static struct device_attribute *host_attrs_v3_hw[] = {
27622789
&dev_attr_phy_event_threshold,
27632790
&dev_attr_intr_conv_v3_hw,
@@ -3114,7 +3141,7 @@ static struct scsi_host_template sht_v3_hw = {
31143141
.queuecommand = sas_queuecommand,
31153142
.dma_need_drain = ata_scsi_dma_need_drain,
31163143
.target_alloc = sas_target_alloc,
3117-
.slave_configure = hisi_sas_slave_configure,
3144+
.slave_configure = slave_configure_v3_hw,
31183145
.scan_finished = hisi_sas_scan_finished,
31193146
.scan_start = hisi_sas_scan_start,
31203147
.change_queue_depth = sas_change_queue_depth,

0 commit comments

Comments
 (0)