Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nilawar, Badal" <badal.nilawar@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: Jani Nikula <jani.nikula@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v9 06/26] drm/xe/device: Update handling of xe_force_wake_get return
Date: Tue, 15 Oct 2024 20:05:21 +0530	[thread overview]
Message-ID: <56278e87-01d7-4d2f-bb90-35ba436a3f24@intel.com> (raw)
In-Reply-To: <20241014075601.2324382-7-himal.prasad.ghimiray@intel.com>



On 14-10-2024 13:25, Himal Prasad Ghimiray wrote:
> xe_force_wake_get() now returns the reference count-incremented domain
> mask. If it fails for individual domains, the return value will always
> be 0. However, for XE_FORCEWAKE_ALL, it may return a non-zero value even
> in the event of failure. Update the return handling of xe_force_wake_get()
> to reflect this behavior, and ensure that the return value is passed as
> input to xe_force_wake_put().
> 
> v3
> - return xe_wakeref_t instead of int in xe_force_wake_get()
> - xe_force_wake_put() error doesn't need to be escalated/considered as
> probing error. It internally WARNS on domain ack failure.
> 
> v5
> - return unsigned int xe_force_wake_get()
> 
> v7
> - Fix commit message(Badal)
> 
> v9
> - s/uint/unsigned int (Nikula)
> 
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Badal Nilawar <badal.nilawar@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_device.c | 25 ++++++++++++++-----------
>   1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 962751c966d1..16b10bbccc6b 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -604,8 +604,8 @@ int xe_device_probe_early(struct xe_device *xe)
>   static int probe_has_flat_ccs(struct xe_device *xe)
>   {
>   	struct xe_gt *gt;
> +	unsigned int fw_ref;
>   	u32 reg;
> -	int err;
>   
>   	/* Always enabled/disabled, no runtime check to do */
>   	if (GRAPHICS_VER(xe) < 20 || !xe->info.has_flat_ccs)
> @@ -613,9 +613,9 @@ static int probe_has_flat_ccs(struct xe_device *xe)
>   
>   	gt = xe_root_mmio_gt(xe);
>   
> -	err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> -	if (err)
> -		return err;
> +	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> +	if (!fw_ref)
> +		return -ETIMEDOUT;
>   
>   	reg = xe_gt_mcr_unicast_read_any(gt, XE2_FLAT_CCS_BASE_RANGE_LOWER);
>   	xe->info.has_flat_ccs = (reg & XE2_FLAT_CCS_ENABLE);
> @@ -624,7 +624,8 @@ static int probe_has_flat_ccs(struct xe_device *xe)
>   		drm_dbg(&xe->drm,
>   			"Flat CCS has been disabled in bios, May lead to performance impact");
>   
> -	return xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
> +	xe_force_wake_put(gt_to_fw(gt), fw_ref);
> +	return 0;
>   }
>   
>   int xe_device_probe(struct xe_device *xe)
> @@ -875,6 +876,7 @@ void xe_device_wmb(struct xe_device *xe)
>   void xe_device_td_flush(struct xe_device *xe)
>   {
>   	struct xe_gt *gt;
> +	unsigned int fw_ref;
>   	u8 id;
>   
>   	if (!IS_DGFX(xe) || GRAPHICS_VER(xe) < 20)
> @@ -889,7 +891,8 @@ void xe_device_td_flush(struct xe_device *xe)
>   		if (xe_gt_is_media_type(gt))
>   			continue;
>   
> -		if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GT))
> +		fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> +		if (!fw_ref)
>   			return;
>   
>   		xe_mmio_write32(&gt->mmio, XE2_TDF_CTRL, TRANSIENT_FLUSH_REQUEST);
> @@ -904,22 +907,22 @@ void xe_device_td_flush(struct xe_device *xe)
>   				   150, NULL, false))
>   			xe_gt_err_once(gt, "TD flush timeout\n");
>   
> -		xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
> +		xe_force_wake_put(gt_to_fw(gt), fw_ref);
>   	}
>   }
>   
>   void xe_device_l2_flush(struct xe_device *xe)
>   {
>   	struct xe_gt *gt;
> -	int err;
> +	unsigned int fw_ref;
>   
>   	gt = xe_root_mmio_gt(xe);
>   
>   	if (!XE_WA(gt, 16023588340))
>   		return;
>   
> -	err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> -	if (err)
> +	fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
> +	if (!fw_ref)
>   		return;
>   
>   	spin_lock(&gt->global_invl_lock);
> @@ -929,7 +932,7 @@ void xe_device_l2_flush(struct xe_device *xe)
>   		xe_gt_err_once(gt, "Global invalidation timeout\n");
>   	spin_unlock(&gt->global_invl_lock);
>   
> -	xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
> +	xe_force_wake_put(gt_to_fw(gt), fw_ref);
>   }

LGTM.
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>

