msm_kgsl.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _MSM_KGSL_H
  7. #define _MSM_KGSL_H
  8. /**
  9. * struct kgsl_gpu_freq_stat - Per GPU freq stat struct
  10. * @freq: GPU frequency in Hz
  11. * @active_time: GPU busy time in usecs
  12. * @idle_time: GPU idle time in usec
  13. */
  14. struct kgsl_gpu_freq_stat {
  15. u32 freq;
  16. u64 active_time;
  17. u64 idle_time;
  18. };
  19. /**
  20. * kgsl_gpu_num_freqs - Get number of available GPU frequencies
  21. *
  22. * Return: number of available frequencies on success or negative error
  23. * on failure
  24. */
  25. int kgsl_gpu_num_freqs(void);
  26. /**
  27. * kgsl_gpu_stat - Get per GPU freq stats
  28. * @stats: Array of struct kgsl_gpu_freq_stat to hold stats
  29. * @numfreq: Number of entries in @stats
  30. *
  31. * This function will populate @stats with per freq stats.
  32. * Number of entries in @stats array must be greater or
  33. * equal to value returned by function kgsl_gpu_num_freqs
  34. *
  35. * Return: 0 on success or negative error on failure
  36. */
  37. int kgsl_gpu_stat(struct kgsl_gpu_freq_stat *stats, u32 numfreq);
  38. /**
  39. * kgsl_gpu_frame_count - Get number of frames already processed by GPU
  40. * @pid: pid of the process for which frame count is required
  41. * @frame_count: pointer to a u64 to store frame count
  42. *
  43. * Return: zero on success and number of frames processed corresponding
  44. * to @pid in @frame_count or negative error on failure
  45. */
  46. int kgsl_gpu_frame_count(pid_t pid, u64 *frame_count);
  47. /**
  48. * enum kgsl_srcu_events - kgsl srcu notify events for listeners
  49. * @GPU_GMU_READY - GMU initialized to handle other requests
  50. * @GPU_GMU_STOP - GMU is not ready to handle other requests
  51. * @GPU_SSR_BEGIN - GPU/GMU fault detected to start recovery
  52. * @GPU_SSR_END - GPU/GMU fault recovery end
  53. * @GPU_SSR_FATAL - LSR context invalidated
  54. */
  55. enum kgsl_srcu_events {
  56. GPU_GMU_READY,
  57. GPU_GMU_STOP,
  58. GPU_SSR_BEGIN,
  59. GPU_SSR_END,
  60. GPU_SSR_FATAL,
  61. };
  62. /**
  63. * kgsl_add_rcu_notifier - Adds a notifier to an SRCU notifier chain.
  64. * @nb: Notifier block new entry to add in notifier chain
  65. *
  66. * Returns zero on success or error on failure.
  67. */
  68. int kgsl_add_rcu_notifier(struct notifier_block *nb);
  69. /**
  70. * kgsl_del_rcu_notifier - Remove notifier from an SRCU notifier chain.
  71. * @nb: Entry to remove from notifier chain
  72. *
  73. * Returns zero on success or -ENOENT on failure.
  74. */
  75. int kgsl_del_rcu_notifier(struct notifier_block *nb);
  76. #endif /* _MSM_KGSL_H */