Lines Matching full:gmu

28 static int a6xx_hfi_queue_read(struct a6xx_gmu *gmu,  in a6xx_hfi_queue_read()  argument
44 * If we are to assume that the GMU firmware is in fact a rational actor in a6xx_hfi_queue_read()
59 if (!gmu->legacy) in a6xx_hfi_queue_read()
66 static int a6xx_hfi_queue_write(struct a6xx_gmu *gmu, in a6xx_hfi_queue_write() argument
90 if (!gmu->legacy) { in a6xx_hfi_queue_write()
98 gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, 0x01); in a6xx_hfi_queue_write()
102 static int a6xx_hfi_wait_for_ack(struct a6xx_gmu *gmu, u32 id, u32 seqnum, in a6xx_hfi_wait_for_ack() argument
105 struct a6xx_hfi_queue *queue = &gmu->queues[HFI_RESPONSE_QUEUE]; in a6xx_hfi_wait_for_ack()
110 ret = gmu_poll_timeout(gmu, REG_A6XX_GMU_GMU2HOST_INTR_INFO, val, in a6xx_hfi_wait_for_ack()
114 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
121 gmu_write(gmu, REG_A6XX_GMU_GMU2HOST_INTR_CLR, in a6xx_hfi_wait_for_ack()
128 ret = a6xx_hfi_queue_read(gmu, queue, (u32 *) &resp, in a6xx_hfi_wait_for_ack()
133 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
143 DRM_DEV_ERROR(gmu->dev, "GMU firmware error %d\n", in a6xx_hfi_wait_for_ack()
149 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
156 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
171 static int a6xx_hfi_send_msg(struct a6xx_gmu *gmu, int id, in a6xx_hfi_send_msg() argument
174 struct a6xx_hfi_queue *queue = &gmu->queues[HFI_COMMAND_QUEUE]; in a6xx_hfi_send_msg()
184 ret = a6xx_hfi_queue_write(gmu, queue, data, dwords); in a6xx_hfi_send_msg()
186 DRM_DEV_ERROR(gmu->dev, "Unable to send message %s id %d\n", in a6xx_hfi_send_msg()
191 return a6xx_hfi_wait_for_ack(gmu, id, seqnum, payload, payload_size); in a6xx_hfi_send_msg()
194 static int a6xx_hfi_send_gmu_init(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_send_gmu_init() argument
198 msg.dbg_buffer_addr = (u32) gmu->debug.iova; in a6xx_hfi_send_gmu_init()
199 msg.dbg_buffer_size = (u32) gmu->debug.size; in a6xx_hfi_send_gmu_init()
202 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_INIT, &msg, sizeof(msg), in a6xx_hfi_send_gmu_init()
206 static int a6xx_hfi_get_fw_version(struct a6xx_gmu *gmu, u32 *version) in a6xx_hfi_get_fw_version() argument
213 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_FW_VERSION, &msg, sizeof(msg), in a6xx_hfi_get_fw_version()
217 static int a6xx_hfi_send_perf_table_v1(struct a6xx_gmu *gmu) in a6xx_hfi_send_perf_table_v1() argument
222 msg.num_gpu_levels = gmu->nr_gpu_freqs; in a6xx_hfi_send_perf_table_v1()
223 msg.num_gmu_levels = gmu->nr_gmu_freqs; in a6xx_hfi_send_perf_table_v1()
225 for (i = 0; i < gmu->nr_gpu_freqs; i++) { in a6xx_hfi_send_perf_table_v1()
226 msg.gx_votes[i].vote = gmu->gx_arc_votes[i]; in a6xx_hfi_send_perf_table_v1()
227 msg.gx_votes[i].freq = gmu->gpu_freqs[i] / 1000; in a6xx_hfi_send_perf_table_v1()
230 for (i = 0; i < gmu->nr_gmu_freqs; i++) { in a6xx_hfi_send_perf_table_v1()
231 msg.cx_votes[i].vote = gmu->cx_arc_votes[i]; in a6xx_hfi_send_perf_table_v1()
232 msg.cx_votes[i].freq = gmu->gmu_freqs[i] / 1000; in a6xx_hfi_send_perf_table_v1()
235 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_PERF_TABLE, &msg, sizeof(msg), in a6xx_hfi_send_perf_table_v1()
239 static int a6xx_hfi_send_perf_table(struct a6xx_gmu *gmu) in a6xx_hfi_send_perf_table() argument
244 msg.num_gpu_levels = gmu->nr_gpu_freqs; in a6xx_hfi_send_perf_table()
245 msg.num_gmu_levels = gmu->nr_gmu_freqs; in a6xx_hfi_send_perf_table()
247 for (i = 0; i < gmu->nr_gpu_freqs; i++) { in a6xx_hfi_send_perf_table()
248 msg.gx_votes[i].vote = gmu->gx_arc_votes[i]; in a6xx_hfi_send_perf_table()
250 msg.gx_votes[i].freq = gmu->gpu_freqs[i] / 1000; in a6xx_hfi_send_perf_table()
253 for (i = 0; i < gmu->nr_gmu_freqs; i++) { in a6xx_hfi_send_perf_table()
254 msg.cx_votes[i].vote = gmu->cx_arc_votes[i]; in a6xx_hfi_send_perf_table()
255 msg.cx_votes[i].freq = gmu->gmu_freqs[i] / 1000; in a6xx_hfi_send_perf_table()
258 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_PERF_TABLE, &msg, sizeof(msg), in a6xx_hfi_send_perf_table()
264 /* Send a single "off" entry since the 618 GMU doesn't do bus scaling */ in a618_build_bw_table()
279 * These are the CX (CNOC) votes - these are used by the GMU but the in a618_build_bw_table()
369 * These are the CX (CNOC) votes - these are used by the GMU but the in a640_build_bw_table()
408 * These are the CX (CNOC) votes - these are used by the GMU but the in a650_build_bw_table()
439 * These are the CX (CNOC) votes - these are used by the GMU but the in a690_build_bw_table()
470 * These are the CX (CNOC) votes - these are used by the GMU but the in a660_build_bw_table()
501 * These are the CX (CNOC) votes - these are used by the GMU but the in adreno_7c3_build_bw_table()
595 /* Send a single "off" entry since the 630 GMU doesn't do bus scaling */ in a6xx_build_bw_table()
611 * sdm845 GMU are known and fixed so we can hard code them. in a6xx_build_bw_table()
631 static int a6xx_hfi_send_bw_table(struct a6xx_gmu *gmu) in a6xx_hfi_send_bw_table() argument
634 struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu); in a6xx_hfi_send_bw_table()
658 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_BW_TABLE, &msg, sizeof(msg), in a6xx_hfi_send_bw_table()
662 static int a6xx_hfi_send_test(struct a6xx_gmu *gmu) in a6xx_hfi_send_test() argument
666 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_TEST, &msg, sizeof(msg), in a6xx_hfi_send_test()
670 static int a6xx_hfi_send_start(struct a6xx_gmu *gmu) in a6xx_hfi_send_start() argument
674 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_START, &msg, sizeof(msg), in a6xx_hfi_send_start()
678 static int a6xx_hfi_send_core_fw_start(struct a6xx_gmu *gmu) in a6xx_hfi_send_core_fw_start() argument
682 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_CORE_FW_START, &msg, in a6xx_hfi_send_core_fw_start()
686 int a6xx_hfi_set_freq(struct a6xx_gmu *gmu, int index) in a6xx_hfi_set_freq() argument
694 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_GX_BW_PERF_VOTE, &msg, in a6xx_hfi_set_freq()
698 int a6xx_hfi_send_prep_slumber(struct a6xx_gmu *gmu) in a6xx_hfi_send_prep_slumber() argument
704 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_PREPARE_SLUMBER, &msg, in a6xx_hfi_send_prep_slumber()
708 static int a6xx_hfi_start_v1(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_start_v1() argument
712 ret = a6xx_hfi_send_gmu_init(gmu, boot_state); in a6xx_hfi_start_v1()
716 ret = a6xx_hfi_get_fw_version(gmu, NULL); in a6xx_hfi_start_v1()
723 * the GMU firmware in a6xx_hfi_start_v1()
726 ret = a6xx_hfi_send_perf_table_v1(gmu); in a6xx_hfi_start_v1()
730 ret = a6xx_hfi_send_bw_table(gmu); in a6xx_hfi_start_v1()
735 * Let the GMU know that there won't be any more HFI messages until next in a6xx_hfi_start_v1()
738 a6xx_hfi_send_test(gmu); in a6xx_hfi_start_v1()
743 int a6xx_hfi_start(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_start() argument
747 if (gmu->legacy) in a6xx_hfi_start()
748 return a6xx_hfi_start_v1(gmu, boot_state); in a6xx_hfi_start()
751 ret = a6xx_hfi_send_perf_table(gmu); in a6xx_hfi_start()
755 ret = a6xx_hfi_send_bw_table(gmu); in a6xx_hfi_start()
759 ret = a6xx_hfi_send_core_fw_start(gmu); in a6xx_hfi_start()
767 ret = a6xx_hfi_send_start(gmu); in a6xx_hfi_start()
774 void a6xx_hfi_stop(struct a6xx_gmu *gmu) in a6xx_hfi_stop() argument
778 for (i = 0; i < ARRAY_SIZE(gmu->queues); i++) { in a6xx_hfi_stop()
779 struct a6xx_hfi_queue *queue = &gmu->queues[i]; in a6xx_hfi_stop()
785 DRM_DEV_ERROR(gmu->dev, "HFI queue %d is not empty\n", i); in a6xx_hfi_stop()
822 void a6xx_hfi_init(struct a6xx_gmu *gmu) in a6xx_hfi_init() argument
824 struct a6xx_gmu_bo *hfi = &gmu->hfi; in a6xx_hfi_init()
835 table_size += (ARRAY_SIZE(gmu->queues) * in a6xx_hfi_init()
843 table->num_queues = ARRAY_SIZE(gmu->queues); in a6xx_hfi_init()
844 table->active_queues = ARRAY_SIZE(gmu->queues); in a6xx_hfi_init()
848 a6xx_hfi_queue_init(&gmu->queues[0], &headers[0], hfi->virt + offset, in a6xx_hfi_init()
851 /* GMU response queue */ in a6xx_hfi_init()
853 a6xx_hfi_queue_init(&gmu->queues[1], &headers[1], hfi->virt + offset, in a6xx_hfi_init()
854 hfi->iova + offset, gmu->legacy ? 4 : 1); in a6xx_hfi_init()