Commit 2feb38ea authored by Yihang Li's avatar Yihang Li Committed by xia-bing1
Browse files

scsi: hisi_sas: Enable all PHYs that are not disabled by user during controller reset

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB5FF2


CVE: NA

---------------------------------------------------------------------

For the controller reset operation(such as FLR or clear nexus ha in SCSI
EH), we will disable all PHYs and then enable PHY based on the
hisi_hba->phy_state obtained in hisi_sas_controller_reset_prepare(). If
the device is removed before controller reset or the PHY is not attached
to any device in directly attached scenario, the corresponding bit of
phy_state is not set. After controller reset done, the PHY is disabled.
The device cannot be identified even if user reconnect the disk.

Therefore, for PHYs that are not disabled by user, hisi_sas_phy_enable()
needs to be executed even if the corresponding bit of phy_state is not
set.

Fixes: 89954f02 ("scsi: hisi_sas: Ensure all enabled PHYs up during controller reset")
Signed-off-by: default avatarYihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20241008021822.2617339-5-liyihang9@huawei.com


Reviewed-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarBing Xia <xiabing12@h-partners.com>
parent d48cefbb
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1544,9 +1544,15 @@ void hisi_sas_controller_reset_done(struct hisi_hba *hisi_hba)
	/* Init and wait for PHYs to come up and all libsas event finished. */
	for (phy_no = 0; phy_no < hisi_hba->n_phy; phy_no++) {
		struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no];
		struct asd_sas_phy *sas_phy = &phy->sas_phy;

		if (!sas_phy->phy->enabled)
			continue;

		if (!(hisi_hba->phy_state & BIT(phy_no)))
		if (!(hisi_hba->phy_state & BIT(phy_no))) {
			hisi_sas_phy_enable(hisi_hba, phy_no, 1);
			continue;
		}

		async_schedule_domain(hisi_sas_async_init_wait_phyup,
				      phy, &async);