xref: /OK3568_Linux_fs/kernel/drivers/crypto/nx/nx_debugfs.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /**
3*4882a593Smuzhiyun  * debugfs routines supporting the Power 7+ Nest Accelerators driver
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2011-2012 International Business Machines Inc.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Author: Kent Yoder <yoder1@us.ibm.com>
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include <linux/device.h>
11*4882a593Smuzhiyun #include <linux/kobject.h>
12*4882a593Smuzhiyun #include <linux/string.h>
13*4882a593Smuzhiyun #include <linux/debugfs.h>
14*4882a593Smuzhiyun #include <linux/module.h>
15*4882a593Smuzhiyun #include <linux/init.h>
16*4882a593Smuzhiyun #include <linux/crypto.h>
17*4882a593Smuzhiyun #include <crypto/hash.h>
18*4882a593Smuzhiyun #include <asm/vio.h>
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun #include "nx_csbcpb.h"
21*4882a593Smuzhiyun #include "nx.h"
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #ifdef CONFIG_DEBUG_FS
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun /*
26*4882a593Smuzhiyun  * debugfs
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * For documentation on these attributes, please see:
29*4882a593Smuzhiyun  *
30*4882a593Smuzhiyun  * Documentation/ABI/testing/debugfs-pfo-nx-crypto
31*4882a593Smuzhiyun  */
32*4882a593Smuzhiyun 
nx_debugfs_init(struct nx_crypto_driver * drv)33*4882a593Smuzhiyun void nx_debugfs_init(struct nx_crypto_driver *drv)
34*4882a593Smuzhiyun {
35*4882a593Smuzhiyun 	struct dentry *root;
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun 	root = debugfs_create_dir(NX_NAME, NULL);
38*4882a593Smuzhiyun 	drv->dfs_root = root;
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun 	debugfs_create_u32("aes_ops", S_IRUSR | S_IRGRP | S_IROTH,
41*4882a593Smuzhiyun 			   root, &drv->stats.aes_ops.counter);
42*4882a593Smuzhiyun 	debugfs_create_u32("sha256_ops", S_IRUSR | S_IRGRP | S_IROTH,
43*4882a593Smuzhiyun 			   root, &drv->stats.sha256_ops.counter);
44*4882a593Smuzhiyun 	debugfs_create_u32("sha512_ops", S_IRUSR | S_IRGRP | S_IROTH,
45*4882a593Smuzhiyun 			   root, &drv->stats.sha512_ops.counter);
46*4882a593Smuzhiyun 	debugfs_create_u64("aes_bytes", S_IRUSR | S_IRGRP | S_IROTH,
47*4882a593Smuzhiyun 			   root, &drv->stats.aes_bytes.counter);
48*4882a593Smuzhiyun 	debugfs_create_u64("sha256_bytes", S_IRUSR | S_IRGRP | S_IROTH,
49*4882a593Smuzhiyun 			   root, &drv->stats.sha256_bytes.counter);
50*4882a593Smuzhiyun 	debugfs_create_u64("sha512_bytes", S_IRUSR | S_IRGRP | S_IROTH,
51*4882a593Smuzhiyun 			   root, &drv->stats.sha512_bytes.counter);
52*4882a593Smuzhiyun 	debugfs_create_u32("errors", S_IRUSR | S_IRGRP | S_IROTH,
53*4882a593Smuzhiyun 			   root, &drv->stats.errors.counter);
54*4882a593Smuzhiyun 	debugfs_create_u32("last_error", S_IRUSR | S_IRGRP | S_IROTH,
55*4882a593Smuzhiyun 			   root, &drv->stats.last_error.counter);
56*4882a593Smuzhiyun 	debugfs_create_u32("last_error_pid", S_IRUSR | S_IRGRP | S_IROTH,
57*4882a593Smuzhiyun 			   root, &drv->stats.last_error_pid.counter);
58*4882a593Smuzhiyun }
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun void
nx_debugfs_fini(struct nx_crypto_driver * drv)61*4882a593Smuzhiyun nx_debugfs_fini(struct nx_crypto_driver *drv)
62*4882a593Smuzhiyun {
63*4882a593Smuzhiyun 	debugfs_remove_recursive(drv->dfs_root);
64*4882a593Smuzhiyun }
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun #endif
67