Skip to contentSkip to conversation

hisi_sas: A small bunch of misc patches

PATCH Superseded John Garry 2 participants 5 messages Nov 23, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

John Garry

author
#0 lore raw

cover hisi_sas: A small bunch of misc patches

This series contains a small bunch of patches for the driver, including:
- Fix-up on error paths for v3 hw driver
- Relocate as much debugfs code as possible to v3 hw driver since no other hw drivers support it
- A small tidy-up patch

John Garry (1):
scsi: hisi_sas: Reduce some indirection in v3 hw driver

Luo Jiaxing (1):
scsi: hisi_sas: Move debugfs code to v3 hw driver

Xiang Chen (1):
scsi: hisi_sas: Fix up probe error handling for v3 hw

 drivers/scsi/hisi_sas/hisi_sas.h       |   28 -
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 1346 +-----------------------
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1254 +++++++++++++++++++++-
 3 files changed, 1224 insertions(+), 1404 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 1/3 scsi: hisi_sas: Reduce some indirection in v3 hw driver

Sometimes local functions are called indirectly from the hw driver, which only makes the code harder to follow. Remove these.

Method .hw_init is only called from platform driver probe, which is not relevant, so don't set this either.

---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +2 -3
index 7133ca859b5e..db409f6847bb 100644
@@ -3142,7 +3142,6 @@ static struct scsi_host_template sht_v3_hw = {
 };
 
 static const struct hisi_sas_hw hisi_sas_v3_hw = {
-	.hw_init = hisi_sas_v3_init,
 	.setup_itct = setup_itct_v3_hw,
 	.get_wideport_bitmap = get_wideport_bitmap_v3_hw,
 	.complete_hdr_size = sizeof(struct hisi_sas_complete_v3_hdr),
@@ -3322,7 +3321,7 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (rc)
 		goto err_out_register_ha;
 
-	rc = hisi_hba->hw->hw_init(hisi_hba);
+	rc = hisi_sas_v3_init(hisi_hba);
 	if (rc)
 		goto err_out_register_ha;
 
@@ -3511,7 +3510,7 @@ static int _resume_v3_hw(struct device *device)
 		pci_disable_device(pdev);
 		return rc;
 	}
-	hisi_hba->hw->phys_init(hisi_hba);
+	phys_init_v3_hw(hisi_hba);
 	sas_resume_ha(sha);
 	clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags);
 
Signature · 1 line
2.26.2
author
#2 lore raw

PATCH 2/3 scsi: hisi_sas: Fix up probe error handling for v3 hw

In reply to John Garry

From: Xiang Chen <[email protected]>

Fix some rollbacks in function hisi_sas_v3_probe() and interrupt_init_v3_hw().

Fixes 8d98416a55eb ("scsi: hisi_sas: Switch v3 hw to MQ")
---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +11 -15
index db409f6847bb..f6d0aa3a8c11 100644
@@ -2409,8 +2409,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
 			      DRV_NAME " phy", hisi_hba);
 	if (rc) {
 		dev_err(dev, "could not request phy interrupt, rc=%d\n", rc);
-		rc = -ENOENT;
-		goto free_irq_vectors;
+		return -ENOENT;
 	}
 
 	rc = devm_request_irq(dev, pci_irq_vector(pdev, 2),
@@ -2418,8 +2417,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
 			      DRV_NAME " channel", hisi_hba);
 	if (rc) {
 		dev_err(dev, "could not request chnl interrupt, rc=%d\n", rc);
-		rc = -ENOENT;
-		goto free_irq_vectors;
+		return -ENOENT;
 	}
 
 	rc = devm_request_irq(dev, pci_irq_vector(pdev, 11),
@@ -2427,8 +2425,7 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
 			      DRV_NAME " fatal", hisi_hba);
 	if (rc) {
 		dev_err(dev, "could not request fatal interrupt, rc=%d\n", rc);
-		rc = -ENOENT;
-		goto free_irq_vectors;
+		return -ENOENT;
 	}
 
 	if (hisi_sas_intr_conv)
@@ -2449,16 +2446,11 @@ static int interrupt_init_v3_hw(struct hisi_hba *hisi_hba)
 		if (rc) {
 			dev_err(dev, "could not request cq%d interrupt, rc=%d\n",
 				i, rc);
-			rc = -ENOENT;
-			goto free_irq_vectors;
+			return -ENOENT;
 		}
 	}
 
 	return 0;
-
-free_irq_vectors:
-	pci_free_irq_vectors(pdev);
-	return rc;
 }
 
 static int hisi_sas_v3_init(struct hisi_hba *hisi_hba)
@@ -3311,11 +3303,11 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	rc = interrupt_preinit_v3_hw(hisi_hba);
 	if (rc)
-		goto err_out_ha;
+		goto err_out_debugfs;
 	dev_err(dev, "%d hw queues\n", shost->nr_hw_queues);
 	rc = scsi_add_host(shost, dev);
 	if (rc)
-		goto err_out_ha;
+		goto err_out_free_irq_vectors;
 
 	rc = sas_register_ha(sha);
 	if (rc)
@@ -3342,8 +3334,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 err_out_register_ha:
 	scsi_remove_host(shost);
-err_out_ha:
+err_out_free_irq_vectors:
+	pci_free_irq_vectors(pdev);
+err_out_debugfs:
 	hisi_sas_debugfs_exit(hisi_hba);
+err_out_ha:
+	hisi_sas_free(hisi_hba);
 	scsi_host_put(shost);
 err_out_regions:
 	pci_release_regions(pdev);
