mali_kbase_vinstr.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. *
  3. * (C) COPYRIGHT 2015 ARM Limited. All rights reserved.
  4. *
  5. * This program is free software and is provided to you under the terms of the
  6. * GNU General Public License version 2 as published by the Free Software
  7. * Foundation, and any use by you of this program is subject to the terms
  8. * of such GNU licence.
  9. *
  10. * A copy of the licence is included with the program, and can also be obtained
  11. * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  12. * Boston, MA 02110-1301, USA.
  13. *
  14. */
  15. #ifndef _KBASE_VINSTR_H_
  16. #define _KBASE_VINSTR_H_
  17. #include <mali_kbase.h>
  18. #include <mali_kbase_hwcnt_reader.h>
  19. /*****************************************************************************/
  20. struct kbase_vinstr_context;
  21. struct kbase_vinstr_client;
  22. /*****************************************************************************/
  23. /**
  24. * kbase_vinstr_init() - initialize the vinstr core
  25. * @kbdev: kbase device
  26. *
  27. * Return: pointer to the vinstr context on success or NULL on failure
  28. */
  29. struct kbase_vinstr_context *kbase_vinstr_init(struct kbase_device *kbdev);
  30. /**
  31. * kbase_vinstr_term() - terminate the vinstr core
  32. * @vinstr_ctx: vinstr context
  33. */
  34. void kbase_vinstr_term(struct kbase_vinstr_context *vinstr_ctx);
  35. /**
  36. * kbase_vinstr_hwcnt_reader_setup - configure hw counters reader
  37. * @vinstr_ctx: vinstr context
  38. * @setup: reader's configuration
  39. *
  40. * Return: zero on success
  41. */
  42. int kbase_vinstr_hwcnt_reader_setup(
  43. struct kbase_vinstr_context *vinstr_ctx,
  44. struct kbase_uk_hwcnt_reader_setup *setup);
  45. /**
  46. * kbase_vinstr_legacy_hwc_setup - configure hw counters for dumping
  47. * @vinstr_ctx: vinstr context
  48. * @cli: pointer where to store pointer to new vinstr client structure
  49. * @setup: hwc configuration
  50. *
  51. * Return: zero on success
  52. */
  53. int kbase_vinstr_legacy_hwc_setup(
  54. struct kbase_vinstr_context *vinstr_ctx,
  55. struct kbase_vinstr_client **cli,
  56. struct kbase_uk_hwcnt_setup *setup);
  57. /**
  58. * kbase_vinstr_hwcnt_kernel_setup - configure hw counters for kernel side
  59. * client
  60. * @vinstr_ctx: vinstr context
  61. * @setup: reader's configuration
  62. * @kernel_buffer: pointer to dump buffer
  63. *
  64. * setup->buffer_count and setup->fd are not used for kernel side clients.
  65. *
  66. * Return: pointer to client structure, or NULL on failure
  67. */
  68. struct kbase_vinstr_client *kbase_vinstr_hwcnt_kernel_setup(
  69. struct kbase_vinstr_context *vinstr_ctx,
  70. struct kbase_uk_hwcnt_reader_setup *setup,
  71. void *kernel_buffer);
  72. /**
  73. * kbase_vinstr_hwc_dump - issue counter dump for vinstr client
  74. * @cli: pointer to vinstr client
  75. * @event_id: id of event that triggered hwcnt dump
  76. *
  77. * Return: zero on success
  78. */
  79. int kbase_vinstr_hwc_dump(
  80. struct kbase_vinstr_client *cli,
  81. enum base_hwcnt_reader_event event_id);
  82. /**
  83. * kbase_vinstr_hwc_clear - performs a reset of the hardware counters for
  84. * a given kbase context
  85. * @cli: pointer to vinstr client
  86. *
  87. * Return: zero on success
  88. */
  89. int kbase_vinstr_hwc_clear(struct kbase_vinstr_client *cli);
  90. /**
  91. * kbase_vinstr_hwc_suspend - suspends hardware counter collection for
  92. * a given kbase context
  93. * @vinstr_ctx: vinstr context
  94. */
  95. void kbase_vinstr_hwc_suspend(struct kbase_vinstr_context *vinstr_ctx);
  96. /**
  97. * kbase_vinstr_hwc_resume - resumes hardware counter collection for
  98. * a given kbase context
  99. * @vinstr_ctx: vinstr context
  100. */
  101. void kbase_vinstr_hwc_resume(struct kbase_vinstr_context *vinstr_ctx);
  102. /**
  103. * kbase_vinstr_dump_size - Return required size of dump buffer
  104. * @kbdev: device pointer
  105. *
  106. * Return : buffer size in bytes
  107. */
  108. size_t kbase_vinstr_dump_size(struct kbase_device *kbdev);
  109. /**
  110. * kbase_vinstr_detach_client - Detach a client from the vinstr core
  111. * @cli: Pointer to vinstr client
  112. */
  113. void kbase_vinstr_detach_client(struct kbase_vinstr_client *cli);
  114. #endif // ifndef _KBASE_VINSTR_H_