Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Vinay Belgaumkar <vinay.belgaumkar@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH] drm/xe/slpc: Remove unnecessary force wakes
Date: Thu, 19 Dec 2024 09:11:30 +0530	[thread overview]
Message-ID: <8589c55c-6442-49d0-ac48-a6c56836a130@intel.com> (raw)
In-Reply-To: <20241216194119.3017792-1-vinay.belgaumkar@intel.com>



On 17-12-2024 01:11, Vinay Belgaumkar wrote:
> 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>
> ---
>   drivers/gpu/drm/xe/xe_guc_pc.c | 26 +++++++-------------------
>   1 file changed, 7 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index e8b9faeaef64..5f9828ffc19c 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -421,8 +421,8 @@ int xe_guc_pc_get_cur_freq(struct xe_guc_pc *pc, u32 *freq)
>   	 * GuC SLPC plays with cur freq request when GuCRC is enabled
>   	 * Block RC6 for a more reliable read.
>   	 */
> -	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> -	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
> +	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> +	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) {

Since you are getting forcewake for single domain.

if(!fw)
     return -ETIMEDOUT;

is sufficient.

>   		xe_force_wake_put(gt_to_fw(gt), fw_ref);
>   		return -ETIMEDOUT;
>   	}
> @@ -481,10 +481,10 @@ u32 xe_guc_pc_get_rpn_freq(struct xe_guc_pc *pc)
>    */
>   int xe_guc_pc_get_min_freq(struct xe_guc_pc *pc, u32 *freq)
>   {
> -	struct xe_gt *gt = pc_to_gt(pc);
> -	unsigned int fw_ref;
>   	int ret;
>   
> +	xe_device_assert_mem_access(pc_to_xe(pc));
> +
>   	mutex_lock(&pc->freq_lock);
>   	if (!pc->freq_ready) {
>   		/* Might be in the middle of a gt reset */
> @@ -492,24 +492,12 @@ int xe_guc_pc_get_min_freq(struct xe_guc_pc *pc, u32 *freq)
>   		goto out;
>   	}
>   
> -	/*
> -	 * GuC SLPC plays with min freq request when GuCRC is enabled
> -	 * Block RC6 for a more reliable read.
> -	 */
> -	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> -	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
> -		ret = -ETIMEDOUT;
> -		goto fw;
> -	}
> -
>   	ret = pc_action_query_task_state(pc);
>   	if (ret)
> -		goto fw;
> +		goto out;
>   
>   	*freq = pc_get_min_freq(pc);
>   
> -fw:
> -	xe_force_wake_put(gt_to_fw(gt), fw_ref);
>   out:
>   	mutex_unlock(&pc->freq_lock);
>   	return ret;
> @@ -969,8 +957,8 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
>   
>   	xe_gt_assert(gt, xe_device_uc_enabled(xe));
>   
> -	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> -	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
> +	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> +	if (!xe_force_wake_ref_has_domain(fw_ref, XE_FW_GT)) {

same as above.

With these addressed. Patch Looks good to me.
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>


>   		xe_force_wake_put(gt_to_fw(gt), fw_ref);
>   		return -ETIMEDOUT;
>   	}


      parent reply	other threads:[~2024-12-19  3:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 19:41 [PATCH] drm/xe/slpc: Remove unnecessary force wakes Vinay Belgaumkar
2024-12-16 21:27 ` ✓ CI.Patch_applied: success for " Patchwork
2024-12-16 21:27 ` ✓ CI.checkpatch: " Patchwork
2024-12-16 21:28 ` ✓ CI.KUnit: " Patchwork
2024-12-16 21:35 ` [PATCH] " Rodrigo Vivi
2024-12-16 21:46 ` ✓ CI.Build: success for " Patchwork
2024-12-16 21:49 ` ✓ CI.Hooks: " Patchwork
2024-12-16 21:50 ` ✓ CI.checksparse: " Patchwork
2024-12-17  5:38 ` ✓ CI.BAT: " Patchwork
2024-12-19  3:41 ` Ghimiray, Himal Prasad [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8589c55c-6442-49d0-ac48-a6c56836a130@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=vinay.belgaumkar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox