hisi_sas: More misc patches
Subsystems (2)
cover hisi_sas: More misc patches
This is a collection of misc patches picked up during the latest dev cycle, targeted at 5.12 .
Features include:
- Some tidy-up from after recent change to expose HW queues on v2 HW
- Add trace FIFO DFX debugfs support
- Flush wq for driver removal
- Add ability to enable debugfs support as a kernel config option
Thanks!
John Garry (2):
scsi: hisi_sas: Remove deferred probe check in hisi_sas_v2_probe()
scsi: hisi_sas: Don't check .nr_hw_queues in hisi_sas_task_prep()
Luo Jiaxing (3):
scsi: hisi_sas: Enable debugfs support by default
scsi: hisi_sas: Flush workqueue in hisi_sas_v3_remove()
scsi: hisi_sas: Add trace FIFO debugfs support
drivers/scsi/hisi_sas/Kconfig | 6 + drivers/scsi/hisi_sas/hisi_sas.h | 15 ++ drivers/scsi/hisi_sas/hisi_sas_main.c | 19 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 12 -- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 252 +++++++++++++++++++++++++ 5 files changed, 286 insertions(+), 18 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/5 scsi: hisi_sas: Remove deferred probe check in hisi_sas_v2_probe()
The platform_get_irq() check for -EPROBE_DEFER was to ensure that all the steps to add the SCSI host are not done and then only to realise that the probe needs to be deferred.
However, since there is now an earlier check for this in hisi_sas_interrupt_preinit(), this check is superfluous and may be removed.
--- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +0 -12
@@ -3627,18 +3627,6 @@ static const struct hisi_sas_hw hisi_sas_v2_hw = {static int hisi_sas_v2_probe (struct platform_device *pdev) { -/* -* Check if we should defer the probe before we probe the -* upper layer, as it's hard to defer later on. -*/ -int ret =platform_get_irq (pdev,0 ); - -if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (&pdev->dev,"cannot obtain irq\n" ); -return ret; - } -return hisi_sas_probe (pdev, &hisi_sas_v2_hw); }
Signature · 1 line
2.26.2
PATCH 2/5 scsi: hisi_sas: Don't check .nr_hw_queues in hisi_sas_task_prep()
In reply to John GarryNow that v2 and v3 hw expose their HW queues (and so shost.nr_hw_queues is set), remove the conditional checks in hisi_sas_task_prep().
This change would affect v1 HW performance (as it does not expose HW queues), but nobody uses it and support may be dropped soon.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +2 -4
@@ -445,21 +445,19 @@ static int hisi_sas_task_prep(struct sas_task *task, } } -if (scmd && hisi_hba->shost->nr_hw_queues) { +if (scmd) {unsigned int dq_index;u32 blk_tag; blk_tag =blk_mq_unique_tag (scmd->request); dq_index =blk_mq_unique_tag_to_hwq (blk_tag); *dq_pointer = dq = &hisi_hba->dq[dq_index]; - }else if (hisi_hba->shost->nr_hw_queues) { + }else {struct Scsi_Host *shost = hisi_hba->shost;struct blk_mq_queue_map *qmap = &shost->tag_set.map[HCTX_TYPE_DEFAULT ];int queue = qmap->mq_map[raw_smp_processor_id ()]; *dq_pointer = dq = &hisi_hba->dq[queue]; - }else { - *dq_pointer = dq = sas_dev->dq; } port =to_hisi_sas_port (sas_port);
Signature · 1 line
2.26.2
PATCH 3/5 scsi: hisi_sas: Enable debugfs support by default
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
Add a config option to enable debugfs support by default. And if debugfs support is enabled by default, dump count default value is increased to 50 as generally users want something bigger than the current default in that situation.
--- drivers/scsi/hisi_sas/Kconfig | 6 ++++++ drivers/scsi/hisi_sas/hisi_sas_main.c | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/scsi/hisi_sas/Kconfig +6 -0
@@ -18,3 +18,9 @@ config SCSI_HISI_SAS_PCI depends on ACPI help This driver supports HiSilicon's SAS HBA based on PCI device + +config SCSI_HISI_SAS_DEBUGFS_DEFAULT_ENABLE + bool "HiSilicon SAS debugging default enable" + depends on SCSI_HISI_SAS + help + Set Y to default enable DEBUGFS for SCSI_HISI_SAS
drivers/scsi/hisi_sas/hisi_sas_main.c +11 -2
@@ -2722,12 +2722,21 @@ int hisi_sas_remove(struct platform_device *pdev) }EXPORT_SYMBOL_GPL (hisi_sas_remove); +#if IS_ENABLED (CONFIG_SCSI_HISI_SAS_DEBUGFS_DEFAULT_ENABLE ) +#define DEBUGFS_ENABLE_DEFAULT "enabled" +bool hisi_sas_debugfs_enable = true; +u32 hisi_sas_debugfs_dump_count =50 ; +#else +#define DEBUGFS_ENABLE_DEFAULT "disabled"bool hisi_sas_debugfs_enable; +u32 hisi_sas_debugfs_dump_count =1 ; +#endif +EXPORT_SYMBOL_GPL (hisi_sas_debugfs_enable);module_param_named (debugfs_enable, hisi_sas_debugfs_enable, bool,0444 ); -MODULE_PARM_DESC (hisi_sas_debugfs_enable,"Enable driver debugfs (default disabled)" ); +MODULE_PARM_DESC (hisi_sas_debugfs_enable, +"Enable driver debugfs (default " DEBUGFS_ENABLE_DEFAULT ")" ); -u32 hisi_sas_debugfs_dump_count =1 ;EXPORT_SYMBOL_GPL (hisi_sas_debugfs_dump_count);module_param_named (debugfs_dump_count, hisi_sas_debugfs_dump_count, uint,0444 );MODULE_PARM_DESC (hisi_sas_debugfs_dump_count,"Number of debugfs dumps to allow" );
Signature · 1 line
2.26.2
PATCH 4/5 scsi: hisi_sas: Flush workqueue in hisi_sas_v3_remove()
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
If the controller reset occurs at the same time as driver removal, it may be possible that the interrupts have been released prior to the host softreset, and calling pci_irq_vector() there causes a WARN:
WARNING: CPU: 37 PID: 1542 /pci/msi.c:1275 pci_irq_vector+0xc0/0xd0 Call trace: pci_irq_vector+0xc0/0xd0 disable_host_v3_hw+0x58/0x5b0 [hisi_sas_v3_hw] soft_reset_v3_hw+0x40/0xc0 [hisi_sas_v3_hw] hisi_sas_controller_reset+0x150/0x260 [hisi_sas_main] hisi_sas_rst_work_handler+0x3c/0x58 [hisi_sas_main]
To fix, flush the driver workqueue prior to releasing the interrupts to ensure any resets have been completed.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -0
@@ -4572,6 +4572,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev)del_timer (&hisi_hba->timer);sas_unregister_ha (sha); +flush_workqueue (hisi_hba->wq);sas_remove_host (sha->core.shost);hisi_sas_v3_destroy_irqs (pdev, hisi_hba);
Signature · 1 line
2.26.2
PATCH 5/5 scsi: hisi_sas: Add trace FIFO debugfs support
In reply to John GarryFrom: Luo Jiaxing <[email protected]>
The controller provides trace FIFO DFX tool to assist link fault debug and link optimization. This tool can be helpful when debug link faults without SAS analyzers. Each PHY has an independent trace FIFO interface.
The user can configure trace FIFO tool of one PHY by using the following six interfaces:
signal_sel: select signal group applies to different scenarios.
0x0: linkrate negotiation
0x1: Host 12G TX train
0x2: Disk 12G TX train
0x3: SAS PHY CTRL DFX 0
0x4: SAS PHY CTRL DFX 1
0x5: SAS PCS DFX
other: linkrate negotiationdump_mask: The masked hardware status bit will not be updated.dump_mode: determines how to dump data after trigger signal is generated.
0x0: dump forever
0x1: dump 32 data after trigger signal is generated
0x2: no more dump after trigger signal is generatedtrigger_mode: determines the trigger mode, level or edge.
0x0: dump when trigger signal changed
0x1: dump when trigger signal's level equal to trigger_level 0x2: dump when trigger signal's level different from trigger_leveltrigger_level: determines the trigger level.trigger_msk: mask trigger signal
The user can get 32 signal datas from hardware by reading the rd_data. These 32 signal datas is the status record of hardware at different time points.
--- drivers/scsi/hisi_sas/hisi_sas.h | 15 ++ drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 251 +++++++++++++++++++++++++ 2 files changed, 266 insertions(+)
drivers/scsi/hisi_sas/hisi_sas.h +15 -0
@@ -44,6 +44,7 @@#define HISI_SAS_IOST_ITCT_CACHE_NUM 64#define HISI_SAS_IOST_ITCT_CACHE_DW_SZ 10 +#define HISI_SAS_FIFO_DATA_DW_SIZE 32#define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer))#define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table))
@@ -154,6 +155,16 @@ enum hisi_sas_phy_event { HISI_PHYES_NUM, }; +struct hisi_sas_debugfs_fifo { +u32 signal_sel; +u32 dump_msk; +u32 dump_mode; +u32 trigger; +u32 trigger_msk; +u32 trigger_mode; +u32 rd_data[HISI_SAS_FIFO_DATA_DW_SIZE ]; +}; +struct hisi_sas_phy {struct work_struct works[HISI_PHYES_NUM ];struct hisi_hba *hisi_hba;
@@ -175,6 +186,9 @@ struct hisi_sas_phy {enum sas_linkrate maximum_linkrate;int enable;atomic_t down_cnt; + +/* Trace FIFO */ +struct hisi_sas_debugfs_fifo fifo; };struct hisi_sas_port {
@@ -474,6 +488,7 @@ struct hisi_hba {struct dentry *debugfs_dir;struct dentry *debugfs_dump_dentry;struct dentry *debugfs_bist_dentry; +struct dentry *debugfs_fifo_dentry; };/* Generic HW DMA host memory structures */
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +251 -0
269 lines not on this page · raw message
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJohn,
Quoted 5 lines
Features include:
- Some tidy-up from after recent change to expose HW queues on v2 HW
- Add trace FIFO DFX debugfs support
- Flush wq for driver removal
- Add ability to enable debugfs support as a kernel config option
Applied to 5.12/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 10 lines · John Garry
This is a collection of misc patches picked up during the latest dev cycle, targeted at 5.12 .
Features include:
- Some tidy-up from after recent change to expose HW queues on v2 HW
- Add trace FIFO DFX debugfs support
- Flush wq for driver removal
- Add ability to enable debugfs support as a kernel config option[...]
Applied to 5.12/scsi-queue, thanks!
[1/5] scsi: hisi_sas: Remove deferred probe check in hisi_sas_v2_probe()
https://git.kernel.org/mkp/scsi/c/4d287d8bae1f [2/5] scsi: hisi_sas: Don't check .nr_hw_queues in hisi_sas_task_prep() https://git.kernel.org/mkp/scsi/c/69bfa5fd7b44 [3/5] scsi: hisi_sas: Enable debugfs support by default https://git.kernel.org/mkp/scsi/c/1dbe61bf7d76 [4/5] scsi: hisi_sas: Flush workqueue in hisi_sas_v3_remove() https://git.kernel.org/mkp/scsi/c/6834ec8b23c3 [5/5] scsi: hisi_sas: Add trace FIFO debugfs support https://git.kernel.org/mkp/scsi/c/cd96fe600cc4
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering