Commit e55e4852 authored by Xiang Chen's avatar Xiang Chen Committed by Slim6882
Browse files

scsi: hisi_sas: Remove hisi_hba->timer for v3 hw

mainline inclusion
from mainline-v6.8-rc1
commit f9242f166770b681d9f71341d96adc01c4da00ef
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9HNHF
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f9242f166770



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

hisi_hba->timer is not used for v3 hw but there are two places that some
operations related to hisi_hba->timer are called by v3 hw:

 - Deleting the timer in function hisi_sas_v3_hw() which is only for v3 hw;

 - Deleting the timer in function hisi_sas_controller_reset_prepare() which
   is common for v1/v2/v3 hw.

We can remove the timer in the first case, but for the second scenario we
need to remove it only for v3 hw, so check hw->sht which is NULL only for
v3 hw before deleting hisi_hba->timer.

Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Link: https://lore.kernel.org/r/1705904747-62186-5-git-send-email-chenxiang66@hisilicon.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSlim6882 <yangjunshuo@huawei.com>
parent c78bd94b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1605,7 +1605,11 @@ void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba)
	scsi_block_requests(shost);
	hisi_hba->hw->wait_cmds_complete_timeout(hisi_hba, 100, 5000);

	if (timer_pending(&hisi_hba->timer))
	/*
	 * hisi_hba->timer is only used for v1/v2 hw, and check hw->sht
	 * which is also only used for v1/v2 hw to skip it for v3 hw
	 */
	if (hisi_hba->hw->sht && timer_pending(&hisi_hba->timer)) 
		del_timer_sync(&hisi_hba->timer);

	set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
+0 −2
Original line number Diff line number Diff line
@@ -5005,8 +5005,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)
	struct Scsi_Host *shost = sha->core.shost;

	pm_runtime_get_noresume(dev);
	if (timer_pending(&hisi_hba->timer))
		del_timer(&hisi_hba->timer);

	sas_unregister_ha(sha);
	flush_workqueue(hisi_hba->wq);