122 lines
4.4 KiB
Diff
122 lines
4.4 KiB
Diff
From 5b21f7795e2009317ba8832f84149d09fd20aa2c Mon Sep 17 00:00:00 2001
|
|
From: Luo Jiaxing <luojiaxing@huawei.com>
|
|
Date: Thu, 24 Oct 2019 22:08:14 +0800
|
|
Subject: [PATCH 027/108] scsi: hisi_sas: Add debugfs file structure for DQ
|
|
|
|
mainline inclusion
|
|
from mainline-v5.5-rc1
|
|
commit 1b54c4db725d875dcae645a3da74625b9e4b3bdf
|
|
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=1b54c4db725d875dcae645a3da74625b9e4b3bdf
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Create a file structure which was used to save the memory address and DQ
|
|
pointer for DQ 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-8-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 | 19 ++++++++++---------
|
|
2 files changed, 16 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
index 8692c01c8dc3..95a29c345c30 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas.h
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
@@ -372,6 +372,11 @@ struct hisi_sas_debugfs_cq {
|
|
void *complete_hdr;
|
|
};
|
|
|
|
+struct hisi_sas_debugfs_dq {
|
|
+ struct hisi_sas_dq *dq;
|
|
+ struct hisi_sas_cmd_hdr *hdr;
|
|
+};
|
|
+
|
|
struct hisi_hba {
|
|
/* This must be the first element, used by SHOST_TO_SAS_HA */
|
|
struct sas_ha_struct *p;
|
|
@@ -454,7 +459,7 @@ struct hisi_hba {
|
|
u32 *debugfs_regs[DEBUGFS_REGS_NUM];
|
|
u32 *debugfs_port_reg[HISI_SAS_MAX_PHYS];
|
|
struct hisi_sas_debugfs_cq debugfs_cq[HISI_SAS_MAX_QUEUES];
|
|
- struct hisi_sas_cmd_hdr *debugfs_cmd_hdr[HISI_SAS_MAX_QUEUES];
|
|
+ struct hisi_sas_debugfs_dq debugfs_dq[HISI_SAS_MAX_QUEUES];
|
|
struct hisi_sas_iost *debugfs_iost;
|
|
struct hisi_sas_itct *debugfs_itct;
|
|
u64 *debugfs_iost_cache;
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
index f3fddd1ab961..fe8c998e3e9f 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
@@ -2786,7 +2786,7 @@ static void hisi_sas_debugfs_snapshot_dq_reg(struct hisi_hba *hisi_hba)
|
|
int i;
|
|
|
|
for (i = 0; i < hisi_hba->queue_count; i++)
|
|
- memcpy(hisi_hba->debugfs_cmd_hdr[i],
|
|
+ memcpy(hisi_hba->debugfs_dq[i].hdr,
|
|
hisi_hba->cmd_hdr[i],
|
|
HISI_SAS_QUEUE_SLOTS * queue_entry_size);
|
|
}
|
|
@@ -3477,9 +3477,8 @@ static const struct file_operations hisi_sas_debugfs_cq_fops = {
|
|
|
|
static void hisi_sas_dq_show_slot(struct seq_file *s, int slot, void *dq_ptr)
|
|
{
|
|
- struct hisi_sas_dq *dq = dq_ptr;
|
|
- struct hisi_hba *hisi_hba = dq->hisi_hba;
|
|
- void *cmd_queue = hisi_hba->debugfs_cmd_hdr[dq->id];
|
|
+ struct hisi_sas_debugfs_dq *debugfs_dq = dq_ptr;
|
|
+ void *cmd_queue = debugfs_dq->hdr;
|
|
u64 offset = sizeof(struct hisi_sas_cmd_hdr) * slot;
|
|
__le32 *cmd_hdr = cmd_queue + offset;
|
|
|
|
@@ -3695,7 +3694,7 @@ static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba)
|
|
snprintf(name, sizeof(name), "%d", d);
|
|
|
|
debugfs_create_file(name, 0400, dentry,
|
|
- &hisi_hba->dq[d],
|
|
+ &hisi_hba->debugfs_dq[d],
|
|
&hisi_sas_debugfs_dq_fops);
|
|
}
|
|
|
|
@@ -3801,7 +3800,7 @@ static void hisi_sas_debugfs_release(struct hisi_hba *hisi_hba)
|
|
devm_kfree(dev, hisi_hba->debugfs_iost);
|
|
|
|
for (i = 0; i < hisi_hba->queue_count; i++)
|
|
- devm_kfree(dev, hisi_hba->debugfs_cmd_hdr[i]);
|
|
+ devm_kfree(dev, hisi_hba->debugfs_dq[i].hdr);
|
|
|
|
for (i = 0; i < hisi_hba->queue_count; i++)
|
|
devm_kfree(dev, hisi_hba->debugfs_cq[i].complete_hdr);
|
|
@@ -3896,11 +3895,13 @@ static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba)
|
|
|
|
sz = sizeof(struct hisi_sas_cmd_hdr) * HISI_SAS_QUEUE_SLOTS;
|
|
for (d = 0; d < hisi_hba->queue_count; d++) {
|
|
- hisi_hba->debugfs_cmd_hdr[d] =
|
|
- devm_kmalloc(dev, sz, GFP_KERNEL);
|
|
+ struct hisi_sas_debugfs_dq *dq =
|
|
+ &hisi_hba->debugfs_dq[d];
|
|
|
|
- if (!hisi_hba->debugfs_cmd_hdr[d])
|
|
+ dq->hdr = devm_kmalloc(dev, sz, GFP_KERNEL);
|
|
+ if (!dq->hdr)
|
|
goto fail;
|
|
+ dq->dq = &hisi_hba->dq[d];
|
|
}
|
|
|
|
sz = HISI_SAS_MAX_COMMANDS * sizeof(struct hisi_sas_iost);
|
|
--
|
|
2.27.0
|
|
|