Lines Matching refs:gmu
54 static int a6xx_hfi_queue_write(struct a6xx_gmu *gmu, in a6xx_hfi_queue_write() argument
78 gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, 0x01); in a6xx_hfi_queue_write()
82 static int a6xx_hfi_wait_for_ack(struct a6xx_gmu *gmu, u32 id, u32 seqnum, in a6xx_hfi_wait_for_ack() argument
85 struct a6xx_hfi_queue *queue = &gmu->queues[HFI_RESPONSE_QUEUE]; in a6xx_hfi_wait_for_ack()
90 ret = gmu_poll_timeout(gmu, REG_A6XX_GMU_GMU2HOST_INTR_INFO, val, in a6xx_hfi_wait_for_ack()
94 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
101 gmu_write(gmu, REG_A6XX_GMU_GMU2HOST_INTR_CLR, in a6xx_hfi_wait_for_ack()
113 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
123 DRM_DEV_ERROR(gmu->dev, "GMU firmware error %d\n", in a6xx_hfi_wait_for_ack()
129 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
136 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
151 static int a6xx_hfi_send_msg(struct a6xx_gmu *gmu, int id, in a6xx_hfi_send_msg() argument
154 struct a6xx_hfi_queue *queue = &gmu->queues[HFI_COMMAND_QUEUE]; in a6xx_hfi_send_msg()
164 ret = a6xx_hfi_queue_write(gmu, queue, data, dwords); in a6xx_hfi_send_msg()
166 DRM_DEV_ERROR(gmu->dev, "Unable to send message %s id %d\n", in a6xx_hfi_send_msg()
171 return a6xx_hfi_wait_for_ack(gmu, id, seqnum, payload, payload_size); in a6xx_hfi_send_msg()
174 static int a6xx_hfi_send_gmu_init(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_send_gmu_init() argument
178 msg.dbg_buffer_addr = (u32) gmu->debug->iova; in a6xx_hfi_send_gmu_init()
179 msg.dbg_buffer_size = (u32) gmu->debug->size; in a6xx_hfi_send_gmu_init()
182 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_INIT, &msg, sizeof(msg), in a6xx_hfi_send_gmu_init()
186 static int a6xx_hfi_get_fw_version(struct a6xx_gmu *gmu, u32 *version) in a6xx_hfi_get_fw_version() argument
193 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_FW_VERSION, &msg, sizeof(msg), in a6xx_hfi_get_fw_version()
197 static int a6xx_hfi_send_perf_table(struct a6xx_gmu *gmu) in a6xx_hfi_send_perf_table() argument
202 msg.num_gpu_levels = gmu->nr_gpu_freqs; in a6xx_hfi_send_perf_table()
203 msg.num_gmu_levels = gmu->nr_gmu_freqs; in a6xx_hfi_send_perf_table()
205 for (i = 0; i < gmu->nr_gpu_freqs; i++) { in a6xx_hfi_send_perf_table()
206 msg.gx_votes[i].vote = gmu->gx_arc_votes[i]; in a6xx_hfi_send_perf_table()
207 msg.gx_votes[i].freq = gmu->gpu_freqs[i] / 1000; in a6xx_hfi_send_perf_table()
210 for (i = 0; i < gmu->nr_gmu_freqs; i++) { in a6xx_hfi_send_perf_table()
211 msg.cx_votes[i].vote = gmu->cx_arc_votes[i]; in a6xx_hfi_send_perf_table()
212 msg.cx_votes[i].freq = gmu->gmu_freqs[i] / 1000; in a6xx_hfi_send_perf_table()
215 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_PERF_TABLE, &msg, sizeof(msg), in a6xx_hfi_send_perf_table()
219 static int a6xx_hfi_send_bw_table(struct a6xx_gmu *gmu) in a6xx_hfi_send_bw_table() argument
262 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_BW_TABLE, &msg, sizeof(msg), in a6xx_hfi_send_bw_table()
266 static int a6xx_hfi_send_test(struct a6xx_gmu *gmu) in a6xx_hfi_send_test() argument
270 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_TEST, &msg, sizeof(msg), in a6xx_hfi_send_test()
274 int a6xx_hfi_start(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_start() argument
278 ret = a6xx_hfi_send_gmu_init(gmu, boot_state); in a6xx_hfi_start()
282 ret = a6xx_hfi_get_fw_version(gmu, NULL); in a6xx_hfi_start()
292 ret = a6xx_hfi_send_perf_table(gmu); in a6xx_hfi_start()
296 ret = a6xx_hfi_send_bw_table(gmu); in a6xx_hfi_start()
304 a6xx_hfi_send_test(gmu); in a6xx_hfi_start()
309 void a6xx_hfi_stop(struct a6xx_gmu *gmu) in a6xx_hfi_stop() argument
313 for (i = 0; i < ARRAY_SIZE(gmu->queues); i++) { in a6xx_hfi_stop()
314 struct a6xx_hfi_queue *queue = &gmu->queues[i]; in a6xx_hfi_stop()
320 DRM_DEV_ERROR(gmu->dev, "HFI queue %d is not empty\n", i); in a6xx_hfi_stop()
351 void a6xx_hfi_init(struct a6xx_gmu *gmu) in a6xx_hfi_init() argument
353 struct a6xx_gmu_bo *hfi = gmu->hfi; in a6xx_hfi_init()
364 table_size += (ARRAY_SIZE(gmu->queues) * in a6xx_hfi_init()
372 table->num_queues = ARRAY_SIZE(gmu->queues); in a6xx_hfi_init()
373 table->active_queues = ARRAY_SIZE(gmu->queues); in a6xx_hfi_init()
377 a6xx_hfi_queue_init(&gmu->queues[0], &headers[0], hfi->virt + offset, in a6xx_hfi_init()
382 a6xx_hfi_queue_init(&gmu->queues[1], &headers[1], hfi->virt + offset, in a6xx_hfi_init()