blob: 1975bcbee997481ee095dc3adaa4841708bf61cd [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-only
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/**
3 * debugfs routines supporting the Power 7+ Nest Accelerators driver
4 *
5 * Copyright (C) 2011-2012 International Business Machines Inc.
6 *
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007 * Author: Kent Yoder <yoder1@us.ibm.com>
8 */
9
10#include <linux/device.h>
11#include <linux/kobject.h>
12#include <linux/string.h>
13#include <linux/debugfs.h>
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/crypto.h>
17#include <crypto/hash.h>
18#include <asm/vio.h>
19
20#include "nx_csbcpb.h"
21#include "nx.h"
22
23#ifdef CONFIG_DEBUG_FS
24
25/*
26 * debugfs
27 *
28 * For documentation on these attributes, please see:
29 *
30 * Documentation/ABI/testing/debugfs-pfo-nx-crypto
31 */
32
David Brazdil0f672f62019-12-10 10:32:29 +000033void nx_debugfs_init(struct nx_crypto_driver *drv)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000034{
David Brazdil0f672f62019-12-10 10:32:29 +000035 struct dentry *root;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000036
David Brazdil0f672f62019-12-10 10:32:29 +000037 root = debugfs_create_dir(NX_NAME, NULL);
38 drv->dfs_root = root;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000039
David Brazdil0f672f62019-12-10 10:32:29 +000040 debugfs_create_u32("aes_ops", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020041 root, &drv->stats.aes_ops.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000042 debugfs_create_u32("sha256_ops", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020043 root, &drv->stats.sha256_ops.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000044 debugfs_create_u32("sha512_ops", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020045 root, &drv->stats.sha512_ops.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000046 debugfs_create_u64("aes_bytes", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020047 root, &drv->stats.aes_bytes.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000048 debugfs_create_u64("sha256_bytes", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020049 root, &drv->stats.sha256_bytes.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000050 debugfs_create_u64("sha512_bytes", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020051 root, &drv->stats.sha512_bytes.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000052 debugfs_create_u32("errors", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020053 root, &drv->stats.errors.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000054 debugfs_create_u32("last_error", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020055 root, &drv->stats.last_error.counter);
David Brazdil0f672f62019-12-10 10:32:29 +000056 debugfs_create_u32("last_error_pid", S_IRUSR | S_IRGRP | S_IROTH,
Olivier Deprez157378f2022-04-04 15:47:50 +020057 root, &drv->stats.last_error_pid.counter);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000058}
59
60void
61nx_debugfs_fini(struct nx_crypto_driver *drv)
62{
David Brazdil0f672f62019-12-10 10:32:29 +000063 debugfs_remove_recursive(drv->dfs_root);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000064}
65
66#endif