Signature · 1 line
2.26.2
author
#3 lore raw

PATCH 3/3 scsi: hisi_sas: Move debugfs code to v3 hw driver

In reply to John Garry

From: Luo Jiaxing <[email protected]>

Relocate all the debugfs code for DFX to v3 hw as there are only longer plans to support earlier HW versions.

---
 drivers/scsi/hisi_sas/hisi_sas.h       |   28 -
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 1346 +-----------------------
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 1225 ++++++++++++++++++++-
 3 files changed, 1212 insertions(+), 1387 deletions(-)
drivers/scsi/hisi_sas/hisi_sas.h +0 -28
index a25cfc11c96d..2b28dd405600 100644
@@ -243,24 +243,6 @@ struct hisi_sas_slot {
 	u16	idx;
 };
 
-#define HISI_SAS_DEBUGFS_REG(x) {#x, x}
-
-struct hisi_sas_debugfs_reg_lu {
-	char *name;
-	int off;
-};
-
-struct hisi_sas_debugfs_reg {
-	const struct hisi_sas_debugfs_reg_lu *lu;
-	int count;
-	int base_off;
-	union {
-		u32 (*read_global_reg)(struct hisi_hba *hisi_hba, u32 off);
-		u32 (*read_port_reg)(struct hisi_hba *hisi_hba, int port,
-				     u32 off);
-	};
-};
-
 struct hisi_sas_iost_itct_cache {
 	u32 data[HISI_SAS_IOST_ITCT_CACHE_DW_SZ];
 };
@@ -350,15 +332,8 @@ struct hisi_sas_hw {
 					   int delay_ms, int timeout_ms);
 	void (*snapshot_prepare)(struct hisi_hba *hisi_hba);
 	void (*snapshot_restore)(struct hisi_hba *hisi_hba);
-	int (*set_bist)(struct hisi_hba *hisi_hba, bool enable);
-	void (*read_iost_itct_cache)(struct hisi_hba *hisi_hba,
-				     enum hisi_sas_debugfs_cache_type type,
-				     u32 *cache);
 	int complete_hdr_size;
 	struct scsi_host_template *sht;
-
-	const struct hisi_sas_debugfs_reg *debugfs_reg_array[DEBUGFS_REGS_NUM];
-	const struct hisi_sas_debugfs_reg *debugfs_reg_port;
 };
 
 #define HISI_SAS_MAX_DEBUGFS_DUMP (50)
@@ -673,7 +648,4 @@ extern void hisi_sas_release_tasks(struct hisi_hba *hisi_hba);
 extern u8 hisi_sas_get_prog_phy_linkrate_mask(enum sas_linkrate max);
 extern void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba);
 extern void hisi_sas_controller_reset_done(struct hisi_hba *hisi_hba);
-extern void hisi_sas_debugfs_init(struct hisi_hba *hisi_hba);
-extern void hisi_sas_debugfs_exit(struct hisi_hba *hisi_hba);
-extern void hisi_sas_debugfs_work_handler(struct work_struct *work);
 #endif
drivers/scsi/hisi_sas/hisi_sas_main.c +3 -1343

1,364 lines not on this page · raw message

drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1209 -16

1,297 lines not on this page · raw message

Signature · 1 line
2.26.2
#4 lore raw

Re: [PATCH 3/3] scsi: hisi_sas: Move debugfs code to v3 hw driver

Thank you for the patch! Perhaps something to improve:

Hi John,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next linus/master v5.10-rc5 next-20201123] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/John-Garry/hisi_sas-A-small-bunch-of-misc-patches/20201124-014754
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ede79ead19f599aecdc68447f3bfd6418df29561
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review John-Garry/hisi_sas-A-small-bunch-of-misc-patches/20201124-014754
        git checkout ede79ead19f599aecdc68447f3bfd6418df29561
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/scsi/hisi_sas/hisi_sas_v3_hw.c:4371:6: warning: no previous prototype for 'debugfs_init_v3_hw' [-Wmissing-prototypes]

4371 | void debugfs_init_v3_hw(struct hisi_hba *hisi_hba)
| ^~~~~~~~~~~~~~~~~~

vim +/debugfs_init_v3_hw +4371 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c

4370

> 4371	void debugfs_init_v3_hw(struct hisi_hba *hisi_hba)
  4372	{
  4373		struct device *dev = hisi_hba->dev;
  4374		int i;
  4375	
  4376		hisi_hba->debugfs_dir = debugfs_create_dir(dev_name(dev),
  4377							   hisi_sas_debugfs_dir);
  4378		debugfs_create_file("trigger_dump", 0200,
  4379				    hisi_hba->debugfs_dir,
  4380				    hisi_hba,
  4381				    &debugfs_trigger_dump_v3_hw_fops);

4382
4383 /* create bist structures */
4384 debugfs_bist_init_v3_hw(hisi_hba);
4385
4386 hisi_hba->debugfs_dump_dentry =
4387 debugfs_create_dir("dump", hisi_hba->debugfs_dir);
4388
4389 debugfs_phy_down_cnt_init_v3_hw(hisi_hba);
4390
4391 for (i = 0; i < hisi_sas_debugfs_dump_count; i++) {
4392 if (debugfs_alloc_v3_hw(hisi_hba, i)) {
4393 debugfs_remove_recursive(hisi_hba->debugfs_dir);
4394 dev_dbg(dev, "failed to init debugfs!\n");
4395 break;
4396 }
4397 }
4398 }
4399

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org