scsi: hisi_sas: add host reset interface for test
authorXiang Chen <chenxiang66@hisilicon.com>
Thu, 11 Apr 2019 12:46:36 +0000 (20:46 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 13 Apr 2019 01:30:11 +0000 (21:30 -0400)
Add host reset interface to make it easier for testing the host reset
feature.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

index 14bac4966c87bf0e8bc601fc3c4e7afb0eb1cec8..a1eaddcf740dc41c270be7a809eb5528ba45c0db 100644 (file)
@@ -2234,6 +2234,19 @@ void hisi_sas_kill_tasklets(struct hisi_hba *hisi_hba)
 }
 EXPORT_SYMBOL_GPL(hisi_sas_kill_tasklets);
 
+int hisi_sas_host_reset(struct Scsi_Host *shost, int reset_type)
+{
+       struct hisi_hba *hisi_hba = shost_priv(shost);
+
+       if (reset_type != SCSI_ADAPTER_RESET)
+               return -EOPNOTSUPP;
+
+       queue_work(hisi_hba->wq, &hisi_hba->rst_work);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(hisi_sas_host_reset);
+
 struct scsi_transport_template *hisi_sas_stt;
 EXPORT_SYMBOL_GPL(hisi_sas_stt);
 
index 2938074434802d7a034951ce9cededf3451beef8..078ddd3871f2e0f634b7dac164f1dcbc51595efd 100644 (file)
@@ -1823,6 +1823,7 @@ static struct scsi_host_template sht_v1_hw = {
        .target_destroy         = sas_target_destroy,
        .ioctl                  = sas_ioctl,
        .shost_attrs            = host_attrs_v1_hw,
+       .host_reset             = hisi_sas_host_reset,
 };
 
 static const struct hisi_sas_hw hisi_sas_v1_hw = {
index 89160ab3efb05648dc6a7b23acd8a45e87ca61a6..33b72c7f72c59e64158c7f0485f396f08fcbe353 100644 (file)
@@ -3599,6 +3599,7 @@ static struct scsi_host_template sht_v2_hw = {
        .target_destroy         = sas_target_destroy,
        .ioctl                  = sas_ioctl,
        .shost_attrs            = host_attrs_v2_hw,
+       .host_reset             = hisi_sas_host_reset,
 };
 
 static const struct hisi_sas_hw hisi_sas_v2_hw = {
index 086695a4099fc13bd4c555309c5a7bffe6a18e82..e8323d038d530c4f68eb8cf4342872d7d67c78ba 100644 (file)
@@ -2678,6 +2678,7 @@ static struct scsi_host_template sht_v3_hw = {
        .ioctl                  = sas_ioctl,
        .shost_attrs            = host_attrs_v3_hw,
        .tag_alloc_policy       = BLK_TAG_ALLOC_RR,
+       .host_reset             = hisi_sas_host_reset,
 };
 
 static const struct hisi_sas_hw hisi_sas_v3_hw = {