>   
>   u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size)


  parent reply	other threads:[~2024-10-15 14:35 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14  7:55 [PATCH v9 00/26] Fix xe_force_wake_get() failure handling Himal Prasad Ghimiray
2024-10-14  7:44 ` ✓ CI.Patch_applied: success for Fix xe_force_wake_get() failure handling (rev10) Patchwork
2024-10-14  7:44 ` ✓ CI.checkpatch: " Patchwork
2024-10-14  7:46 ` ✓ CI.KUnit: " Patchwork
2024-10-14  7:55 ` [PATCH v9 01/26] drm/xe: Add member initialized_domains to xe_force_wake() Himal Prasad Ghimiray
2024-10-14  7:55 ` [PATCH v9 02/26] drm/xe/forcewake: Change awake_domain datatype Himal Prasad Ghimiray
2024-10-14  7:55 ` [PATCH v9 03/26] drm/xe/forcewake: Add a helper xe_force_wake_ref_has_domain() Himal Prasad Ghimiray
2024-10-14  7:55 ` [PATCH v9 04/26] drm/xe: Error handling in xe_force_wake_get() Himal Prasad Ghimiray
2024-10-14  8:32   ` Nirmoy Das
2024-10-14  7:55 ` [PATCH v9 05/26] drm/xe: Modify xe_force_wake_put to handle _get returned mask Himal Prasad Ghimiray
2024-10-14  8:52   ` Nirmoy Das
2024-10-14  7:55 ` [PATCH v9 06/26] drm/xe/device: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-10-15 13:28   ` Nirmoy Das
2024-10-15 14:35   ` Nilawar, Badal [this message]
2024-10-14  7:55 ` [PATCH v9 07/26] drm/xe/hdcp: " Himal Prasad Ghimiray
2024-10-15 13:29   ` Nirmoy Das
2024-10-14  7:55 ` [PATCH v9 08/26] drm/xe/gsc: " Himal Prasad Ghimiray
2024-10-15 13:57   ` Nirmoy Das
2024-10-14  7:55 ` [PATCH v9 09/26] drm/xe/gt: " Himal Prasad Ghimiray
2024-10-15 14:24   ` Nirmoy Das
2024-10-15 14:44   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 10/26] drm/xe/xe_gt_idle: " Himal Prasad Ghimiray
2024-10-15 14:25   ` Nirmoy Das
2024-10-14  7:55 ` [PATCH v9 11/26] drm/xe/devcoredump: " Himal Prasad Ghimiray
2024-10-15 14:26   ` Nirmoy Das
2024-10-15 16:06   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 12/26] drm/xe/tests/mocs: Update xe_force_wake_get() return handling Himal Prasad Ghimiray
2024-10-15 14:47   ` Nirmoy Das
2024-10-15 16:08   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 13/26] drm/xe/mocs: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-10-15 15:09   ` Nirmoy Das
2024-10-15 17:59   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 14/26] drm/xe/xe_drm_client: " Himal Prasad Ghimiray
2024-10-15 15:17   ` Nirmoy Das
2024-10-15 18:00   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 15/26] drm/xe/xe_gt_debugfs: " Himal Prasad Ghimiray
2024-10-15 15:18   ` Nirmoy Das
2024-10-15 18:09   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 16/26] drm/xe/guc: " Himal Prasad Ghimiray
2024-10-15 15:20   ` Nirmoy Das
2024-10-15 18:32   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 17/26] drm/xe/huc: " Himal Prasad Ghimiray
2024-10-15 15:21   ` Nirmoy Das
2024-10-15 18:20   ` Nilawar, Badal
2024-10-15 18:42   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 18/26] drm/xe/oa: Handle force_wake_get failure in xe_oa_stream_init() Himal Prasad Ghimiray
2024-10-15 15:21   ` Nirmoy Das
2024-10-16 12:34   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 19/26] drm/xe/pat: Update handling of xe_force_wake_get return Himal Prasad Ghimiray
2024-10-15 15:28   ` Nirmoy Das
2024-10-16 12:35   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 20/26] drm/xe/gt_tlb_invalidation_ggtt: " Himal Prasad Ghimiray
2024-10-15 15:29   ` Nirmoy Das
2024-10-16 12:36   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 21/26] drm/xe/xe_reg_sr: " Himal Prasad Ghimiray
2024-10-15 15:30   ` Nirmoy Das
2024-10-16 12:38   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 22/26] drm/xe/query: " Himal Prasad Ghimiray
2024-10-15 15:31   ` Nirmoy Das
2024-10-16 12:40   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 23/26] drm/xe/vram: " Himal Prasad Ghimiray
2024-10-15 15:34   ` Nirmoy Das
2024-10-16 12:41   ` Nilawar, Badal
2024-10-14  7:55 ` [PATCH v9 24/26] drm/xe: forcewake debugfs open fails on xe_forcewake_get failure Himal Prasad Ghimiray
2024-10-15 16:02   ` Nilawar, Badal
2024-10-14  7:56 ` [PATCH v9 25/26] drm/xe: Ensure __must_check for xe_force_wake_get() return Himal Prasad Ghimiray
2024-10-14  8:57   ` Nirmoy Das
2024-10-14  7:56 ` [PATCH v9 26/26] drm/xe: Change return type to void for xe_force_wake_put Himal Prasad Ghimiray
2024-10-14  9:00   ` Nirmoy Das
2024-10-14  7:57 ` ✓ CI.Build: success for Fix xe_force_wake_get() failure handling (rev10) Patchwork
2024-10-14  7:59 ` ✓ CI.Hooks: " Patchwork
2024-10-14  8:01 ` ✓ CI.checksparse: " Patchwork
2024-10-14  8:27 ` ✓ CI.BAT: " Patchwork
2024-10-14  9:25 ` ✗ CI.FULL: failure " Patchwork
2024-10-17  5:40 ` ✓ CI.Patch_applied: success for Fix xe_force_wake_get() failure handling (rev11) Patchwork
2024-10-17  5:40 ` ✗ CI.checkpatch: warning " Patchwork
2024-10-17  5:42 ` ✓ CI.KUnit: success " Patchwork
2024-10-17  5:53 ` ✓ CI.Build: " Patchwork
2024-10-17  5:55 ` ✓ CI.Hooks: " Patchwork
2024-10-17  5:57 ` ✓ CI.checksparse: " Patchwork
2024-10-17  6:20 ` ✓ CI.BAT: " Patchwork
2024-10-17 15:42 ` ✗ CI.FULL: failure " Patchwork

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=56278e87-01d7-4d2f-bb90-35ba436a3f24@intel.com \
    --to=badal.nilawar@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=rodrigo.vivi@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