Lines Matching +full:render +full:- +full:max
1 // SPDX-License-Identifier: MIT
48 * including frequency management, Render-C states management, and various
61 * Render-C States:
64 * Render-C states is also a GuC PC feature that is now enabled in Xe for
93 return &pc->bo->vmap; in pc_to_maps()
124 wait = timeout_us - slept; in wait_for_pc_state()
127 return -ETIMEDOUT; in wait_for_pc_state()
132 struct xe_guc_ct *ct = &pc_to_guc(pc)->ct; in pc_action_reset()
137 xe_bo_ggtt_addr(pc->bo), in pc_action_reset()
143 drm_err(&pc_to_xe(pc)->drm, "GuC PC reset: %pe", ERR_PTR(ret)); in pc_action_reset()
150 struct xe_guc_ct *ct = &pc_to_guc(pc)->ct; in pc_action_shutdown()
155 xe_bo_ggtt_addr(pc->bo), in pc_action_shutdown()
161 drm_err(&pc_to_xe(pc)->drm, "GuC PC shutdown %pe", in pc_action_shutdown()
169 struct xe_guc_ct *ct = &pc_to_guc(pc)->ct; in pc_action_query_task_state()
174 xe_bo_ggtt_addr(pc->bo), in pc_action_query_task_state()
179 return -EAGAIN; in pc_action_query_task_state()
184 drm_err(&pc_to_xe(pc)->drm, in pc_action_query_task_state()
192 struct xe_guc_ct *ct = &pc_to_guc(pc)->ct; in pc_action_set_param()
202 return -EAGAIN; in pc_action_set_param()
206 drm_err(&pc_to_xe(pc)->drm, "GuC PC set param failed: %pe", in pc_action_set_param()
214 struct xe_guc_ct *ct = &pc_to_guc(pc)->ct; in pc_action_setup_gucrc()
223 drm_err(&pc_to_xe(pc)->drm, "GuC RC enable failed: %pe", in pc_action_setup_gucrc()
279 * Let's only check for the rpn-rp0 range. If max < min, in pc_set_min_freq()
282 if (freq < pc->rpn_freq || freq > pc->rp0_freq) in pc_set_min_freq()
283 return -EINVAL; in pc_set_min_freq()
290 freq < pc->rpe_freq); in pc_set_min_freq()
310 * Let's only check for the rpn-rp0 range. If max < min, in pc_set_max_freq()
314 if (freq < pc->rpn_freq || freq > pc->rp0_freq) in pc_set_max_freq()
315 return -EINVAL; in pc_set_max_freq()
332 pc->rpe_freq = decode_freq(REG_FIELD_GET(MTL_RPE_MASK, reg)); in mtl_update_rpe_value()
346 if (xe->info.platform == XE_PVC) in tgl_update_rpe_value()
351 pc->rpe_freq = REG_FIELD_GET(RPE_MASK, reg) * GT_FREQUENCY_MULTIPLIER; in tgl_update_rpe_value()
369 pc->rpn_freq = min(pc->rpn_freq, pc->rpe_freq); in pc_update_rp_values()
373 * xe_guc_pc_get_act_freq - Get Actual running frequency
376 * Returns: The Actual running frequency. Which might be 0 if GT is in Render-C sleep state (RC6).
403 * xe_guc_pc_get_cur_freq - Get Current requested frequency
408 * -EAGAIN if GuC PC not ready (likely in middle of a reset).
436 * xe_guc_pc_get_rp0_freq - Get the RP0 freq
443 return pc->rp0_freq; in xe_guc_pc_get_rp0_freq()
447 * xe_guc_pc_get_rpe_freq - Get the RPe freq
461 return pc->rpe_freq; in xe_guc_pc_get_rpe_freq()
465 * xe_guc_pc_get_rpn_freq - Get the RPn freq
472 return pc->rpn_freq; in xe_guc_pc_get_rpn_freq()
476 * xe_guc_pc_get_min_freq - Get the min operational frequency
481 * -EAGAIN if GuC PC not ready (likely in middle of a reset).
489 mutex_lock(&pc->freq_lock); in xe_guc_pc_get_min_freq()
490 if (!pc->freq_ready) { in xe_guc_pc_get_min_freq()
492 ret = -EAGAIN; in xe_guc_pc_get_min_freq()
513 mutex_unlock(&pc->freq_lock); in xe_guc_pc_get_min_freq()
519 * xe_guc_pc_set_min_freq - Set the minimal operational frequency
524 * -EAGAIN if GuC PC not ready (likely in middle of a reset),
525 * -EINVAL if value out of bounds.
532 mutex_lock(&pc->freq_lock); in xe_guc_pc_set_min_freq()
533 if (!pc->freq_ready) { in xe_guc_pc_set_min_freq()
535 ret = -EAGAIN; in xe_guc_pc_set_min_freq()
543 pc->user_requested_min = freq; in xe_guc_pc_set_min_freq()
546 mutex_unlock(&pc->freq_lock); in xe_guc_pc_set_min_freq()
553 * xe_guc_pc_get_max_freq - Get Maximum operational frequency
558 * -EAGAIN if GuC PC not ready (likely in middle of a reset).
565 mutex_lock(&pc->freq_lock); in xe_guc_pc_get_max_freq()
566 if (!pc->freq_ready) { in xe_guc_pc_get_max_freq()
568 ret = -EAGAIN; in xe_guc_pc_get_max_freq()
579 mutex_unlock(&pc->freq_lock); in xe_guc_pc_get_max_freq()
585 * xe_guc_pc_set_max_freq - Set the maximum operational frequency
590 * -EAGAIN if GuC PC not ready (likely in middle of a reset),
591 * -EINVAL if value out of bounds.
598 mutex_lock(&pc->freq_lock); in xe_guc_pc_set_max_freq()
599 if (!pc->freq_ready) { in xe_guc_pc_set_max_freq()
601 ret = -EAGAIN; in xe_guc_pc_set_max_freq()
609 pc->user_requested_max = freq; in xe_guc_pc_set_max_freq()
612 mutex_unlock(&pc->freq_lock); in xe_guc_pc_set_max_freq()
618 * xe_guc_pc_c_status - get the current GT C state
649 * xe_guc_pc_rc6_residency - rc6 residency counter
665 * xe_guc_pc_mc6_residency - mc6 residency counter
692 pc->rp0_freq = decode_freq(REG_FIELD_GET(MTL_RP0_CAP_MASK, reg)); in mtl_init_fused_rp_values()
694 pc->rpn_freq = decode_freq(REG_FIELD_GET(MTL_RPN_CAP_MASK, reg)); in mtl_init_fused_rp_values()
705 if (xe->info.platform == XE_PVC) in tgl_init_fused_rp_values()
709 pc->rp0_freq = REG_FIELD_GET(RP0_MASK, reg) * GT_FREQUENCY_MULTIPLIER; in tgl_init_fused_rp_values()
710 pc->rpn_freq = REG_FIELD_GET(RPN_MASK, reg) * GT_FREQUENCY_MULTIPLIER; in tgl_init_fused_rp_values()
725 * xe_guc_pc_init_early - Initialize RPx values and request a higher GT
735 pc_set_cur_freq(pc, pc->rp0_freq); in xe_guc_pc_init_early()
742 lockdep_assert_held(&pc->freq_lock); in pc_adjust_freq_bounds()
753 if (pc_get_max_freq(pc) > pc->rp0_freq) in pc_adjust_freq_bounds()
754 pc_set_max_freq(pc, pc->rp0_freq); in pc_adjust_freq_bounds()
760 if (pc_get_min_freq(pc) > pc->rp0_freq) in pc_adjust_freq_bounds()
761 pc_set_min_freq(pc, pc->rp0_freq); in pc_adjust_freq_bounds()
770 lockdep_assert_held(&pc->freq_lock); in pc_adjust_requested_freq()
772 if (pc->user_requested_min != 0) { in pc_adjust_requested_freq()
773 ret = pc_set_min_freq(pc, pc->user_requested_min); in pc_adjust_requested_freq()
778 if (pc->user_requested_max != 0) { in pc_adjust_requested_freq()
779 ret = pc_set_max_freq(pc, pc->user_requested_max); in pc_adjust_requested_freq()
788 * xe_guc_pc_gucrc_disable - Disable GuC RC
801 if (xe->info.skip_guc_pc) in xe_guc_pc_gucrc_disable()
825 u32 min = DIV_ROUND_CLOSEST(pc->rpn_freq, GT_FREQUENCY_MULTIPLIER); in pc_init_pcode_freq()
826 u32 max = DIV_ROUND_CLOSEST(pc->rp0_freq, GT_FREQUENCY_MULTIPLIER); in pc_init_pcode_freq() local
828 XE_WARN_ON(xe_pcode_init_min_freq_table(pc_to_gt(pc), min, max)); in pc_init_pcode_freq()
835 mutex_lock(&pc->freq_lock); in pc_init_freqs()
853 pc->freq_ready = true; in pc_init_freqs()
856 mutex_unlock(&pc->freq_lock); in pc_init_freqs()
861 * xe_guc_pc_start - Start GuC's Power Conservation component
879 if (xe->info.skip_guc_pc) { in xe_guc_pc_start()
880 if (xe->info.platform != XE_PVC) in xe_guc_pc_start()
883 /* Request max possible since dynamic freq mgmt is not enabled */ in xe_guc_pc_start()
890 memset(pc->bo->vmap.vaddr, 0, size); in xe_guc_pc_start()
898 drm_err(&pc_to_xe(pc)->drm, "GuC PC Start failed\n"); in xe_guc_pc_start()
899 ret = -EIO; in xe_guc_pc_start()
907 if (xe->info.platform == XE_PVC) { in xe_guc_pc_start()
923 * xe_guc_pc_stop - Stop GuC's Power Conservation component
933 if (xe->info.skip_guc_pc) { in xe_guc_pc_stop()
939 mutex_lock(&pc->freq_lock); in xe_guc_pc_stop()
940 pc->freq_ready = false; in xe_guc_pc_stop()
941 mutex_unlock(&pc->freq_lock); in xe_guc_pc_stop()
948 drm_err(&pc_to_xe(pc)->drm, "GuC PC Shutdown failed\n"); in xe_guc_pc_stop()
949 ret = -EIO; in xe_guc_pc_stop()
958 * xe_guc_pc_fini - Finalize GuC's Power Conservation component
965 if (xe->info.skip_guc_pc) { in xe_guc_pc_fini()
974 mutex_destroy(&pc->freq_lock); in xe_guc_pc_fini()
978 * xe_guc_pc_init - Initialize GuC's Power Conservation component
989 if (xe->info.skip_guc_pc) in xe_guc_pc_init()
992 mutex_init(&pc->freq_lock); in xe_guc_pc_init()
1000 pc->bo = bo; in xe_guc_pc_init()