All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Xin Wang <x.wang@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <karthik.poosa@intel.com>,
	<james.xiong@intel.com>, <stuart.summers@intel.com>,
	<shuicheng.lin@intel.com>, <vinay.belgaumkar@intel.com>
Subject: Re: [PATCH 1/2] drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally
Date: Wed, 27 Aug 2025 09:29:46 -0400	[thread overview]
Message-ID: <aK8ISkkNGD4pFGgq@intel.com> (raw)
In-Reply-To: <20250827000633.1369890-2-x.wang@intel.com>

On Tue, Aug 26, 2025 at 05:06:32PM -0700, Xin Wang wrote:
> Move forcewake_get() into xe_gt_idle_enable_c6() to streamline the
> code and make it easier to use.
> 
> Suggested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Xin Wang <x.wang@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

and pushing to drm-xe-next soon

Thanks,
Rodrigo.

> ---
>  drivers/gpu/drm/xe/xe_gt_idle.c | 21 +++++++++++++--------
>  drivers/gpu/drm/xe/xe_gt_idle.h |  2 +-
>  drivers/gpu/drm/xe/xe_guc_pc.c  | 13 +------------
>  3 files changed, 15 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_idle.c b/drivers/gpu/drm/xe/xe_gt_idle.c
> index ffb210216aa9..f8950a52d0a4 100644
> --- a/drivers/gpu/drm/xe/xe_gt_idle.c
> +++ b/drivers/gpu/drm/xe/xe_gt_idle.c
> @@ -322,15 +322,11 @@ static void gt_idle_fini(void *arg)
>  {
>  	struct kobject *kobj = arg;
>  	struct xe_gt *gt = kobj_to_gt(kobj->parent);
> -	unsigned int fw_ref;
>  
>  	xe_gt_idle_disable_pg(gt);
>  
> -	if (gt_to_xe(gt)->info.skip_guc_pc) {
> -		fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> +	if (gt_to_xe(gt)->info.skip_guc_pc)
>  		xe_gt_idle_disable_c6(gt);
> -		xe_force_wake_put(gt_to_fw(gt), fw_ref);
> -	}
>  
>  	sysfs_remove_files(kobj, gt_idle_attrs);
>  	kobject_put(kobj);
> @@ -390,14 +386,23 @@ void xe_gt_idle_enable_c6(struct xe_gt *gt)
>  			RC_CTL_HW_ENABLE | RC_CTL_TO_MODE | RC_CTL_RC6_ENABLE);
>  }
>  
> -void xe_gt_idle_disable_c6(struct xe_gt *gt)
> +int xe_gt_idle_disable_c6(struct xe_gt *gt)
>  {
> +	unsigned int fw_ref;
> +
>  	xe_device_assert_mem_access(gt_to_xe(gt));
> -	xe_force_wake_assert_held(gt_to_fw(gt), XE_FW_GT);
>  
>  	if (IS_SRIOV_VF(gt_to_xe(gt)))
> -		return;
> +		return 0;
> +
> +	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> +	if (!fw_ref)
> +		return -ETIMEDOUT;
>  
>  	xe_mmio_write32(&gt->mmio, RC_CONTROL, 0);
>  	xe_mmio_write32(&gt->mmio, RC_STATE, 0);
> +
> +	xe_force_wake_put(gt_to_fw(gt), fw_ref);
> +
> +	return 0;
>  }
> diff --git a/drivers/gpu/drm/xe/xe_gt_idle.h b/drivers/gpu/drm/xe/xe_gt_idle.h
> index 591a01e181bc..9c34a155e102 100644
> --- a/drivers/gpu/drm/xe/xe_gt_idle.h
> +++ b/drivers/gpu/drm/xe/xe_gt_idle.h
> @@ -13,7 +13,7 @@ struct xe_gt;
>  
>  int xe_gt_idle_init(struct xe_gt_idle *gtidle);
>  void xe_gt_idle_enable_c6(struct xe_gt *gt);
> -void xe_gt_idle_disable_c6(struct xe_gt *gt);
> +int xe_gt_idle_disable_c6(struct xe_gt *gt);
>  void xe_gt_idle_enable_pg(struct xe_gt *gt);
>  void xe_gt_idle_disable_pg(struct xe_gt *gt);
>  int xe_gt_idle_pg_print(struct xe_gt *gt, struct drm_printer *p);
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 0f8430acd16d..88557e86d637 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -1076,7 +1076,6 @@ int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc)
>  {
>  	struct xe_device *xe = pc_to_xe(pc);
>  	struct xe_gt *gt = pc_to_gt(pc);
> -	unsigned int fw_ref;
>  	int ret = 0;
>  
>  	if (xe->info.skip_guc_pc)
> @@ -1086,17 +1085,7 @@ int xe_guc_pc_gucrc_disable(struct xe_guc_pc *pc)
>  	if (ret)
>  		return ret;
>  
> -	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)) {
> -		xe_force_wake_put(gt_to_fw(gt), fw_ref);
> -		return -ETIMEDOUT;
> -	}
> -
> -	xe_gt_idle_disable_c6(gt);
> -
> -	xe_force_wake_put(gt_to_fw(gt), fw_ref);
> -
> -	return 0;
> +	return xe_gt_idle_disable_c6(gt);
>  }
>  
>  /**
> -- 
> 2.43.0
> 

  reply	other threads:[~2025-08-27 13:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  0:06 [PATCH 0/2] Ensure GT is in C0 during resumes Xin Wang
2025-08-27  0:06 ` [PATCH 1/2] drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally Xin Wang
2025-08-27 13:29   ` Rodrigo Vivi [this message]
2025-08-27  0:06 ` [PATCH 2/2] drm/xe: Ensure GT is in C0 during resumes Xin Wang
2025-09-04 13:45   ` Poosa, Karthik
2025-08-27  0:13 ` ✓ CI.KUnit: success for Ensure GT is in C0 during resumes (rev4) Patchwork
2025-08-27  0:57 ` ✓ Xe.CI.BAT: " Patchwork
2025-08-27 11:31 ` ✗ Xe.CI.Full: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-08-25 16:57 [PATCH 0/2] Ensure GT is in C0 during resumes Xin Wang
2025-08-25 16:57 ` [PATCH 1/2] drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally Xin Wang
2025-08-25 18:15   ` Rodrigo Vivi
2025-08-25 18:28     ` Wang, X
2025-08-25 18:34       ` Vivi, Rodrigo
2025-08-22 19:53 [PATCH 0/2] Ensure GT is in C0 during resumes Xin Wang
2025-08-22 19:53 ` [PATCH 1/2] drm/xe: make xe_gt_idle_disable_c6() handle the forcewake internally Xin Wang
2025-08-22 20:13   ` Rodrigo Vivi
2025-08-22 21:26   ` Lin, Shuicheng

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=aK8ISkkNGD4pFGgq@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=james.xiong@intel.com \
    --cc=karthik.poosa@intel.com \
    --cc=shuicheng.lin@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=vinay.belgaumkar@intel.com \
    --cc=x.wang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.