164d85cc9SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 2*d007bac1SLee Jones /* 3175e0e23SKent Yoder * debugfs routines supporting the Power 7+ Nest Accelerators driver 4175e0e23SKent Yoder * 5175e0e23SKent Yoder * Copyright (C) 2011-2012 International Business Machines Inc. 6175e0e23SKent Yoder * 7175e0e23SKent Yoder * Author: Kent Yoder <yoder1@us.ibm.com> 8175e0e23SKent Yoder */ 9175e0e23SKent Yoder 10175e0e23SKent Yoder #include <linux/device.h> 11175e0e23SKent Yoder #include <linux/kobject.h> 12175e0e23SKent Yoder #include <linux/string.h> 13175e0e23SKent Yoder #include <linux/debugfs.h> 14175e0e23SKent Yoder #include <linux/module.h> 15175e0e23SKent Yoder #include <linux/init.h> 16175e0e23SKent Yoder #include <linux/crypto.h> 17175e0e23SKent Yoder #include <crypto/hash.h> 18175e0e23SKent Yoder #include <asm/vio.h> 19175e0e23SKent Yoder 20175e0e23SKent Yoder #include "nx_csbcpb.h" 21175e0e23SKent Yoder #include "nx.h" 22175e0e23SKent Yoder 23175e0e23SKent Yoder #ifdef CONFIG_DEBUG_FS 24175e0e23SKent Yoder 25175e0e23SKent Yoder /* 26175e0e23SKent Yoder * debugfs 27175e0e23SKent Yoder * 28175e0e23SKent Yoder * For documentation on these attributes, please see: 29175e0e23SKent Yoder * 30175e0e23SKent Yoder * Documentation/ABI/testing/debugfs-pfo-nx-crypto 31175e0e23SKent Yoder */ 32175e0e23SKent Yoder 33576d152cSGreg Kroah-Hartman void nx_debugfs_init(struct nx_crypto_driver *drv) 34175e0e23SKent Yoder { 35576d152cSGreg Kroah-Hartman struct dentry *root; 36175e0e23SKent Yoder 37576d152cSGreg Kroah-Hartman root = debugfs_create_dir(NX_NAME, NULL); 38576d152cSGreg Kroah-Hartman drv->dfs_root = root; 39175e0e23SKent Yoder 40576d152cSGreg Kroah-Hartman debugfs_create_u32("aes_ops", S_IRUSR | S_IRGRP | S_IROTH, 41fe95938dSGeert Uytterhoeven root, &drv->stats.aes_ops.counter); 42576d152cSGreg Kroah-Hartman debugfs_create_u32("sha256_ops", S_IRUSR | S_IRGRP | S_IROTH, 43fe95938dSGeert Uytterhoeven root, &drv->stats.sha256_ops.counter); 44576d152cSGreg Kroah-Hartman debugfs_create_u32("sha512_ops", S_IRUSR | S_IRGRP | S_IROTH, 45fe95938dSGeert Uytterhoeven root, &drv->stats.sha512_ops.counter); 46576d152cSGreg Kroah-Hartman debugfs_create_u64("aes_bytes", S_IRUSR | S_IRGRP | S_IROTH, 47fe95938dSGeert Uytterhoeven root, &drv->stats.aes_bytes.counter); 48576d152cSGreg Kroah-Hartman debugfs_create_u64("sha256_bytes", S_IRUSR | S_IRGRP | S_IROTH, 49fe95938dSGeert Uytterhoeven root, &drv->stats.sha256_bytes.counter); 50576d152cSGreg Kroah-Hartman debugfs_create_u64("sha512_bytes", S_IRUSR | S_IRGRP | S_IROTH, 51fe95938dSGeert Uytterhoeven root, &drv->stats.sha512_bytes.counter); 52576d152cSGreg Kroah-Hartman debugfs_create_u32("errors", S_IRUSR | S_IRGRP | S_IROTH, 53fe95938dSGeert Uytterhoeven root, &drv->stats.errors.counter); 54576d152cSGreg Kroah-Hartman debugfs_create_u32("last_error", S_IRUSR | S_IRGRP | S_IROTH, 55fe95938dSGeert Uytterhoeven root, &drv->stats.last_error.counter); 56576d152cSGreg Kroah-Hartman debugfs_create_u32("last_error_pid", S_IRUSR | S_IRGRP | S_IROTH, 57fe95938dSGeert Uytterhoeven root, &drv->stats.last_error_pid.counter); 58175e0e23SKent Yoder } 59175e0e23SKent Yoder 60175e0e23SKent Yoder void 61175e0e23SKent Yoder nx_debugfs_fini(struct nx_crypto_driver *drv) 62175e0e23SKent Yoder { 63576d152cSGreg Kroah-Hartman debugfs_remove_recursive(drv->dfs_root); 64175e0e23SKent Yoder } 65175e0e23SKent Yoder 66175e0e23SKent Yoder #endif 67