All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michal Wajdeczko" <michal.wajdeczko@intel.com>
To: intel-gfx@lists.freedesktop.org,
	Sagar Arun Kamble <sagar.a.kamble@intel.com>
Subject: Re: [PATCH v13 10/21] drm/i915/guc: Update uC suspend/resume function separating Host/GuC tasks
Date: Wed, 11 Oct 2017 18:19:44 +0200	[thread overview]
Message-ID: <op.y7ycy6w2xaggs7@mwajdecz-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <1507712056-25030-11-git-send-email-sagar.a.kamble@intel.com>

On Wed, 11 Oct 2017 10:54:05 +0200, Sagar Arun Kamble  
<sagar.a.kamble@intel.com> wrote:

> Suspending GuC involves bunch of tasks controlled by GuC OS and some
> controlled by Host OS.
>
> Host needs to disable submission to GuC and any other GuC functions.  
> Then,
> GuC's task is initiated by Host sending action to GuC to enter sleep
> state. On this action, GuC preempts engines to idle context and then  
> saves
> internal state to a buffer. It also disables internal interrupts/timers  
> to
> avoid any wake-ups.
> After this, Host should disable GuC interrupts, communication with GuC
> (intel_guc_send/notify). GGTT invalidate update will have to be done in
> conjunction with GTT related suspend/resume tasks.
>
> v2: Rebase w.r.t removal of GuC code restructuring.
>
> v3: Removed GuC specific helpers as tasks other than send H2G for
> sleep/resume are to be done from uc generic functions. (Michal Wajdeczko)
>
> v4: Simplified/Unified the error messaging in uc_runtime_suspend/resume.
> (Michal Wajdeczko). Rebase w.r.t i915_modparams change.
> Added documentation to intel_uc_runtime_suspend/resume.
>
> v5: Removed enable_guc_loading based check from intel_uc_runtime_suspend
> and intel_uc_runtime_resume and pulled FW load_status based checks from
> intel_guc_suspend/resume into these functions. (Michal Wajdeczko)
>
> v6: Adjusted intel_uc_runtime_resume with prototype change to not return
> value.
>
> v7: Rebase.
>
> v8: Updated commit description and added submission enable/disable in
> GuC suspend/resume paths. Removed GGTT invalidate update functions.
>
> Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> #6
> ---
>  drivers/gpu/drm/i915/intel_guc.c | 11 -------
>  drivers/gpu/drm/i915/intel_uc.c  | 65  
> +++++++++++++++++++++++++++++++++++++---
>  2 files changed, 61 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_guc.c  
> b/drivers/gpu/drm/i915/intel_guc.c
> index 9a2df69..55a0158 100644
> --- a/drivers/gpu/drm/i915/intel_guc.c
> +++ b/drivers/gpu/drm/i915/intel_guc.c
> @@ -177,11 +177,6 @@ int intel_guc_suspend(struct intel_guc *guc)
>  	struct i915_gem_context *ctx;
>  	u32 data[3];
> -	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
> -		return 0;
> -
> -	gen9_disable_guc_interrupts(i915);
> -
>  	ctx = i915->kernel_context;
> 	data[0] = INTEL_GUC_ACTION_ENTER_S_STATE;
> @@ -204,12 +199,6 @@ int intel_guc_resume(struct intel_guc *guc)
>  	struct i915_gem_context *ctx;
>  	u32 data[3];
> -	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
> -		return 0;
> -
> -	if (i915_modparams.guc_log_level >= 0)
> -		gen9_enable_guc_interrupts(i915);
> -
>  	ctx = i915->kernel_context;
> 	data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
> diff --git a/drivers/gpu/drm/i915/intel_uc.c  
> b/drivers/gpu/drm/i915/intel_uc.c
> index b5c132c..297a321 100644
> --- a/drivers/gpu/drm/i915/intel_uc.c
> +++ b/drivers/gpu/drm/i915/intel_uc.c
> @@ -284,18 +284,75 @@ void intel_uc_fini_hw(struct drm_i915_private  
> *dev_priv)
>  		i915_ggtt_disable_guc(dev_priv);
>  }
> +/**
> + * intel_uc_suspend() - Suspend uC operation.
> + * @dev_priv: i915 device private
> + *

Ha! found missing kerneldoc ... maybe it can be partially moved to
previous patch ?

> + * This function disables GuC submission, invokes GuC OS suspension,
> + * disables GuC interrupts and disable communication with GuC.
> + *
> + * Return:	non-zero code on error
> + */
>  int intel_uc_suspend(struct drm_i915_private *dev_priv)
>  {
> -	int ret;
> +	struct intel_guc *guc = &dev_priv->guc;
> +	int ret = 0;
> +
> +	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
> +		goto out;

Hmm, is it ok to report DRM_ERROR if Guc was not started/loaded ?
Return 0 seems to be still the best option here.

> +
> +	i915_guc_submission_disable(dev_priv);
> -	ret = intel_guc_suspend(&dev_priv->guc);
> +	ret = intel_guc_suspend(guc);
>  	if (ret)
> -		DRM_ERROR("Failed to suspend GuC\n");
> +		goto out_suspend;
> +
> +	gen9_disable_guc_interrupts(dev_priv);
> +	guc_disable_communication(guc);
> +
> +	goto out;
> +
> +out_suspend:
> +	i915_guc_submission_enable(dev_priv);
> +out:
> +	if (ret)
> +		DRM_ERROR("uC Suspend failed (%d)\n", ret);

Unless I read wrong, we are re-enabling guc submission on failure,
so maybe error should say something like:

	DRM_ERROR("Failed to suspend uC, aborting suspend\n");

> 	return ret;
>  }
> +/**
> + * intel_uc_resume() - Resume uC operation.
> + * @dev_priv: i915 device private
> + *
> + * This function enables communication with GuC, enables GuC interrupts,
> + * invokes GuC OS resumption and enables GuC submission.
> + */
>  void intel_uc_resume(struct drm_i915_private *dev_priv)
>  {
> -	intel_guc_resume(&dev_priv->guc);
> +	struct intel_guc *guc = &dev_priv->guc;
> +	int ret;
> +
> +	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
> +		return;
> +
> +	ret = guc_enable_communication(guc);

Hmm, not too early ? CT will try to talk with Guc.

> +	if (ret) {
> +		DRM_DEBUG_DRIVER("GuC communication enable failed (%d)\n", ret);
> +		return;
> +	}
> +
> +	if (i915_modparams.guc_log_level >= 0)
> +		gen9_enable_guc_interrupts(dev_priv);
> +
> +	ret = intel_guc_resume(guc);
> +	if (ret)
> +		DRM_ERROR("GuC resume failed (%d)."
> +			  "GuC functions may not work\n", ret);
> +
> +	i915_guc_submission_enable(dev_priv);
> +
> +	DRM_DEBUG_DRIVER("GuC submission %s\n",
> +			 i915_guc_submission_enabled(guc) ?
> +			 "enabled" : "disabled");

Hmm, this message can be part of i915_guc_submission_enable

>  }
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-10-11 16:19 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11  8:53 [PATCH v13 00/21] drm/i915: GEM/GuC Suspend/Resume/Reset fixes and restructuring Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 01/21] drm/i915/guc: Add GuC submission initialization/enable state variables Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 02/21] drm/i915/guc: Sanitize module parameter guc_log_level Sagar Arun Kamble
2017-10-11 14:51   ` Michal Wajdeczko
2017-10-12  5:48     ` Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 03/21] drm/i915/guc: Add status checks to enable/disable_guc_interrupts Sagar Arun Kamble
2017-10-11 15:20   ` Michal Wajdeczko
2017-10-12  5:50     ` Sagar Arun Kamble
2017-10-12  6:17       ` Sagar Arun Kamble
2017-10-13  8:09         ` Sagar Arun Kamble
2017-10-11  8:53 ` [PATCH v13 04/21] drm/i915/guc: Remove enable_guc_submission dependency for invoking GuC log functions Sagar Arun Kamble
2017-10-11 15:40   ` Michal Wajdeczko
2017-10-12  5:58     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 05/21] drm/i915/guc: Update enable_guc_loading check in intel_uc_fini_hw Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 06/21] drm/i915/guc: Pass intel_guc struct parameter to intel_guc_suspend/resume Sagar Arun Kamble
2017-10-11 15:50   ` Michal Wajdeczko
2017-10-12  6:18     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 07/21] drm/i915: Create GEM runtime resume helper and handle GEM runtime suspend error Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 08/21] drm/i915/guc: Update GEM suspend/resume flows with GuC suspend/resume functions Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 09/21] drm/i915/uc: Create uC suspend and resume functions Sagar Arun Kamble
2017-10-11 15:57   ` Michal Wajdeczko
2017-10-12  6:25     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 10/21] drm/i915/guc: Update uC suspend/resume function separating Host/GuC tasks Sagar Arun Kamble
2017-10-11 16:19   ` Michal Wajdeczko [this message]
2017-10-12  6:38     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 11/21] drm/i915/guc: Remove GuC submission disable from i915_driver_unload Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 12/21] drm/i915/guc: Fix GuC related state cleanup in unload path Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 13/21] drm/i915/uc: Support resume from sleep w/ and w/o GuC/HuC reload Sagar Arun Kamble
2017-10-11 17:06   ` Michal Wajdeczko
2017-10-12  6:48     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 14/21] drm/i915/uc: Update GEM runtime resume with need for reload of GuC/HuC Sagar Arun Kamble
2017-10-11 17:19   ` Michal Wajdeczko
2017-10-12  6:50     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 15/21] drm/i915/guc: Add comment about update needed in GuC submission enable/disable for RPM Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 16/21] drm/i915: Enable interrupts prior to GEM resume during i915_drm_resume Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 17/21] drm/i915: Split i915_gem_suspend into gem quiescing and HW suspend Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 18/21] drm/i915/uc: Introduce intel_uc_sanitize to initialize GuC/HuC reset state Sagar Arun Kamble
2017-10-11 17:30   ` Michal Wajdeczko
2017-10-11 17:46     ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 19/21] drm/i915/guc: Fix enable/disable of GuC GGTT invalidate functions Sagar Arun Kamble
2017-10-11 17:35   ` Michal Wajdeczko
2017-10-11 17:44     ` Sagar Arun Kamble
2017-10-11 17:58       ` Michal Wajdeczko
2017-10-11 18:09         ` Sagar Arun Kamble
2017-10-11 18:20           ` Michal Wajdeczko
2017-10-12  9:08             ` Joonas Lahtinen
2017-10-12 12:08               ` Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 20/21] drm/i915/guc: Disable GuC submission/interrupts/communication in intel_uc_sanitize Sagar Arun Kamble
2017-10-11  8:54 ` [PATCH v13 21/21] HAX enable GuC submission for CI Sagar Arun Kamble
2017-10-11  9:44 ` ✗ Fi.CI.BAT: failure for drm/i915: GEM/GuC Suspend/Resume/Reset fixes and restructuring 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=op.y7ycy6w2xaggs7@mwajdecz-mobl1.ger.corp.intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sagar.a.kamble@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.