Lines Matching full:gmu
29 static int a6xx_hfi_queue_read(struct a6xx_gmu *gmu, in a6xx_hfi_queue_read() argument
45 * If we are to assume that the GMU firmware is in fact a rational actor in a6xx_hfi_queue_read()
60 if (!gmu->legacy) in a6xx_hfi_queue_read()
67 static int a6xx_hfi_queue_write(struct a6xx_gmu *gmu, in a6xx_hfi_queue_write() argument
91 if (!gmu->legacy) { in a6xx_hfi_queue_write()
99 gmu_write(gmu, REG_A6XX_GMU_HOST2GMU_INTR_SET, 0x01); in a6xx_hfi_queue_write()
103 static int a6xx_hfi_wait_for_ack(struct a6xx_gmu *gmu, u32 id, u32 seqnum, in a6xx_hfi_wait_for_ack() argument
106 struct a6xx_hfi_queue *queue = &gmu->queues[HFI_RESPONSE_QUEUE]; in a6xx_hfi_wait_for_ack()
111 ret = gmu_poll_timeout(gmu, REG_A6XX_GMU_GMU2HOST_INTR_INFO, val, in a6xx_hfi_wait_for_ack()
115 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
122 gmu_write(gmu, REG_A6XX_GMU_GMU2HOST_INTR_CLR, in a6xx_hfi_wait_for_ack()
129 ret = a6xx_hfi_queue_read(gmu, queue, (u32 *) &resp, in a6xx_hfi_wait_for_ack()
134 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
144 DRM_DEV_ERROR(gmu->dev, "GMU firmware error %d\n", in a6xx_hfi_wait_for_ack()
150 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
157 DRM_DEV_ERROR(gmu->dev, in a6xx_hfi_wait_for_ack()
172 static int a6xx_hfi_send_msg(struct a6xx_gmu *gmu, int id, in a6xx_hfi_send_msg() argument
175 struct a6xx_hfi_queue *queue = &gmu->queues[HFI_COMMAND_QUEUE]; in a6xx_hfi_send_msg()
185 ret = a6xx_hfi_queue_write(gmu, queue, data, dwords); in a6xx_hfi_send_msg()
187 DRM_DEV_ERROR(gmu->dev, "Unable to send message %s id %d\n", in a6xx_hfi_send_msg()
192 return a6xx_hfi_wait_for_ack(gmu, id, seqnum, payload, payload_size); in a6xx_hfi_send_msg()
195 static int a6xx_hfi_send_gmu_init(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_send_gmu_init() argument
199 msg.dbg_buffer_addr = (u32) gmu->debug.iova; in a6xx_hfi_send_gmu_init()
200 msg.dbg_buffer_size = (u32) gmu->debug.size; in a6xx_hfi_send_gmu_init()
203 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_INIT, &msg, sizeof(msg), in a6xx_hfi_send_gmu_init()
207 static int a6xx_hfi_get_fw_version(struct a6xx_gmu *gmu, u32 *version) in a6xx_hfi_get_fw_version() argument
214 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_FW_VERSION, &msg, sizeof(msg), in a6xx_hfi_get_fw_version()
218 static int a6xx_hfi_send_perf_table_v1(struct a6xx_gmu *gmu) in a6xx_hfi_send_perf_table_v1() argument
223 msg.num_gpu_levels = gmu->nr_gpu_freqs; in a6xx_hfi_send_perf_table_v1()
224 msg.num_gmu_levels = gmu->nr_gmu_freqs; in a6xx_hfi_send_perf_table_v1()
226 for (i = 0; i < gmu->nr_gpu_freqs; i++) { in a6xx_hfi_send_perf_table_v1()
227 msg.gx_votes[i].vote = gmu->gx_arc_votes[i]; in a6xx_hfi_send_perf_table_v1()
228 msg.gx_votes[i].freq = gmu->gpu_freqs[i] / 1000; in a6xx_hfi_send_perf_table_v1()
231 for (i = 0; i < gmu->nr_gmu_freqs; i++) { in a6xx_hfi_send_perf_table_v1()
232 msg.cx_votes[i].vote = gmu->cx_arc_votes[i]; in a6xx_hfi_send_perf_table_v1()
233 msg.cx_votes[i].freq = gmu->gmu_freqs[i] / 1000; in a6xx_hfi_send_perf_table_v1()
236 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_PERF_TABLE, &msg, sizeof(msg), in a6xx_hfi_send_perf_table_v1()
240 static int a6xx_hfi_send_perf_table(struct a6xx_gmu *gmu) in a6xx_hfi_send_perf_table() argument
245 msg.num_gpu_levels = gmu->nr_gpu_freqs; in a6xx_hfi_send_perf_table()
246 msg.num_gmu_levels = gmu->nr_gmu_freqs; in a6xx_hfi_send_perf_table()
248 for (i = 0; i < gmu->nr_gpu_freqs; i++) { in a6xx_hfi_send_perf_table()
249 msg.gx_votes[i].vote = gmu->gx_arc_votes[i]; in a6xx_hfi_send_perf_table()
251 msg.gx_votes[i].freq = gmu->gpu_freqs[i] / 1000; in a6xx_hfi_send_perf_table()
254 for (i = 0; i < gmu->nr_gmu_freqs; i++) { in a6xx_hfi_send_perf_table()
255 msg.cx_votes[i].vote = gmu->cx_arc_votes[i]; in a6xx_hfi_send_perf_table()
256 msg.cx_votes[i].freq = gmu->gmu_freqs[i] / 1000; in a6xx_hfi_send_perf_table()
259 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_PERF_TABLE, &msg, sizeof(msg), in a6xx_hfi_send_perf_table()
263 static void a6xx_generate_bw_table(const struct a6xx_info *info, struct a6xx_gmu *gmu, in a6xx_generate_bw_table() argument
275 for (i = 0; i < gmu->nr_gpu_bws; ++i) in a6xx_generate_bw_table()
277 msg->ddr_cmds_data[i][j] = gmu->gpu_ib_votes[i][j]; in a6xx_generate_bw_table()
278 msg->bw_level_num = gmu->nr_gpu_bws; in a6xx_generate_bw_table()
287 * These are the CX (CNOC) votes - these are used by the GMU in a6xx_generate_bw_table()
307 /* Send a single "off" entry since the 618 GMU doesn't do bus scaling */ in a618_build_bw_table()
322 * These are the CX (CNOC) votes - these are used by the GMU but the in a618_build_bw_table()
412 * These are the CX (CNOC) votes - these are used by the GMU but the in a640_build_bw_table()
451 * These are the CX (CNOC) votes - these are used by the GMU but the in a650_build_bw_table()
482 * These are the CX (CNOC) votes - these are used by the GMU but the in a690_build_bw_table()
513 * These are the CX (CNOC) votes - these are used by the GMU but the in a660_build_bw_table()
544 * These are the CX (CNOC) votes - these are used by the GMU but the in a663_build_bw_table()
575 * These are the CX (CNOC) votes - these are used by the GMU but the in adreno_7c3_build_bw_table()
669 /* Send a single "off" entry since the 630 GMU doesn't do bus scaling */ in a6xx_build_bw_table()
685 * sdm845 GMU are known and fixed so we can hard code them. in a6xx_build_bw_table()
705 static int a6xx_hfi_send_bw_table(struct a6xx_gmu *gmu) in a6xx_hfi_send_bw_table() argument
708 struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu); in a6xx_hfi_send_bw_table()
712 if (gmu->bw_table) in a6xx_hfi_send_bw_table()
715 msg = devm_kzalloc(gmu->dev, sizeof(*msg), GFP_KERNEL); in a6xx_hfi_send_bw_table()
719 if (info->bcms && gmu->nr_gpu_bws > 1) in a6xx_hfi_send_bw_table()
720 a6xx_generate_bw_table(info, gmu, msg); in a6xx_hfi_send_bw_table()
744 gmu->bw_table = msg; in a6xx_hfi_send_bw_table()
747 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_BW_TABLE, gmu->bw_table, sizeof(*(gmu->bw_table)), in a6xx_hfi_send_bw_table()
751 static int a6xx_hfi_send_test(struct a6xx_gmu *gmu) in a6xx_hfi_send_test() argument
755 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_TEST, &msg, sizeof(msg), in a6xx_hfi_send_test()
759 static int a6xx_hfi_send_start(struct a6xx_gmu *gmu) in a6xx_hfi_send_start() argument
763 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_START, &msg, sizeof(msg), in a6xx_hfi_send_start()
767 static int a6xx_hfi_send_core_fw_start(struct a6xx_gmu *gmu) in a6xx_hfi_send_core_fw_start() argument
771 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_CORE_FW_START, &msg, in a6xx_hfi_send_core_fw_start()
775 int a6xx_hfi_set_freq(struct a6xx_gmu *gmu, u32 freq_index, u32 bw_index) in a6xx_hfi_set_freq() argument
783 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_GX_BW_PERF_VOTE, &msg, in a6xx_hfi_set_freq()
787 int a6xx_hfi_send_prep_slumber(struct a6xx_gmu *gmu) in a6xx_hfi_send_prep_slumber() argument
793 return a6xx_hfi_send_msg(gmu, HFI_H2F_MSG_PREPARE_SLUMBER, &msg, in a6xx_hfi_send_prep_slumber()
797 static int a6xx_hfi_start_v1(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_start_v1() argument
801 ret = a6xx_hfi_send_gmu_init(gmu, boot_state); in a6xx_hfi_start_v1()
805 ret = a6xx_hfi_get_fw_version(gmu, NULL); in a6xx_hfi_start_v1()
812 * the GMU firmware in a6xx_hfi_start_v1()
815 ret = a6xx_hfi_send_perf_table_v1(gmu); in a6xx_hfi_start_v1()
819 ret = a6xx_hfi_send_bw_table(gmu); in a6xx_hfi_start_v1()
824 * Let the GMU know that there won't be any more HFI messages until next in a6xx_hfi_start_v1()
827 a6xx_hfi_send_test(gmu); in a6xx_hfi_start_v1()
832 int a6xx_hfi_start(struct a6xx_gmu *gmu, int boot_state) in a6xx_hfi_start() argument
836 if (gmu->legacy) in a6xx_hfi_start()
837 return a6xx_hfi_start_v1(gmu, boot_state); in a6xx_hfi_start()
840 ret = a6xx_hfi_send_perf_table(gmu); in a6xx_hfi_start()
844 ret = a6xx_hfi_send_bw_table(gmu); in a6xx_hfi_start()
848 ret = a6xx_hfi_send_core_fw_start(gmu); in a6xx_hfi_start()
856 ret = a6xx_hfi_send_start(gmu); in a6xx_hfi_start()
863 void a6xx_hfi_stop(struct a6xx_gmu *gmu) in a6xx_hfi_stop() argument
867 for (i = 0; i < ARRAY_SIZE(gmu->queues); i++) { in a6xx_hfi_stop()
868 struct a6xx_hfi_queue *queue = &gmu->queues[i]; in a6xx_hfi_stop()
874 DRM_DEV_ERROR(gmu->dev, "HFI queue %d is not empty\n", i); in a6xx_hfi_stop()
911 void a6xx_hfi_init(struct a6xx_gmu *gmu) in a6xx_hfi_init() argument
913 struct a6xx_gmu_bo *hfi = &gmu->hfi; in a6xx_hfi_init()
924 table_size += (ARRAY_SIZE(gmu->queues) * in a6xx_hfi_init()
932 table->num_queues = ARRAY_SIZE(gmu->queues); in a6xx_hfi_init()
933 table->active_queues = ARRAY_SIZE(gmu->queues); in a6xx_hfi_init()
937 a6xx_hfi_queue_init(&gmu->queues[0], &headers[0], hfi->virt + offset, in a6xx_hfi_init()
940 /* GMU response queue */ in a6xx_hfi_init()
942 a6xx_hfi_queue_init(&gmu->queues[1], &headers[1], hfi->virt + offset, in a6xx_hfi_init()
943 hfi->iova + offset, gmu->legacy ? 4 : 1); in a6xx_hfi_init()