hw_fence_drv_ipc.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 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_LAHAINA 2
  36. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_WAIPIO 1
  37. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_KALAMA 2
  38. #define HW_FENCE_IPC_COMPUTE_L1_PROTOCOL_ID_PINEAPPLE 2
  39. #define HW_FENCE_IPC_FENCE_PROTOCOL_ID_PINEAPPLE 4
  40. #define HW_FENCE_IPCC_HW_REV_100 0x00010000 /* Lahaina */
  41. #define HW_FENCE_IPCC_HW_REV_110 0x00010100 /* Waipio */
  42. #define HW_FENCE_IPCC_HW_REV_170 0x00010700 /* Kalama */
  43. #define HW_FENCE_IPCC_HW_REV_203 0x00020003 /* Pineapple */
  44. #define IPC_PROTOCOLp_CLIENTc_VERSION(base, p, c) (base + (0x40000*p) + (0x1000*c))
  45. #define IPC_PROTOCOLp_CLIENTc_CONFIG(base, p, c) (base + 0x8 + (0x40000*p) + (0x1000*c))
  46. #define IPC_PROTOCOLp_CLIENTc_RECV_SIGNAL_ENABLE(base, p, c) \
  47. (base + 0x14 + (0x40000*p) + (0x1000*c))
  48. #define IPC_PROTOCOLp_CLIENTc_SEND(base, p, c) ((base + 0xc) + (0x40000*p) + (0x1000*c))
  49. /**
  50. * hw_fence_ipcc_trigger_signal() - Trigger ipc signal for the requested client/signal pair.
  51. * @drv_data: driver data.
  52. * @tx_client_id: ipc client id that sends the ipc signal.
  53. * @rx_client_id: ipc client id that receives the ipc signal.
  54. * @signal_id: signal id to send.
  55. *
  56. * This API triggers the ipc 'signal_id' from the 'tx_client_id' to the 'rx_client_id'
  57. */
  58. void hw_fence_ipcc_trigger_signal(struct hw_fence_driver_data *drv_data,
  59. u32 tx_client_id, u32 rx_client_id, u32 signal_id);
  60. /**
  61. * hw_fence_ipcc_enable_signaling() - Enable ipcc signaling for hw-fence driver.
  62. * @drv_data: driver data.
  63. *
  64. * Return: 0 on success or negative errno (-EINVAL)
  65. */
  66. int hw_fence_ipcc_enable_signaling(struct hw_fence_driver_data *drv_data);
  67. #ifdef HW_DPU_IPCC
  68. /**
  69. * hw_fence_ipcc_enable_dpu_signaling() - Enable ipcc signaling for dpu client.
  70. * @drv_data: driver data.
  71. *
  72. * Return: 0 on success or negative errno (-EINVAL)
  73. */
  74. int hw_fence_ipcc_enable_dpu_signaling(struct hw_fence_driver_data *drv_data);
  75. #endif /* HW_DPU_IPCC */
  76. /**
  77. * hw_fence_ipcc_get_client_virt_id() - Returns the ipc client virtual id that corresponds to the
  78. * hw fence driver client.
  79. * @drv_data: driver data.
  80. * @client_id: hw fence driver client id.
  81. *
  82. * The ipc client id returned by this API is used by the hw fence driver when signaling the fence.
  83. *
  84. * Return: client_id on success or negative errno (-EINVAL)
  85. */
  86. int hw_fence_ipcc_get_client_virt_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  87. /**
  88. * hw_fence_ipcc_get_client_phys_id() - Returns the ipc client physical id that corresponds to the
  89. * hw fence driver client.
  90. * @drv_data: driver data.
  91. * @client_id: hw fence driver client id.
  92. *
  93. * The ipc client id returned by this API is used by the hw fence driver when signaling the fence.
  94. *
  95. * Return: client_id on success or negative errno (-EINVAL)
  96. */
  97. int hw_fence_ipcc_get_client_phys_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  98. /**
  99. * hw_fence_ipcc_get_signal_id() - Returns the ipc signal id that corresponds to the hw fence
  100. * driver client.
  101. * @drv_data: driver data.
  102. * @client_id: hw fence driver client id.
  103. *
  104. * The ipc signal id returned by this API is used by the hw fence driver when signaling the fence.
  105. *
  106. * Return: client_id on success or negative errno (-EINVAL)
  107. */
  108. int hw_fence_ipcc_get_signal_id(struct hw_fence_driver_data *drv_data, u32 client_id);
  109. /**
  110. * hw_fence_ipcc_needs_rxq_update() - Returns bool to indicate if client uses rx-queue.
  111. * @drv_data: driver data.
  112. * @client_id: hw fence driver client id.
  113. *
  114. * Return: true if client needs to update rxq, false otherwise
  115. */
  116. bool hw_fence_ipcc_needs_rxq_update(struct hw_fence_driver_data *drv_data, int client_id);
  117. /**
  118. * hw_fence_ipcc_needs_ipc_irq() - Returns bool to indicate if client needs ipc interrupt for
  119. * already signaled fences
  120. * @drv_data: driver data.
  121. * @client_id: hw fence driver client id.
  122. *
  123. * Return: true if client needs ipc interrupt for signaled fences, false otherwise
  124. */
  125. bool hw_fence_ipcc_needs_ipc_irq(struct hw_fence_driver_data *drv_data, int client_id);
  126. #endif /* __HW_FENCE_DRV_IPC_H */