hisi_sas: Some misc patches
Subsystems (2)
cover hisi_sas: Some misc patches
This series contains some more minor patches for the driver, including:
- Improve debugfs code to snapshot registers prior to reset
- Fix probe error path
- Remove unused code
- Print SAS address in some error logs to assist debugging
Thanks!!
Jianqin Xie (1):
scsi: hisi_sas: Directly snapshot registers when executing a reset
Luo Jiaxing (4):
scsi: hisi_sas: Delete some unused callbacks
scsi: hisi_sas: Print SAS address for v3 hw erroneous completion print
scsi: hisi_sas: Warn in v3 hw channel interrupt handler when status
reg cleared
scsi: hisi_sas: Print SATA device SAS address for soft reset failure
Xiang Chen (1):
scsi: hisi_sas: Call sas_unregister_ha() to roll back if .hw_init()
fails
drivers/scsi/hisi_sas/hisi_sas.h | 3 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 38 +++++++++++++++------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 44 ++++++++++++++++---------- 3 files changed, 56 insertions(+), 29 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/6 scsi: hisi_sas: Delete some unused callbacks
From: Luo Jiaxing <[email protected]>
The debugfs code has been relocated to v3 hw driver, so delete unused struct hisi_sas_hw function pointers snapshot_{prepare, restore}.
--- drivers/scsi/hisi_sas/hisi_sas.h | 2 -- 1 file changed, 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +0 -2
@@ -346,8 +346,6 @@ struct hisi_sas_hw { u8 reg_index, u8 reg_count, u8 *write_data);void (*wait_cmds_complete_timeout)(struct hisi_hba *hisi_hba,int delay_ms,int timeout_ms); -void (*snapshot_prepare)(struct hisi_hba *hisi_hba); -void (*snapshot_restore)(struct hisi_hba *hisi_hba);int complete_hdr_size;struct scsi_host_template *sht; };
Signature · 1 line
2.26.2
PATCH 2/6 scsi: hisi_sas: Print SAS address for v3 hw erroneous completion print
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
To help debugging efforts, print the device SAS address for v3 hw erroneous completion log.
Here is an example print:hisi_sas_v3_hw 0000:b4:02.0: erroneous completion iptt=2193 task=000000002b0c13f8 dev id=17 addr=570fd45f9d17b001
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +2 -1
@@ -2252,8 +2252,9 @@ static void slot_complete_v3_hw(struct hisi_hba *hisi_hba,slot_err_v3_hw (hisi_hba, task, slot);if (ts->stat !=SAS_DATA_UNDERRUN ) -dev_info (dev,"erroneous completion iptt=%d task=%pK dev id=%d CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n" , +dev_info (dev,"erroneous completion iptt=%d task=%pK dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n" , slot->idx, task, sas_dev->device_id, +SAS_ADDR (device->sas_addr), dw0, dw1, complete_hdr->act, dw3, error_info[0 ], error_info[1 ], error_info[2 ], error_info[3 ]);
Signature · 1 line
2.26.2
PATCH 3/6 scsi: hisi_sas: Call sas_unregister_ha() to roll back if .hw_init() fails
In reply to John GarryFrom: Xiang Chen <[email protected]>
Function sas_unregister_ha() needs to be called to roll back if hisi_hba->hw->hw_init() fails in function hisi_sas_probe() or hisi_sas_v3_probe(), so make that change.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 4 +++- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +3 -1
@@ -2689,12 +2689,14 @@ int hisi_sas_probe(struct platform_device *pdev, rc = hisi_hba->hw->hw_init (hisi_hba);if (rc) - goto err_out_register_ha; + goto err_out_hw_init;scsi_scan_host (shost);return 0 ; +err_out_hw_init: +sas_unregister_ha (sha); err_out_register_ha:scsi_remove_host (shost); err_out_ha:
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +3 -1
@@ -4761,7 +4761,7 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) rc =hisi_sas_v3_init (hisi_hba);if (rc) - goto err_out_register_ha; + goto err_out_hw_init;scsi_scan_host (shost);
@@ -4778,6 +4778,8 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)return 0 ; +err_out_hw_init: +sas_unregister_ha (sha); err_out_register_ha:scsi_remove_host (shost); err_out_free_irq_vectors:
Signature · 1 line
2.26.2
PATCH 4/6 scsi: hisi_sas: Directly snapshot registers when executing a reset
In reply to John GarryFrom: Jianqin Xie <[email protected]>
The debugfs snapshot should be executed before the reset occurs to ensure that the register contents are saved properly.
As such, it is incorrect to queue the debugfs dump when running a reset as the reset will occur prior to the snapshot work item is handler.
Therefore, directly snapshot registers in the reset work handler.
--- drivers/scsi/hisi_sas/hisi_sas.h | 1 + drivers/scsi/hisi_sas/hisi_sas_main.c | 28 ++++++++++++++++++-------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 27 ++++++++++++++----------- 3 files changed, 36 insertions(+), 20 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +1 -0
@@ -346,6 +346,7 @@ struct hisi_sas_hw { u8 reg_index, u8 reg_count, u8 *write_data);void (*wait_cmds_complete_timeout)(struct hisi_hba *hisi_hba,int delay_ms,int timeout_ms); +void (*debugfs_snapshot_regs)(struct hisi_hba *hisi_hba);int complete_hdr_size;struct scsi_host_template *sht; };
drivers/scsi/hisi_sas/hisi_sas_main.c +20 -8
@@ -1568,21 +1568,26 @@ void hisi_sas_controller_reset_done(struct hisi_hba *hisi_hba) }EXPORT_SYMBOL_GPL (hisi_sas_controller_reset_done); -static int hisi_sas_controller_reset (struct hisi_hba *hisi_hba) +static int hisi_sas_controller_prereset (struct hisi_hba *hisi_hba) { -struct device *dev = hisi_hba->dev; -struct Scsi_Host *shost = hisi_hba->shost; -int rc; - -if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0 ].itct) -queue_work (hisi_hba->wq, &hisi_hba->debugfs_work); -if (!hisi_hba->hw->soft_reset)return -1 ;if (test_and_set_bit (HISI_SAS_RESET_BIT , &hisi_hba->flags))return -1 ; +if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0 ].itct) + hisi_hba->hw->debugfs_snapshot_regs (hisi_hba); + +return 0 ; +} + +static int hisi_sas_controller_reset (struct hisi_hba *hisi_hba) +{ +struct device *dev = hisi_hba->dev; +struct Scsi_Host *shost = hisi_hba->shost; +int rc; +dev_info (dev,"controller resetting...\n" );hisi_sas_controller_reset_prepare (hisi_hba);
@@ -2471,6 +2476,9 @@ void hisi_sas_rst_work_handler(struct work_struct *work)struct hisi_hba *hisi_hba = container_of(work, struct hisi_hba, rst_work); +if (hisi_sas_controller_prereset (hisi_hba)) +return ; +hisi_sas_controller_reset (hisi_hba); }EXPORT_SYMBOL_GPL (hisi_sas_rst_work_handler);
@@ -2480,8 +2488,12 @@ void hisi_sas_sync_rst_work_handler(struct work_struct *work)struct hisi_sas_rst *rst = container_of(work, struct hisi_sas_rst, work); +if (hisi_sas_controller_prereset (rst->hisi_hba)) + goto rst_complete; +if (!hisi_sas_controller_reset (rst->hisi_hba)) rst->done = true; +rst_complete:complete (rst->completion); }EXPORT_SYMBOL_GPL (hisi_sas_sync_rst_work_handler);
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +15 -12
@@ -531,6 +531,7 @@ module_param(prot_mask, int, 0);MODULE_PARM_DESC (prot_mask," host protection capabilities mask, def=0x0 " );static void debugfs_work_handler_v3_hw (struct work_struct *work); +static void debugfs_snapshot_regs_v3_hw (struct hisi_hba *hisi_hba);static u32 hisi_sas_read32 (struct hisi_hba *hisi_hba,u32 off) {
@@ -3182,6 +3183,7 @@ static const struct hisi_sas_hw hisi_sas_v3_hw = { .get_events = phy_get_events_v3_hw, .write_gpio = write_gpio_v3_hw, .wait_cmds_complete_timeout = wait_cmds_complete_timeout_v3_hw, + .debugfs_snapshot_regs = debugfs_snapshot_regs_v3_hw, }; static struct Scsi_Host *
@@ -3666,6 +3668,19 @@ static void debugfs_create_files_v3_hw(struct hisi_hba *hisi_hba)static void debugfs_snapshot_regs_v3_hw (struct hisi_hba *hisi_hba) { +int debugfs_dump_index = hisi_hba->debugfs_dump_index; +struct device *dev = hisi_hba->dev; +u64 timestamp =local_clock (); + +if (debugfs_dump_index >= hisi_sas_debugfs_dump_count) { +dev_warn (dev,"dump count exceeded!\n" ); +return ; + } + +do_div (timestamp,NSEC_PER_MSEC ); + hisi_hba->debugfs_timestamp[debugfs_dump_index] = timestamp; + hisi_hba->debugfs_dump_index++; +debugfs_snapshot_prepare_v3_hw (hisi_hba);debugfs_snapshot_global_reg_v3_hw (hisi_hba);
@@ -4408,20 +4423,8 @@ static void debugfs_work_handler_v3_hw(struct work_struct *work) {struct hisi_hba *hisi_hba = container_of(work, struct hisi_hba, debugfs_work); -int debugfs_dump_index = hisi_hba->debugfs_dump_index; -struct device *dev = hisi_hba->dev; -u64 timestamp =local_clock (); - -if (debugfs_dump_index >= hisi_sas_debugfs_dump_count) { -dev_warn (dev,"dump count exceeded!\n" ); -return ; - } - -do_div (timestamp,NSEC_PER_MSEC ); - hisi_hba->debugfs_timestamp[debugfs_dump_index] = timestamp;debugfs_snapshot_regs_v3_hw (hisi_hba); - hisi_hba->debugfs_dump_index++; }static void debugfs_release_v3_hw (struct hisi_hba *hisi_hba,int dump_index)
Signature · 1 line
2.26.2
PATCH 5/6 scsi: hisi_sas: Warn in v3 hw channel interrupt handler when status reg cleared
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
If a channel interrupt occurs without any status bit set, the handler will return directly. However, if such redundant interrupts are received, it's better to check what happen, so add logs for this.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +8 -2
@@ -1718,8 +1718,11 @@ static void handle_chl_int1_v3_hw(struct hisi_hba *hisi_hba, int phy_no)int i; irq_value &= ~irq_msk; -if (!irq_value) +if (!irq_value) { +dev_warn (dev,"phy%d channel int 1 received with status bits cleared\n" , + phy_no);return ; + }for (i =0 ; i <ARRAY_SIZE (port_axi_error); i++) {const struct hisi_sas_hw_error *error = &port_axi_error[i];
@@ -1780,8 +1783,11 @@ static void handle_chl_int2_v3_hw(struct hisi_hba *hisi_hba, int phy_no)BIT (CHL_INT2_RX_INVLD_DW_OFF ); irq_value &= ~irq_msk; -if (!irq_value) +if (!irq_value) { +dev_warn (dev,"phy%d channel int 2 received with status bits cleared\n" , + phy_no);return ; + }if (irq_value &BIT (CHL_INT2_SL_IDAF_TOUT_CONF_OFF )) {dev_warn (dev,"phy%d identify timeout\n" , phy_no);
Signature · 1 line
2.26.2
PATCH 6/6 scsi: hisi_sas: Print SATA device SAS address for soft reset failure
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
Add (pseudo) SAS address for ATA software reset failure log to assist debugging.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +4 -2
@@ -1341,10 +1341,12 @@ static int hisi_sas_softreset_ata_disk(struct domain_device *device) rc =hisi_sas_exec_internal_tmf_task (device, fis, s,NULL );if (rc !=TMF_RESP_FUNC_COMPLETE ) -dev_err (dev,"ata disk de-reset failed\n" ); +dev_err (dev,"ata disk %016llx de-reset failed\n" , +SAS_ADDR (device->sas_addr)); } }else { -dev_err (dev,"ata disk reset failed\n" ); +dev_err (dev,"ata disk %016llx reset failed\n" , +SAS_ADDR (device->sas_addr)); }if (rc ==TMF_RESP_FUNC_COMPLETE )
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJohn,
Quoted 5 lines
This series contains some more minor patches for the driver, including:
- Improve debugfs code to snapshot registers prior to reset
- Fix probe error path
- Remove unused code
- Print SAS address in some error logs to assist debugging
Applied to 5.13/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 9 lines · John Garry
This series contains some more minor patches for the driver, including:
- Improve debugfs code to snapshot registers prior to reset
- Fix probe error path
- Remove unused code
- Print SAS address in some error logs to assist debuggingThanks!!
[...]
Applied to 5.13/scsi-queue, thanks!
[1/6] scsi: hisi_sas: Delete some unused callbacks
https://git.kernel.org/mkp/scsi/c/2843d2fb4225 [2/6] scsi: hisi_sas: Print SAS address for v3 hw erroneous completion print https://git.kernel.org/mkp/scsi/c/4da0b7f6fac3 [3/6] scsi: hisi_sas: Call sas_unregister_ha() to roll back if .hw_init() fails https://git.kernel.org/mkp/scsi/c/f467666504bf [4/6] scsi: hisi_sas: Directly snapshot registers when executing a reset https://git.kernel.org/mkp/scsi/c/2c74cb1f9222 [5/6] scsi: hisi_sas: Warn in v3 hw channel interrupt handler when status reg cleared https://git.kernel.org/mkp/scsi/c/2d31cb20a3cd [6/6] scsi: hisi_sas: Print SATA device SAS address for soft reset failure https://git.kernel.org/mkp/scsi/c/f4df167ad5a2
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering