Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <rodrigo.vivi@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241216194119.3017792-1-vinay.belgaumkar@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Vinay Belgaumkar and committed by
Rodrigo Vivi
3259ff4e c6aac2fa

+7 -19
+7 -19
drivers/gpu/drm/xe/xe_guc_pc.c
··· 457 457 * GuC SLPC plays with cur freq request when GuCRC is enabled 458 458 * Block RC6 for a more reliable read. 459 459 */ 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)) { 462 462 xe_force_wake_put(gt_to_fw(gt), fw_ref); 463 463 return -ETIMEDOUT; 464 464 } ··· 530 530 */ 531 531 int xe_guc_pc_get_min_freq(struct xe_guc_pc *pc, u32 *freq) 532 532 { 533 - struct xe_gt *gt = pc_to_gt(pc); 534 - unsigned int fw_ref; 535 533 int ret; 534 + 535 + xe_device_assert_mem_access(pc_to_xe(pc)); 536 536 537 537 mutex_lock(&pc->freq_lock); 538 538 if (!pc->freq_ready) { ··· 541 541 goto out; 542 542 } 543 543 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 - 554 544 ret = pc_action_query_task_state(pc); 555 545 if (ret) 556 - goto fw; 546 + goto out; 557 547 558 548 *freq = pc_get_min_freq(pc); 559 549 560 - fw: 561 - xe_force_wake_put(gt_to_fw(gt), fw_ref); 562 550 out: 563 551 mutex_unlock(&pc->freq_lock); 564 552 return ret; ··· 1006 1018 1007 1019 xe_gt_assert(gt, xe_device_uc_enabled(xe)); 1008 1020 1009 - fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL); 1010 - if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) { 1021 + fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); 1022 + if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) { 1011 1023 xe_force_wake_put(gt_to_fw(gt), fw_ref); 1012 1024 return -ETIMEDOUT; 1013 1025 }