scsi: hisi_sas: Wait for phyup in hisi_sas_control_phy()
authorXiang Chen <chenxiang66@hisilicon.com>
Tue, 12 Oct 2021 12:26:26 +0000 (20:26 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 13 Oct 2021 02:46:06 +0000 (22:46 -0400)
commit046ab7d0f5943dd74c351e1f3a771dea785fe25d
treee82b2b5bf30776bc574fcbd4d4d4f31e9f8acc86
parent36c6b7613ef1ffd88637315f11c71896f3ce4856
scsi: hisi_sas: Wait for phyup in hisi_sas_control_phy()

When issuing a hardreset/linkreset/phy_set_linkrate from sysfs, the phy
will be disabled and re-enabled for the directly attached scenario.

It takes some time for the phy to come back up after re-enabling the phy.
If the controller becomes suspended while waiting for the phy to come back,
the phy up may be lost (along with the disk).

To solve this problem, wait for the phy up to occur with a timeout. Indeed
this is already done in hisi_sas_debug_I_T_nexus_reset() for local phys, so
just relocate the functionality to hisi_sas_control_phy().

Since the HA workqueue is drained when suspending the controller, and the
phy control function is called from the same workqueue, we can guarantee
that the controller will not be suspended during this period.

Link: https://lore.kernel.org/r/1634041588-74824-3-git-send-email-john.garry@huawei.com
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