All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Animesh Manna <animesh.manna@intel.com>
Cc: Suketu Shah <suketu.j.shah@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 4/8] drm/i915/skl: Assert the requirements to enter or exit DC5.
Date: Thu, 30 Apr 2015 16:26:11 +0300	[thread overview]
Message-ID: <1430400371.9584.11.camel@intel.com> (raw)
In-Reply-To: <1429174334-12089-5-git-send-email-animesh.manna@intel.com>

On to, 2015-04-16 at 14:22 +0530, Animesh Manna wrote:
> From: Suketu Shah <suketu.j.shah@intel.com>
> 
> Warn if the conditions to enter or exit DC5 are not satisfied such
> as support for runtime PM, state of power well, CSR loading etc.
> 
> v2: Removed camelcase in functions and variables.
> 
> v3: Do some minimal check to assert if CSR program is not loaded.
> 
> v4:
> 1] Used an appropriate function lookup_power_well() to identify power well,
> instead of using a magic number which can change in future.
> 2] Split the conditions further in assert_can_enable_DC5() and added more checks.
> 3] Removed all WARNs from assert_can_disable_DC5 as they were unnecessary and added two
>    new ones.
> 4] Changed variable names as updated in earlier patches.
> 
> v5:
> 1] Change lookup_power_well function to take an int power well id.
> 2] Define a new intel_display_power_well_is_enabled helper function to check whether a
>    particular power well is enabled.
> 3] Use CSR-related mutex in assert_csr_loaded function.
> 
> v6: Remove use of dc5_enabled variable as it's no longer needed.
> 
> v7:
> 1] Rebase to latest.
> 2] Move all DC5-related functions from intel_display.c to intel_runtime_pm.c.
> 
> v8: After adding dmc ver 1.0 support rebased on top of nightly. (Animesh)
> 
> v9: Modified below changes based on review comments from Imre.
> - Moved intel_display_power_well_is_enabled() to intel_runtime_pm.c.
> - Removed mutex lock from assert_csr_loaded(). (Animesh)
> 
> Issue: VIZ-2819
> Signed-off-by: A.Sunil Kamath <sunil.kamath@intel.com>
> Signed-off-by: Suketu Shah <suketu.j.shah@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> Signed-off-by: Animesh Manna <animesh.manna@intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_csr.c        |  9 ++++++
>  drivers/gpu/drm/i915/intel_drv.h        |  1 +
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 51 +++++++++++++++++++++++++++++----
>  3 files changed, 56 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
> index fe6789f..d58effe 100644
> --- a/drivers/gpu/drm/i915/intel_csr.c
> +++ b/drivers/gpu/drm/i915/intel_csr.c
> @@ -410,3 +410,12 @@ void intel_csr_ucode_fini(struct drm_device *dev)
>  	intel_csr_load_status_set(dev_priv, FW_FAILED);
>  	kfree(dev_priv->csr.dmc_payload);
>  }
> +
> +void assert_csr_loaded(struct drm_i915_private *dev_priv)
> +{
> +	WARN((intel_csr_load_status_get(dev_priv) != FW_LOADED), "CSR is not loaded.\n");
> +	WARN(!I915_READ(CSR_PROGRAM_BASE),
> +				"CSR program storage start is NULL\n");
> +	WARN(!I915_READ(CSR_SSP_BASE), "CSR SSP Base Not fine\n");
> +	WARN(!I915_READ(CSR_HTP_SKL), "CSR HTP Not fine\n");
> +}
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 25d7956..2eb0169 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1069,6 +1069,7 @@ void intel_csr_load_status_set(struct drm_i915_private *dev_priv,
>  					enum csr_state state);
>  void intel_csr_load_program(struct drm_device *dev);
>  void intel_csr_ucode_fini(struct drm_device *dev);
> +void assert_csr_loaded(struct drm_i915_private *dev_priv);
>  
>  /* intel_dp.c */
>  void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 466ea69..da8c18d 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -64,6 +64,9 @@
>  	     i--)							 \
>  		if ((power_well)->domains & (domain_mask))
>  
> +bool intel_display_power_well_is_enabled(struct drm_i915_private *dev_priv,
> +				    int power_well_id);
> +
>  /*
>   * We should only use the power well if we explicitly asked the hardware to
>   * enable it, so check if it's enabled and also check if we've requested it to
> @@ -335,12 +338,39 @@ static void gen9_set_dc_state_debugmask_memory_up(
>  	}
>  }
>  
> -static void gen9_enable_dc5(struct drm_i915_private *dev_priv)
> +static void assert_can_enable_dc5(struct drm_i915_private *dev_priv)
>  {
>  	struct drm_device *dev = dev_priv->dev;
> +	bool pg2_enabled = intel_display_power_well_is_enabled(dev_priv,
> +					SKL_DISP_PW_2);
> +
> +	WARN(!IS_SKYLAKE(dev), "Platform doesn't support DC5.\n");
> +	WARN(!HAS_RUNTIME_PM(dev), "Runtime PM not enabled.\n");
> +	WARN(pg2_enabled, "PG2 not disabled to enable DC5.\n");
> +
> +	WARN((I915_READ(DC_STATE_EN) & DC_STATE_EN_UPTO_DC5),
> +				"DC5 already programmed to be enabled.\n");
> +	WARN(dev_priv->pm.suspended,
> +		"DC5 cannot be enabled, if platform is runtime-suspended.\n");
> +
> +	assert_csr_loaded(dev_priv);
> +}
> +
> +static void assert_can_disable_dc5(struct drm_i915_private *dev_priv)
> +{
> +	bool pg2_enabled = intel_display_power_well_is_enabled(dev_priv,
> +					SKL_DISP_PW_2);
> +
> +	WARN(!pg2_enabled, "PG2 not enabled to disable DC5.\n");
> +	WARN(dev_priv->pm.suspended,
> +		"Disabling of DC5 while platform is runtime-suspended should never happen.\n");
> +}
> +
> +static void gen9_enable_dc5(struct drm_i915_private *dev_priv)
> +{
>  	uint32_t val;
>  
> -	WARN_ON(!IS_GEN9(dev));
> +	assert_can_enable_dc5(dev_priv);
>  
>  	DRM_DEBUG_KMS("Enabling DC5\n");
>  
> @@ -355,10 +385,9 @@ static void gen9_enable_dc5(struct drm_i915_private *dev_priv)
>  
>  static void gen9_disable_dc5(struct drm_i915_private *dev_priv)
>  {
> -	struct drm_device *dev = dev_priv->dev;
>  	uint32_t val;
>  
> -	WARN_ON(!IS_GEN9(dev));
> +	assert_can_disable_dc5(dev_priv);
>  
>  	DRM_DEBUG_KMS("Disabling DC5\n");
>  
> @@ -1318,7 +1347,7 @@ static struct i915_power_well chv_power_wells[] = {
>  };
>  
>  static struct i915_power_well *lookup_power_well(struct drm_i915_private *dev_priv,
> -						 enum punit_power_well power_well_id)
> +						 int power_well_id)
>  {
>  	struct i915_power_domains *power_domains = &dev_priv->power_domains;
>  	struct i915_power_well *power_well;
> @@ -1332,6 +1361,18 @@ static struct i915_power_well *lookup_power_well(struct drm_i915_private *dev_pr
>  	return NULL;
>  }
>  
> +bool intel_display_power_well_is_enabled(struct drm_i915_private *dev_priv,
> +				    int power_well_id)
> +{
> +	struct i915_power_well *power_well;
> +	bool ret;
> +
> +	power_well = lookup_power_well(dev_priv, power_well_id);
> +	ret = power_well->ops->is_enabled(dev_priv, power_well);
> +
> +	return ret;
> +}
> +
>  static struct i915_power_well skl_power_wells[] = {
>  	{
>  		.name = "always-on",


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

  reply	other threads:[~2015-04-30 13:26 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16  8:52 [PATCH v4 0/8] Enable DC states for skl Animesh Manna
2015-04-16  8:52 ` [PATCH v4 1/8] drm/i915/skl: Add support to load SKL CSR firmware Animesh Manna
2015-04-16  9:18   ` Damien Lespiau
2015-04-16  9:21   ` Imre Deak
2015-04-16 11:59     ` Animesh Manna
2015-04-16 11:25       ` Imre Deak
2015-04-16 14:23         ` Animesh Manna
2015-04-16 15:20           ` Imre Deak
2015-04-28 14:45   ` Imre Deak
2015-04-29 17:29     ` [PATCH v5 " Animesh Manna
2015-04-30 13:02       ` Imre Deak
2015-05-04  9:30         ` Daniel Vetter
2015-05-04 10:31           ` Imre Deak
2015-05-04 12:54       ` Daniel Vetter
2015-04-16  8:52 ` [PATCH v4 2/8] drm/i915/skl: Add DC5 Trigger Sequence Animesh Manna
2015-04-16  9:25   ` Imre Deak
2015-04-16  9:48     ` Imre Deak
2015-04-17  5:59       ` Animesh Manna
2015-04-17  7:15         ` Imre Deak
2015-04-17 14:16           ` [PATCH v5 2/2] " Animesh Manna
2015-04-30 13:18             ` Imre Deak
2015-05-04  9:39             ` Daniel Vetter
2015-04-16  8:52 ` [PATCH v4 3/8] drm/i915/skl: Implement enable/disable for Display C5 state Animesh Manna
2015-04-30 13:21   ` Imre Deak
2015-04-16  8:52 ` [PATCH v4 4/8] drm/i915/skl: Assert the requirements to enter or exit DC5 Animesh Manna
2015-04-30 13:26   ` Imre Deak [this message]
2015-04-16  8:52 ` [PATCH v4 5/8] drm/i915/skl: Add DC6 Trigger sequence Animesh Manna
2015-04-30 13:41   ` Imre Deak
2015-05-04  9:44   ` Daniel Vetter
2015-05-04 13:05   ` Daniel Vetter
2015-04-16  8:52 ` [PATCH v4 6/8] Implement enable/disable for Display C6 state Animesh Manna
2015-04-30 13:45   ` Imre Deak
2015-04-16  8:52 ` [PATCH v4 7/8] drm/i915/skl: Assert the requirements to enter or exit DC6 Animesh Manna
2015-04-16  8:52 ` [PATCH v4 8/8] drm/i915/skl: Enable runtime PM Animesh Manna
2015-04-17  1:52   ` shuang.he
2015-04-30 13:47   ` Imre Deak
2015-05-04 13:12 ` [PATCH v4 0/8] Enable DC states for skl Daniel Vetter

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=1430400371.9584.11.camel@intel.com \
    --to=imre.deak@intel.com \
    --cc=animesh.manna@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=suketu.j.shah@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.