Skip to content

Commit ed340d1

Browse files
Merge patch series "scsi: hisi_sas: Minor fixes and cleanups"
chenxiang <chenxiang66@hisilicon.com> says: This series contain some fixes and cleanups including: - Set .phy_attached before notifying phyup event HISI_PHYEE_PHY_UP_PM; - Use standard error code instead of hardcode; - Check before using pointer variable; - Rollback some operations if FLR failed; - Correct the number of global debugfs registers; Link: https://lore.kernel.org/r/1702525516-51258-1-git-send-email-chenxiang66@hisilicon.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 6df14a3 + 73e33f9 commit ed340d1

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

drivers/scsi/hisi_sas/hisi_sas_main.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,12 +1565,12 @@ EXPORT_SYMBOL_GPL(hisi_sas_controller_reset_done);
15651565
static int hisi_sas_controller_prereset(struct hisi_hba *hisi_hba)
15661566
{
15671567
if (!hisi_hba->hw->soft_reset)
1568-
return -1;
1568+
return -ENOENT;
15691569

15701570
down(&hisi_hba->sem);
15711571
if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) {
15721572
up(&hisi_hba->sem);
1573-
return -1;
1573+
return -EPERM;
15741574
}
15751575

15761576
if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct)
@@ -1641,7 +1641,10 @@ static int hisi_sas_abort_task(struct sas_task *task)
16411641
task->task_state_flags |= SAS_TASK_STATE_ABORTED;
16421642
spin_unlock_irqrestore(&task->task_state_lock, flags);
16431643

1644-
if (slot && task->task_proto & SAS_PROTOCOL_SSP) {
1644+
if (!slot)
1645+
goto out;
1646+
1647+
if (task->task_proto & SAS_PROTOCOL_SSP) {
16451648
u16 tag = slot->idx;
16461649
int rc2;
16471650

@@ -1688,7 +1691,7 @@ static int hisi_sas_abort_task(struct sas_task *task)
16881691
rc = hisi_sas_softreset_ata_disk(device);
16891692
}
16901693
}
1691-
} else if (slot && task->task_proto & SAS_PROTOCOL_SMP) {
1694+
} else if (task->task_proto & SAS_PROTOCOL_SMP) {
16921695
/* SMP */
16931696
u32 tag = slot->idx;
16941697
struct hisi_sas_cq *cq = &hisi_hba->cq[slot->dlvry_queue];

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,11 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
16051605
}
16061606

16071607
phy->port_id = port_id;
1608+
spin_lock(&phy->lock);
1609+
/* Delete timer and set phy_attached atomically */
1610+
del_timer(&phy->timer);
1611+
phy->phy_attached = 1;
1612+
spin_unlock(&phy->lock);
16081613

16091614
/*
16101615
* Call pm_runtime_get_noresume() which pairs with
@@ -1618,11 +1623,6 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba)
16181623

16191624
res = IRQ_HANDLED;
16201625

1621-
spin_lock(&phy->lock);
1622-
/* Delete timer and set phy_attached atomically */
1623-
del_timer(&phy->timer);
1624-
phy->phy_attached = 1;
1625-
spin_unlock(&phy->lock);
16261626
end:
16271627
if (phy->reset_completion)
16281628
complete(phy->reset_completion);
@@ -3476,7 +3476,7 @@ static void debugfs_snapshot_global_reg_v3_hw(struct hisi_hba *hisi_hba)
34763476
u32 *databuf = hisi_hba->debugfs_regs[dump_index][DEBUGFS_GLOBAL].data;
34773477
int i;
34783478

3479-
for (i = 0; i < debugfs_axi_reg.count; i++, databuf++)
3479+
for (i = 0; i < debugfs_global_reg.count; i++, databuf++)
34803480
*databuf = hisi_sas_read32(hisi_hba, 4 * i);
34813481
}
34823482

@@ -4968,6 +4968,7 @@ static void hisi_sas_reset_done_v3_hw(struct pci_dev *pdev)
49684968
{
49694969
struct sas_ha_struct *sha = pci_get_drvdata(pdev);
49704970
struct hisi_hba *hisi_hba = sha->lldd_ha;
4971+
struct Scsi_Host *shost = hisi_hba->shost;
49714972
struct device *dev = hisi_hba->dev;
49724973
int rc;
49734974

@@ -4976,6 +4977,10 @@ static void hisi_sas_reset_done_v3_hw(struct pci_dev *pdev)
49764977
rc = hw_init_v3_hw(hisi_hba);
49774978
if (rc) {
49784979
dev_err(dev, "FLR: hw init failed rc=%d\n", rc);
4980+
clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags);
4981+
scsi_unblock_requests(shost);
4982+
clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags);
4983+
up(&hisi_hba->sem);
49794984
return;
49804985
}
49814986

@@ -5018,7 +5023,7 @@ static int _suspend_v3_hw(struct device *device)
50185023
}
50195024

50205025
if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags))
5021-
return -1;
5026+
return -EPERM;
50225027

50235028
dev_warn(dev, "entering suspend state\n");
50245029

0 commit comments

Comments
 (0)