127 lines
4.7 KiB
Diff
127 lines
4.7 KiB
Diff
From 9dbbe44702be4f7bfba4ef991acf0ae5bc31d962 Mon Sep 17 00:00:00 2001
|
|
From: Luo Jiaxing <luojiaxing@huawei.com>
|
|
Date: Thu, 24 Oct 2019 22:08:16 +0800
|
|
Subject: [PATCH 029/108] scsi: hisi_sas: Add debugfs file structure for port
|
|
|
|
mainline inclusion
|
|
from mainline-v5.5-rc1
|
|
commit 1f66e1fd26bddb4c9275b61934dbaaf4b0b0bd79
|
|
category: feature
|
|
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8F81L
|
|
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1f66e1fd26bddb4c9275b61934dbaaf4b0b0bd79
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Create a file structure which was used to save the memory address and phy
|
|
pointer for port at debugfs. This structure is bound to the corresponding
|
|
debugfs file, it can help callback function of debugfs file to get what it
|
|
need.
|
|
|
|
Link: https://lore.kernel.org/r/1571926105-74636-10-git-send-email-john.garry@huawei.com
|
|
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
|
|
Signed-off-by: John Garry <john.garry@huawei.com>
|
|
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
|
|
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
|
|
|
|
Conflicts:
|
|
drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
---
|
|
drivers/scsi/hisi_sas/hisi_sas.h | 7 ++++++-
|
|
drivers/scsi/hisi_sas/hisi_sas_main.c | 20 +++++++++++---------
|
|
2 files changed, 17 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
index fd8a128cf4d3..646ab7d6ad05 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas.h
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
@@ -382,6 +382,11 @@ struct hisi_sas_debugfs_regs {
|
|
u32 *data;
|
|
};
|
|
|
|
+struct hisi_sas_debugfs_port {
|
|
+ struct hisi_sas_phy *phy;
|
|
+ u32 *data;
|
|
+};
|
|
+
|
|
struct hisi_hba {
|
|
/* This must be the first element, used by SHOST_TO_SAS_HA */
|
|
struct sas_ha_struct *p;
|
|
@@ -462,7 +467,7 @@ struct hisi_hba {
|
|
/* debugfs memories */
|
|
/* Put Global AXI and RAS Register into register array */
|
|
struct hisi_sas_debugfs_regs debugfs_regs[DEBUGFS_REGS_NUM];
|
|
- u32 *debugfs_port_reg[HISI_SAS_MAX_PHYS];
|
|
+ struct hisi_sas_debugfs_port debugfs_port_reg[HISI_SAS_MAX_PHYS];
|
|
struct hisi_sas_debugfs_cq debugfs_cq[HISI_SAS_MAX_QUEUES];
|
|
struct hisi_sas_debugfs_dq debugfs_dq[HISI_SAS_MAX_QUEUES];
|
|
struct hisi_sas_iost *debugfs_iost;
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
index 504c83e4f620..637308372ec3 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
@@ -2800,7 +2800,7 @@ static void hisi_sas_debugfs_snapshot_port_reg(struct hisi_hba *hisi_hba)
|
|
u32 *databuf;
|
|
|
|
for (phy_cnt = 0; phy_cnt < hisi_hba->n_phy; phy_cnt++) {
|
|
- databuf = (u32 *)hisi_hba->debugfs_port_reg[phy_cnt];
|
|
+ databuf = hisi_hba->debugfs_port_reg[phy_cnt].data;
|
|
for (i = 0; i < port->count; i++, databuf++) {
|
|
offset = port->base_off + 4 * i;
|
|
*databuf = port->read_port_reg(hisi_hba, phy_cnt,
|
|
@@ -3384,13 +3384,13 @@ static const struct file_operations hisi_sas_debugfs_ras_fops = {
|
|
|
|
static int hisi_sas_debugfs_port_show(struct seq_file *s, void *p)
|
|
{
|
|
- struct hisi_sas_phy *phy = s->private;
|
|
+ struct hisi_sas_debugfs_port *port = s->private;
|
|
+ struct hisi_sas_phy *phy = port->phy;
|
|
struct hisi_hba *hisi_hba = phy->hisi_hba;
|
|
const struct hisi_sas_hw *hw = hisi_hba->hw;
|
|
const struct hisi_sas_debugfs_reg *reg_port = hw->debugfs_reg_port;
|
|
- u32 *databuf = hisi_hba->debugfs_port_reg[phy->sas_phy.id];
|
|
|
|
- hisi_sas_debugfs_print_reg(databuf, reg_port, s);
|
|
+ hisi_sas_debugfs_print_reg(port->data, reg_port, s);
|
|
|
|
return 0;
|
|
}
|
|
@@ -3676,7 +3676,7 @@ static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba)
|
|
for (p = 0; p < hisi_hba->n_phy; p++) {
|
|
snprintf(name, sizeof(name), "%d", p);
|
|
debugfs_create_file(name, 0400, dentry,
|
|
- &hisi_hba->phy[p],
|
|
+ &hisi_hba->debugfs_port_reg[p],
|
|
&hisi_sas_debugfs_port_fops);
|
|
}
|
|
|
|
@@ -3815,7 +3815,7 @@ static void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)
|
|
devm_kfree(dev, hisi_hba->debugfs_regs[i].data);
|
|
|
|
for (i = 0; i < hisi_hba->n_phy; i++)
|
|
- devm_kfree(dev, hisi_hba->debugfs_port_reg[i]);
|
|
+ devm_kfree(dev, hisi_hba->debugfs_port_reg[i].data);
|
|
}
|
|
|
|
static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
|
|
@@ -3871,11 +3871,13 @@ static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
|
|
|
|
sz = hw->debugfs_reg_port->count * 4;
|
|
for (p = 0; p < hisi_hba->n_phy; p++) {
|
|
- hisi_hba->debugfs_port_reg[p] =
|
|
- devm_kmalloc(dev, sz, GFP_KERNEL);
|
|
+ struct hisi_sas_debugfs_port *port =
|
|
+ &hisi_hba->debugfs_port_reg[p];
|
|
|
|
- if (!hisi_hba->debugfs_port_reg[p])
|
|
+ port->data = devm_kmalloc(dev, sz, GFP_KERNEL);
|
|
+ if (!port->data)
|
|
goto fail;
|
|
+ port->phy = &hisi_hba->phy[p];
|
|
}
|
|
|
|
sz = hw->complete_hdr_size * HISI_SAS_QUEUE_SLOTS;
|
|
--
|
|
2.27.0
|
|
|