Skip to content

Commit 3259ff4

Browse files
vsbelgaumrodrigovivi
authored andcommitted
drm/xe/slpc: Remove unnecessary force wakes
FORCEWAKE_ALL is not needed when we are trying to read the cur_freq, we just need to wake up the GT domain. We also do not need a force wake to for a H2G query to obtain min frequency. Cc: Rodrigo Vivi <[email protected]> Signed-off-by: Vinay Belgaumkar <[email protected]> Reviewed-by: Rodrigo Vivi <[email protected]> Reviewed-by: Himal Prasad Ghimiray <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent c6aac2f commit 3259ff4

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

drivers/gpu/drm/xe/xe_guc_pc.c

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@ int xe_guc_pc_get_cur_freq(struct xe_guc_pc *pc, u32 *freq)
457457
* GuC SLPC plays with cur freq request when GuCRC is enabled
458458
* Block RC6 for a more reliable read.
459459
*/
460-
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
461-
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
460+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
461+
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) {
462462
xe_force_wake_put(gt_to_fw(gt), fw_ref);
463463
return -ETIMEDOUT;
464464
}
@@ -530,35 +530,23 @@ u32 xe_guc_pc_get_rpn_freq(struct xe_guc_pc *pc)
530530
*/
531531
int xe_guc_pc_get_min_freq(struct xe_guc_pc *pc, u32 *freq)
532532
{
533-
struct xe_gt *gt = pc_to_gt(pc);
534-
unsigned int fw_ref;
535533
int ret;
536534

535+
xe_device_assert_mem_access(pc_to_xe(pc));
536+
537537
mutex_lock(&pc->freq_lock);
538538
if (!pc->freq_ready) {
539539
/* Might be in the middle of a gt reset */
540540
ret = -EAGAIN;
541541
goto out;
542542
}
543543

544-
/*
545-
* GuC SLPC plays with min freq request when GuCRC is enabled
546-
* Block RC6 for a more reliable read.
547-
*/
548-
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
549-
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
550-
ret = -ETIMEDOUT;
551-
goto fw;
552-
}
553-
554544
ret = pc_action_query_task_state(pc);
555545
if (ret)
556-
goto fw;
546+
goto out;
557547

558548
*freq = pc_get_min_freq(pc);
559549

560-
fw:
561-
xe_force_wake_put(gt_to_fw(gt), fw_ref);
562550
out:
563551
mutex_unlock(&pc->freq_lock);
564552
return ret;
@@ -1018,8 +1006,8 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
10181006

10191007
xe_gt_assert(gt, xe_device_uc_enabled(xe));
10201008

1021-
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
1022-
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
1009+
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
1010+
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) {
10231011
xe_force_wake_put(gt_to_fw(gt), fw_ref);
10241012
return -ETIMEDOUT;
10251013
}

0 commit comments

Comments
 (0)