forked from Minki/linux
crypto: hisilicon/hpre - update debugfs interface parameters
Update debugfs interface parameters, and adjust the processing logic inside the corresponding function. Fixes: 848974151618("crypto: hisilicon - Add debugfs for HPRE") Signed-off-by: Meng Yu <yumeng18@huawei.com> Reviewed-by: Zaibo Xu <xuzaibo@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
a0c34e8dd8
commit
dadbe4c117
@ -563,15 +563,17 @@ static int hpre_debugfs_atomic64_set(void *data, u64 val)
|
||||
DEFINE_DEBUGFS_ATTRIBUTE(hpre_atomic64_ops, hpre_debugfs_atomic64_get,
|
||||
hpre_debugfs_atomic64_set, "%llu\n");
|
||||
|
||||
static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
|
||||
static int hpre_create_debugfs_file(struct hisi_qm *qm, struct dentry *dir,
|
||||
enum hpre_ctrl_dbgfs_file type, int indx)
|
||||
{
|
||||
struct hpre *hpre = container_of(qm, struct hpre, qm);
|
||||
struct hpre_debug *dbg = &hpre->debug;
|
||||
struct dentry *file_dir;
|
||||
|
||||
if (dir)
|
||||
file_dir = dir;
|
||||
else
|
||||
file_dir = dbg->debug_root;
|
||||
file_dir = qm->debug.debug_root;
|
||||
|
||||
if (type >= HPRE_DEBUG_FILE_NUM)
|
||||
return -EINVAL;
|
||||
@ -586,10 +588,8 @@ static int hpre_create_debugfs_file(struct hpre_debug *dbg, struct dentry *dir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
|
||||
static int hpre_pf_comm_regs_debugfs_init(struct hisi_qm *qm)
|
||||
{
|
||||
struct hpre *hpre = container_of(debug, struct hpre, debug);
|
||||
struct hisi_qm *qm = &hpre->qm;
|
||||
struct device *dev = &qm->pdev->dev;
|
||||
struct debugfs_regset32 *regset;
|
||||
|
||||
@ -601,14 +601,12 @@ static int hpre_pf_comm_regs_debugfs_init(struct hpre_debug *debug)
|
||||
regset->nregs = ARRAY_SIZE(hpre_com_dfx_regs);
|
||||
regset->base = qm->io_base;
|
||||
|
||||
debugfs_create_regset32("regs", 0444, debug->debug_root, regset);
|
||||
debugfs_create_regset32("regs", 0444, qm->debug.debug_root, regset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
|
||||
static int hpre_cluster_debugfs_init(struct hisi_qm *qm)
|
||||
{
|
||||
struct hpre *hpre = container_of(debug, struct hpre, debug);
|
||||
struct hisi_qm *qm = &hpre->qm;
|
||||
struct device *dev = &qm->pdev->dev;
|
||||
char buf[HPRE_DBGFS_VAL_MAX_LEN];
|
||||
struct debugfs_regset32 *regset;
|
||||
@ -619,7 +617,7 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
|
||||
ret = snprintf(buf, HPRE_DBGFS_VAL_MAX_LEN, "cluster%d", i);
|
||||
if (ret < 0)
|
||||
return -EINVAL;
|
||||
tmp_d = debugfs_create_dir(buf, debug->debug_root);
|
||||
tmp_d = debugfs_create_dir(buf, qm->debug.debug_root);
|
||||
|
||||
regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
|
||||
if (!regset)
|
||||
@ -630,7 +628,7 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
|
||||
regset->base = qm->io_base + hpre_cluster_offsets[i];
|
||||
|
||||
debugfs_create_regset32("regs", 0444, tmp_d, regset);
|
||||
ret = hpre_create_debugfs_file(debug, tmp_d, HPRE_CLUSTER_CTRL,
|
||||
ret = hpre_create_debugfs_file(qm, tmp_d, HPRE_CLUSTER_CTRL,
|
||||
i + HPRE_CLUSTER_CTRL);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -639,32 +637,31 @@ static int hpre_cluster_debugfs_init(struct hpre_debug *debug)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpre_ctrl_debug_init(struct hpre_debug *debug)
|
||||
static int hpre_ctrl_debug_init(struct hisi_qm *qm)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = hpre_create_debugfs_file(debug, NULL, HPRE_CURRENT_QM,
|
||||
ret = hpre_create_debugfs_file(qm, NULL, HPRE_CURRENT_QM,
|
||||
HPRE_CURRENT_QM);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = hpre_create_debugfs_file(debug, NULL, HPRE_CLEAR_ENABLE,
|
||||
ret = hpre_create_debugfs_file(qm, NULL, HPRE_CLEAR_ENABLE,
|
||||
HPRE_CLEAR_ENABLE);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = hpre_pf_comm_regs_debugfs_init(debug);
|
||||
ret = hpre_pf_comm_regs_debugfs_init(qm);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return hpre_cluster_debugfs_init(debug);
|
||||
return hpre_cluster_debugfs_init(qm);
|
||||
}
|
||||
|
||||
static void hpre_dfx_debug_init(struct hpre_debug *debug)
|
||||
static void hpre_dfx_debug_init(struct hisi_qm *qm)
|
||||
{
|
||||
struct hpre *hpre = container_of(debug, struct hpre, debug);
|
||||
struct hpre *hpre = container_of(qm, struct hpre, qm);
|
||||
struct hpre_dfx *dfx = hpre->debug.dfx;
|
||||
struct hisi_qm *qm = &hpre->qm;
|
||||
struct dentry *parent;
|
||||
int i;
|
||||
|
||||
@ -676,30 +673,27 @@ static void hpre_dfx_debug_init(struct hpre_debug *debug)
|
||||
}
|
||||
}
|
||||
|
||||
static int hpre_debugfs_init(struct hpre *hpre)
|
||||
static int hpre_debugfs_init(struct hisi_qm *qm)
|
||||
{
|
||||
struct hisi_qm *qm = &hpre->qm;
|
||||
struct device *dev = &qm->pdev->dev;
|
||||
struct dentry *dir;
|
||||
int ret;
|
||||
|
||||
dir = debugfs_create_dir(dev_name(dev), hpre_debugfs_root);
|
||||
qm->debug.debug_root = dir;
|
||||
qm->debug.debug_root = debugfs_create_dir(dev_name(dev),
|
||||
hpre_debugfs_root);
|
||||
|
||||
qm->debug.sqe_mask_offset = HPRE_SQE_MASK_OFFSET;
|
||||
qm->debug.sqe_mask_len = HPRE_SQE_MASK_LEN;
|
||||
|
||||
ret = hisi_qm_debug_init(qm);
|
||||
if (ret)
|
||||
goto failed_to_create;
|
||||
|
||||
if (qm->pdev->device == HPRE_PCI_DEVICE_ID) {
|
||||
hpre->debug.debug_root = dir;
|
||||
ret = hpre_ctrl_debug_init(&hpre->debug);
|
||||
ret = hpre_ctrl_debug_init(qm);
|
||||
if (ret)
|
||||
goto failed_to_create;
|
||||
}
|
||||
|
||||
hpre_dfx_debug_init(&hpre->debug);
|
||||
hpre_dfx_debug_init(qm);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -708,10 +702,8 @@ failed_to_create:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void hpre_debugfs_exit(struct hpre *hpre)
|
||||
static void hpre_debugfs_exit(struct hisi_qm *qm)
|
||||
{
|
||||
struct hisi_qm *qm = &hpre->qm;
|
||||
|
||||
debugfs_remove_recursive(qm->debug.debug_root);
|
||||
}
|
||||
|
||||
@ -850,7 +842,7 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
if (ret)
|
||||
goto err_with_err_init;
|
||||
|
||||
ret = hpre_debugfs_init(hpre);
|
||||
ret = hpre_debugfs_init(qm);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev, "init debugfs fail!\n");
|
||||
|
||||
@ -875,6 +867,7 @@ err_with_crypto_register:
|
||||
|
||||
err_with_qm_start:
|
||||
hisi_qm_del_from_list(qm, &hpre_devices);
|
||||
hpre_debugfs_exit(qm);
|
||||
hisi_qm_stop(qm);
|
||||
|
||||
err_with_err_init:
|
||||
@ -906,7 +899,7 @@ static void hpre_remove(struct pci_dev *pdev)
|
||||
qm->debug.curr_qm_qp_num = 0;
|
||||
}
|
||||
|
||||
hpre_debugfs_exit(hpre);
|
||||
hpre_debugfs_exit(qm);
|
||||
hisi_qm_stop(qm);
|
||||
hisi_qm_dev_err_uninit(qm);
|
||||
hisi_qm_uninit(qm);
|
||||
|
Loading…
Reference in New Issue
Block a user