nx_debugfs.c 1.8 KB

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