mali_kbase_hwaccess_instr.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. *
  3. * (C) COPYRIGHT 2014-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. /*
  16. * HW Access instrumentation common APIs
  17. */
  18. #ifndef _KBASE_HWACCESS_INSTR_H_
  19. #define _KBASE_HWACCESS_INSTR_H_
  20. #include <mali_kbase_instr_defs.h>
  21. /**
  22. * kbase_instr_hwcnt_enable_internal - Enable HW counters collection
  23. * @kbdev: Kbase device
  24. * @kctx: Kbase context
  25. * @setup: HW counter setup parameters
  26. *
  27. * Context: might sleep, waiting for reset to complete
  28. *
  29. * Return: 0 on success
  30. */
  31. int kbase_instr_hwcnt_enable_internal(struct kbase_device *kbdev,
  32. struct kbase_context *kctx,
  33. struct kbase_uk_hwcnt_setup *setup);
  34. /**
  35. * kbase_instr_hwcnt_disable_internal - Disable HW counters collection
  36. * @kctx: Kbase context
  37. *
  38. * Context: might sleep, waiting for an ongoing dump to complete
  39. *
  40. * Return: 0 on success
  41. */
  42. int kbase_instr_hwcnt_disable_internal(struct kbase_context *kctx);
  43. /**
  44. * kbase_instr_hwcnt_request_dump() - Request HW counter dump from GPU
  45. * @kctx: Kbase context
  46. *
  47. * Caller must either wait for kbase_instr_hwcnt_dump_complete() to return true,
  48. * of call kbase_instr_hwcnt_wait_for_dump().
  49. *
  50. * Return: 0 on success
  51. */
  52. int kbase_instr_hwcnt_request_dump(struct kbase_context *kctx);
  53. /**
  54. * kbase_instr_hwcnt_wait_for_dump() - Wait until pending HW counter dump has
  55. * completed.
  56. * @kctx: Kbase context
  57. *
  58. * Context: will sleep, waiting for dump to complete
  59. *
  60. * Return: 0 on success
  61. */
  62. int kbase_instr_hwcnt_wait_for_dump(struct kbase_context *kctx);
  63. /**
  64. * kbase_instr_hwcnt_dump_complete - Tell whether the HW counters dump has
  65. * completed
  66. * @kctx: Kbase context
  67. * @success: Set to true if successful
  68. *
  69. * Context: does not sleep.
  70. *
  71. * Return: true if the dump is complete
  72. */
  73. bool kbase_instr_hwcnt_dump_complete(struct kbase_context *kctx,
  74. bool * const success);
  75. /**
  76. * kbase_instr_hwcnt_clear() - Clear HW counters
  77. * @kctx: Kbase context
  78. *
  79. * Context: might sleep, waiting for reset to complete
  80. *
  81. * Return: 0 on success
  82. */
  83. int kbase_instr_hwcnt_clear(struct kbase_context *kctx);
  84. /**
  85. * kbase_instr_backend_init() - Initialise the instrumentation backend
  86. * @kbdev: Kbase device
  87. *
  88. * This function should be called during driver initialization.
  89. *
  90. * Return: 0 on success
  91. */
  92. int kbase_instr_backend_init(struct kbase_device *kbdev);
  93. /**
  94. * kbase_instr_backend_init() - Terminate the instrumentation backend
  95. * @kbdev: Kbase device
  96. *
  97. * This function should be called during driver termination.
  98. */
  99. void kbase_instr_backend_term(struct kbase_device *kbdev);
  100. #endif // ifndef _KBASE_HWACCESS_INSTR_H_