From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 10/10] drm/i915: Perform a central cdclk state sanity check
Date: Tue, 24 Oct 2017 14:51:32 -0700 [thread overview]
Message-ID: <20171024215132.u5skrhixe4dfnfnt@intel.com> (raw)
In-Reply-To: <20171024095216.1638-11-ville.syrjala@linux.intel.com>
On Tue, Oct 24, 2017 at 09:52:16AM +0000, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> WARN if the cdclk state doesn't match what we expect after programming.
> And let's remove the WARN from bdw_set_cdclk() that's trying to achieve
> the same thing in a more limite fashion.
>
> Also take the opportunity to refactor the code to use a common function
> for dumping out a cdclk state.
>
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
better code, better logs and right checks.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/i915/intel_cdclk.c | 30 +++++++++++++++++++-----------
> drivers/gpu/drm/i915/intel_display.c | 3 +++
> drivers/gpu/drm/i915/intel_drv.h | 2 ++
> 3 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c
> index fedfe3c720b6..51cd23dd8676 100644
> --- a/drivers/gpu/drm/i915/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/intel_cdclk.c
> @@ -768,10 +768,6 @@ static void bdw_set_cdclk(struct drm_i915_private *dev_priv,
> I915_WRITE(CDCLK_FREQ, DIV_ROUND_CLOSEST(cdclk, 1000) - 1);
>
> intel_update_cdclk(dev_priv);
> -
> - WARN(cdclk != dev_priv->cdclk.hw.cdclk,
> - "cdclk requested %d kHz but got %d kHz\n",
> - cdclk, dev_priv->cdclk.hw.cdclk);
> }
>
> static int skl_calc_cdclk(int min_cdclk, int vco)
> @@ -1068,6 +1064,8 @@ static void skl_sanitize_cdclk(struct drm_i915_private *dev_priv)
> goto sanitize;
>
> intel_update_cdclk(dev_priv);
> + intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK");
> +
> /* Is PLL enabled and locked ? */
> if (dev_priv->cdclk.hw.vco == 0 ||
> dev_priv->cdclk.hw.cdclk == dev_priv->cdclk.hw.ref)
> @@ -1407,6 +1405,7 @@ static void bxt_sanitize_cdclk(struct drm_i915_private *dev_priv)
> u32 cdctl, expected;
>
> intel_update_cdclk(dev_priv);
> + intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK");
>
> if (dev_priv->cdclk.hw.vco == 0 ||
> dev_priv->cdclk.hw.cdclk == dev_priv->cdclk.hw.ref)
> @@ -1713,6 +1712,7 @@ static void cnl_sanitize_cdclk(struct drm_i915_private *dev_priv)
> u32 cdctl, expected;
>
> intel_update_cdclk(dev_priv);
> + intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK");
>
> if (dev_priv->cdclk.hw.vco == 0 ||
> dev_priv->cdclk.hw.cdclk == dev_priv->cdclk.hw.ref)
> @@ -1826,6 +1826,14 @@ bool intel_cdclk_changed(const struct intel_cdclk_state *a,
> a->voltage_level != b->voltage_level;
> }
>
> +void intel_dump_cdclk_state(const struct intel_cdclk_state *cdclk_state,
> + const char *context)
> +{
> + DRM_DEBUG_DRIVER("%s %d kHz, VCO %d kHz, ref %d kHz, voltage level %d\n",
> + context, cdclk_state->cdclk, cdclk_state->vco,
> + cdclk_state->ref, cdclk_state->voltage_level);
> +}
> +
> /**
> * intel_set_cdclk - Push the CDCLK state to the hardware
> * @dev_priv: i915 device
> @@ -1843,11 +1851,15 @@ void intel_set_cdclk(struct drm_i915_private *dev_priv,
> if (WARN_ON_ONCE(!dev_priv->display.set_cdclk))
> return;
>
> - DRM_DEBUG_DRIVER("Changing CDCLK to %d kHz, VCO %d kHz, ref %d kHz, voltage_level %d\n",
> - cdclk_state->cdclk, cdclk_state->vco,
> - cdclk_state->ref, cdclk_state->voltage_level);
> + intel_dump_cdclk_state(cdclk_state, "Changing CDCLK to");
>
> dev_priv->display.set_cdclk(dev_priv, cdclk_state);
> +
> + if (WARN(intel_cdclk_changed(&dev_priv->cdclk.hw, cdclk_state),
> + "cdclk state doesn't match!\n")) {
> + intel_dump_cdclk_state(&dev_priv->cdclk.hw, "[hw state]");
> + intel_dump_cdclk_state(cdclk_state, "[sw state]");
> + }
> }
>
> static int intel_pixel_rate_to_cdclk(struct drm_i915_private *dev_priv,
> @@ -2280,10 +2292,6 @@ void intel_update_cdclk(struct drm_i915_private *dev_priv)
> {
> dev_priv->display.get_cdclk(dev_priv, &dev_priv->cdclk.hw);
>
> - DRM_DEBUG_DRIVER("Current CD clock rate: %d kHz, VCO: %d kHz, ref: %d kHz\n",
> - dev_priv->cdclk.hw.cdclk, dev_priv->cdclk.hw.vco,
> - dev_priv->cdclk.hw.ref);
> -
> /*
> * 9:0 CMBUS [sic] CDCLK frequency (cdfreq):
> * Programmng [sic] note: bit[9:2] should be programmed to the number
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b5fa643e1812..7d7952b78a3b 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -8857,7 +8857,9 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
> }
>
> intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> +
> intel_update_cdclk(dev_priv);
> + intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK");
> }
>
> /*
> @@ -14358,6 +14360,7 @@ void intel_modeset_init_hw(struct drm_device *dev)
> struct drm_i915_private *dev_priv = to_i915(dev);
>
> intel_update_cdclk(dev_priv);
> + intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK");
> dev_priv->cdclk.logical = dev_priv->cdclk.actual = dev_priv->cdclk.hw;
>
> intel_init_clock_gating(dev_priv);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 3de8d98baed7..3b4eafd39f55 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1336,6 +1336,8 @@ bool intel_cdclk_changed(const struct intel_cdclk_state *a,
> const struct intel_cdclk_state *b);
> void intel_set_cdclk(struct drm_i915_private *dev_priv,
> const struct intel_cdclk_state *cdclk_state);
> +void intel_dump_cdclk_state(const struct intel_cdclk_state *cdclk_state,
> + const char *context);
>
> /* intel_display.c */
> void i830_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe);
> --
> 2.13.6
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-10-24 21:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 9:52 [PATCH v2 00/10] drm/i915: CNL DVFS thing Ville Syrjala
2017-10-24 9:52 ` [PATCH 01/10] drm/i915: Clean up some cdclk switch statements Ville Syrjala
2017-10-24 9:52 ` [PATCH v2 02/10] drm/i915: Start tracking voltage level in the cdclk state Ville Syrjala
2017-10-24 9:52 ` [PATCH v4 03/10] drm/i915: Use cdclk_state->voltage on VLV/CHV Ville Syrjala
2017-10-24 9:52 ` [PATCH v3 04/10] drm/i915: Use cdclk_state->voltage on BDW Ville Syrjala
2017-10-24 9:52 ` [PATCH v2 05/10] drm/i915: Use cdclk_state->voltage on SKL/KBL/CFL Ville Syrjala
2017-10-24 9:52 ` [PATCH v2 06/10] drm/i915: Use cdclk_state->voltage on BXT/GLK Ville Syrjala
2017-10-24 9:52 ` [PATCH v2 07/10] drm/i915: Use cdclk_state->voltage on CNL Ville Syrjala
2017-10-24 9:52 ` [PATCH v4 08/10] drm/i915: Adjust system agent voltage on CNL if required by DDI ports Ville Syrjala
2017-10-24 9:52 ` [PATCH 09/10] drm/i915: Sanity check cdclk in vlv_set_cdclk() Ville Syrjala
2017-10-24 17:47 ` Rodrigo Vivi
2017-10-24 9:52 ` [PATCH 10/10] drm/i915: Perform a central cdclk state sanity check Ville Syrjala
2017-10-24 21:51 ` Rodrigo Vivi [this message]
2017-10-24 10:01 ` [PATCH v2 00/10] drm/i915: CNL DVFS thing Ville Syrjälä
2017-10-24 11:12 ` ✗ Fi.CI.BAT: failure for drm/i915: CNL DVFS thing (rev7) Patchwork
2017-10-24 13:23 ` Patchwork
2017-10-24 17:01 ` ✗ Fi.CI.BAT: warning " Patchwork
2017-10-24 18:30 ` ✗ Fi.CI.BAT: failure " Patchwork
2017-10-24 20:08 ` ✓ Fi.CI.BAT: success " Patchwork
2017-10-25 6:15 ` Saarinen, Jani
2017-10-24 21:29 ` ✓ Fi.CI.IGT: " Patchwork
2017-10-25 13:22 ` [PATCH v2 00/10] drm/i915: CNL DVFS thing Ville Syrjälä
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=20171024215132.u5skrhixe4dfnfnt@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.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.