hw_fence_drv_ipc.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __HW_FENCE_DRV_IPC_H
  6. #define __HW_FENCE_DRV_IPC_H
  7. /* ipc clients virtual client-id */
  8. #define HW_FENCE_IPC_CLIENT_ID_APPS_VID 8
  9. #define HW_FENCE_IPC_CLIENT_ID_GPU_VID 9
  10. #define HW_FENCE_IPC_CLIENT_ID_IPE_VID 11
  11. #define HW_FENCE_IPC_CLIENT_ID_VPU_VID 12
  12. #define HW_FENCE_IPC_CLIENT_ID_DPU_VID 25
  13. #define HW_FENCE_IPC_CLIENT_ID_IFE0_VID 128
  14. #define HW_FENCE_IPC_CLIENT_ID_IFE1_VID 129
  15. #define HW_FENCE_IPC_CLIENT_ID_IFE2_VID 130
  16. #define HW_FENCE_IPC_CLIENT_ID_IFE3_VID 131
  17. #define HW_FENCE_IPC_CLIENT_ID_IFE4_VID 132
  18. #define HW_FENCE_IPC_CLIENT_ID_IFE5_VID 133
  19. #define HW_FENCE_IPC_CLIENT_ID_IFE6_VID 134
  20. #define HW_FENCE_IPC_CLIENT_ID_IFE7_VID 135
  21. /* ipc clients physical client-id */
  22. #define HW_FENCE_IPC_CLIENT_ID_APPS_PID 3
  23. #define HW_FENCE_IPC_CLIENT_ID_GPU_PID 4
  24. #define HW_FENCE_IPC_CLIENT_ID_IPE_PID 5
  25. #define HW_FENCE_IPC_CLIENT_ID_VPU_PID 8
  26. #define HW_FENCE_IPC_CLIENT_ID_DPU_PID 9
  27. #define HW_FENCE_IPC_CLIENT_ID_IFE0_PID 11
  28. #define HW_FENCE_IPC_CLIENT_ID_IFE1_PID 12
  29. #define HW_FENCE_IPC_CLIENT_ID_IFE2_PID 13
  30. #define HW_FENCE_IPC_CLIENT_ID_IFE3_PID 14
  31. #define HW_FENCE_IPC_CLIENT_ID_IFE4_PID 15
  32. #define HW_FENCE_IPC_CLIENT_ID_IFE5_PID 16
  33. #define HW_FENCE_IPC_CLIENT_ID_IFE6_PID 17
  34. #define HW_FENCE_IPC_CLIENT_ID_IFE7_PID 18
  35. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_KALAMA 2
  36. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_PINEAPPLE 2
  37. #define HW_FENCE_IPC_FENCE_PROTOCOL_ID_PINEAPPLE 4
  38. #define HW_FENCE_IPCC_HW_REV_170 0x00010700 /* Kalama */
  39. #define HW_FENCE_IPCC_HW_REV_203 0x00020003 /* Pineapple */
  40. #define IPC_PROTOCOLp_CLIENTc_VERSION(base, p, c) (base + (0x40000*p) + (0x1000*c))
  41. #define IPC_PROTOCOLp_CLIENTc_CONFIG(base, p, c) (base + 0x8 + (0x40000*p) + (0x1000*c))
  42. #define IPC_PROTOCOLp_CLIENTc_RECV_SIGNAL_ENABLE(base, p, c) \
  43. (base + 0x14 + (0x40000*p) + (0x1000*c))
  44. #define IPC_PROTOCOLp_CLIENTc_SEND(base, p, c) ((base + 0xc) + (0x40000*p) + (0x1000*c))
  45. /**
  46. * hw_fence_ipcc_trigger_signal() - Trigger ipc signal for the requested client/signal pair.
  47. * @drv_data: driver data.
  48. * @tx_client_id: ipc client id that sends the ipc signal.
  49. * @rx_client_id: ipc client id that receives the ipc signal.
  50. * @signal_id: signal id to send.
  51. *
  52. * This API triggers the ipc 'signal_id' from the 'tx_client_id' to the 'rx_client_id'
  53. */
  54. void hw_fence_ipcc_trigger_signal(struct hw_fence_driver_data *drv_data,
  55. u32 tx_client_id, u32 rx_client_id, u32 signal_id);
  56. /**
  57. * hw_fence_ipcc_enable_signaling() - Enable ipcc signaling for hw-fence driver.
  58. * @drv_data: driver data.
  59. *
  60. * Return: 0 on success or negative errno (-EINVAL)
  61. */
  62. int hw_fence_ipcc_enable_signaling(struct hw_fence_driver_data *drv_data);
  63. /**
  64. * hw_fence_ipcc_enable_dpu_signaling() - Enable ipcc signaling for dpu client.
  65. * @drv_data: driver data.
  66. *
  67. * Return: 0 on success or negative errno (-EINVAL)
  68. */
  69. int hw_fence_ipcc_enable_dpu_signaling(struct hw_fence_driver_data *drv_data);
  70. /**
  71. * hw_fence_ipcc_get_client_virt_id() - Returns the ipc client virtual id that corresponds to the
  72. * hw fence driver client.
  73. * @drv_data: driver data.
  74. * @client_id: hw fence driver client id.
  75. *
  76. * The ipc client id returned by this API is used by the hw fence driver when signaling the fence.
  77. *
  78. * Return: client_id on success or negative errno (-EINVAL)
  79. */
  80. int hw_fence_ipcc_get_client_virt_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  81. /**
  82. * hw_fence_ipcc_get_client_phys_id() - Returns the ipc client physical id that corresponds to the
  83. * hw fence driver client.
  84. * @drv_data: driver data.
  85. * @client_id: hw fence driver client id.
  86. *
  87. * The ipc client id returned by this API is used by the hw fence driver when signaling the fence.
  88. *
  89. * Return: client_id on success or negative errno (-EINVAL)
  90. */
  91. int hw_fence_ipcc_get_client_phys_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  92. /**
  93. * hw_fence_ipcc_get_signal_id() - Returns the ipc signal id that corresponds to the hw fence
  94. * driver client.
  95. * @drv_data: driver data.
  96. * @client_id: hw fence driver client id.
  97. *
  98. * The ipc signal id returned by this API is used by the hw fence driver when signaling the fence.
  99. *
  100. * Return: client_id on success or negative errno (-EINVAL)
  101. */
  102. int hw_fence_ipcc_get_signal_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  103. /**
  104. * hw_fence_ipcc_needs_rxq_update() - Returns bool to indicate if client uses rx-queue.
  105. * @drv_data: driver data.
  106. * @client_id: hw fence driver client id.
  107. *
  108. * Return: true if client needs to update rxq, false otherwise
  109. */
  110. bool hw_fence_ipcc_needs_rxq_update(struct hw_fence_driver_data *drv_data, int client_id);
  111. /**
  112. * hw_fence_ipcc_needs_ipc_irq() - Returns bool to indicate if client needs ipc interrupt for
  113. * already signaled fences
  114. * @drv_data: driver data.
  115. * @client_id: hw fence driver client id.
  116. *
  117. * Return: true if client needs ipc interrupt for signaled fences, false otherwise
  118. */
  119. bool hw_fence_ipcc_needs_ipc_irq(struct hw_fence_driver_data *drv_data, int client_id);
  120. #endif /* __HW_FENCE_DRV_IPC_H */