All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 06/20] drm/i915/cdclk: Extract dg2_power_well_count()
Date: Wed, 24 Sep 2025 12:05:56 +0300	[thread overview]
Message-ID: <30933726eb345cbf6ea9b1dcbfc0ad890d31e0d7@intel.com> (raw)
In-Reply-To: <20250924061602.2837-1-ville.syrjala@linux.intel.com>

On Wed, 24 Sep 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Extract the code to determine the DG2 pipe power well count
> into a small helper. I'll have other uses for this later.
>
> TODO: need to move this power well stuff out from the cdclk code...
>
> v2: Don't lose the early return from intel_cdclk_pcode_pre_notify()
>     (kernel test robot)
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 33 +++++++++++++---------
>  1 file changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index 05d9f488895e..f190cfb85a34 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -2591,6 +2591,12 @@ static void intel_set_cdclk(struct intel_display *display,
>  	}
>  }
>  
> +static bool dg2_power_well_count(struct intel_display *display,
> +				 const struct intel_cdclk_state *cdclk_state)
> +{
> +	return display->platform.dg2 ? hweight8(cdclk_state->active_pipes) : 0;
> +}
> +
>  static void intel_cdclk_pcode_pre_notify(struct intel_atomic_state *state)
>  {
>  	struct intel_display *display = to_intel_display(state);
> @@ -2603,16 +2609,16 @@ static void intel_cdclk_pcode_pre_notify(struct intel_atomic_state *state)
>  
>  	if (!intel_cdclk_changed(&old_cdclk_state->actual,
>  				 &new_cdclk_state->actual) &&
> -				 new_cdclk_state->active_pipes ==
> -				 old_cdclk_state->active_pipes)
> +	    dg2_power_well_count(display, old_cdclk_state) ==
> +	    dg2_power_well_count(display, old_cdclk_state))

Both have old_cdclk_state, making this always true.

Side note, perhaps the whole function should be renamed
dg2_cdclk_pcode_pre_notify(), because the additional dg2 check in
dg2_power_well_count() felt weird until I realized this is all dg2 only.

BR,
Jani.


>  		return;
>  
>  	/* According to "Sequence Before Frequency Change", voltage level set to 0x3 */
>  	voltage_level = DISPLAY_TO_PCODE_VOLTAGE_MAX;
>  
>  	change_cdclk = new_cdclk_state->actual.cdclk != old_cdclk_state->actual.cdclk;
> -	update_pipe_count = hweight8(new_cdclk_state->active_pipes) >
> -			    hweight8(old_cdclk_state->active_pipes);
> +	update_pipe_count = dg2_power_well_count(display, new_cdclk_state) >
> +		dg2_power_well_count(display, old_cdclk_state);
>  
>  	/*
>  	 * According to "Sequence Before Frequency Change",
> @@ -2630,7 +2636,7 @@ static void intel_cdclk_pcode_pre_notify(struct intel_atomic_state *state)
>  	 * no action if it is decreasing, before the change
>  	 */
>  	if (update_pipe_count)
> -		num_active_pipes = hweight8(new_cdclk_state->active_pipes);
> +		num_active_pipes = dg2_power_well_count(display, new_cdclk_state);
>  
>  	intel_pcode_notify(display, voltage_level, num_active_pipes, cdclk,
>  			   change_cdclk, update_pipe_count);
> @@ -2650,8 +2656,8 @@ static void intel_cdclk_pcode_post_notify(struct intel_atomic_state *state)
>  	voltage_level = new_cdclk_state->actual.voltage_level;
>  
>  	update_cdclk = new_cdclk_state->actual.cdclk != old_cdclk_state->actual.cdclk;
> -	update_pipe_count = hweight8(new_cdclk_state->active_pipes) <
> -			    hweight8(old_cdclk_state->active_pipes);
> +	update_pipe_count = dg2_power_well_count(display, new_cdclk_state) <
> +		dg2_power_well_count(display, old_cdclk_state);
>  
>  	/*
>  	 * According to "Sequence After Frequency Change",
> @@ -2667,7 +2673,7 @@ static void intel_cdclk_pcode_post_notify(struct intel_atomic_state *state)
>  	 * no action if it is increasing, after the change
>  	 */
>  	if (update_pipe_count)
> -		num_active_pipes = hweight8(new_cdclk_state->active_pipes);
> +		num_active_pipes = dg2_power_well_count(display, new_cdclk_state);
>  
>  	intel_pcode_notify(display, voltage_level, num_active_pipes, cdclk,
>  			   update_cdclk, update_pipe_count);
> @@ -3248,15 +3254,14 @@ static bool intel_cdclk_need_serialize(struct intel_display *display,
>  				       const struct intel_cdclk_state *old_cdclk_state,
>  				       const struct intel_cdclk_state *new_cdclk_state)
>  {
> -	bool power_well_cnt_changed = hweight8(old_cdclk_state->active_pipes) !=
> -				      hweight8(new_cdclk_state->active_pipes);
> -	bool cdclk_changed = intel_cdclk_changed(&old_cdclk_state->actual,
> -						 &new_cdclk_state->actual);
>  	/*
> -	 * We need to poke hw for gen >= 12, because we notify PCode if
> +	 * We need to poke hw for DG2, because we notify PCode if
>  	 * pipe power well count changes.
>  	 */
> -	return cdclk_changed || (display->platform.dg2 && power_well_cnt_changed);
> +	return intel_cdclk_changed(&old_cdclk_state->actual,
> +				   &new_cdclk_state->actual) ||
> +		dg2_power_well_count(display, old_cdclk_state) !=
> +		dg2_power_well_count(display, new_cdclk_state);
>  }
>  
>  int intel_modeset_calc_cdclk(struct intel_atomic_state *state)

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-09-24  9:06 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23 17:19 [PATCH 00/20] drm/i915/cdclk: Decouple CDCLK from state->modeset Ville Syrjala
2025-09-23 17:19 ` [PATCH 01/20] drm/i915: Introduce intel_crtc_enable_changed() and intel_any_crtc_enable_changed() Ville Syrjala
2025-09-23 17:19 ` [PATCH 02/20] drm/i915: Introduce intel_crtc_active_changed() and intel_any_crtc_active_changed() Ville Syrjala
2025-09-23 17:19 ` [PATCH 03/20] drm/i915/bw: Skip the bw_state->active_pipes update if no pipe is changing its active state Ville Syrjala
2025-09-23 17:19 ` [PATCH 04/20] drm/1915/bw: Drop redundant display version checks Ville Syrjala
2025-09-23 17:19 ` [PATCH 05/20] drm/i915/cdclk: Extract glk_cdclk_audio_wa_needed() Ville Syrjala
2025-09-23 17:19 ` [PATCH 06/20] drm/i915/cdclk: Extract dg2_power_well_count() Ville Syrjala
2025-09-23 23:05   ` kernel test robot
2025-09-24  6:16   ` [PATCH v2 " Ville Syrjala
2025-09-24  9:05     ` Jani Nikula [this message]
2025-09-24  9:56       ` Ville Syrjälä
2025-09-26  8:39   ` [PATCH v3 " Ville Syrjala
2025-10-09 16:59   ` [PATCH " kernel test robot
2025-09-23 17:19 ` [PATCH 07/20] drm/i915/cdclk: Introduce intel_cdclk_modeset_checks() Ville Syrjala
2025-09-23 17:19 ` [PATCH 08/20] drm/i915/cdclk: Handle the force_min_cdclk state locking in intel_cdclk_atomic_check() Ville Syrjala
2025-09-23 17:19 ` [PATCH 09/20] drm/i915/cdclk: Extract intel_cdclk_update_bw_min_cdclk() Ville Syrjala
2025-09-23 17:19 ` [PATCH 10/20] drm/i915/cdclk: Extract intel_cdclk_update_crtc_min_cdclk() Ville Syrjala
2025-09-23 17:19 ` [PATCH 11/20] drm/i915/cdclk: Rework bw_min_cdclk handling Ville Syrjala
2025-09-23 17:19 ` [PATCH 12/20] drm/i915/cdclk: Do intel_cdclk_update_crtc_min_cdclk() per-pipe Ville Syrjala
2025-09-23 17:19 ` [PATCH 13/20] drm/i915/cdclk: Relocate intel_plane_calc_min_cdclk() calls Ville Syrjala
2025-09-23 17:19 ` [PATCH 14/20] drm/i915/cdclk: Rework crtc min_cdclk handling Ville Syrjala
2025-09-23 17:19 ` [PATCH 15/20] drm/i915/cdclk: Move intel_bw_crtc_min_cdclk() handling into intel_crtc_compute_min_cdclk() Ville Syrjala
2025-09-23 17:19 ` [PATCH 16/20] drm/i915/cdclk: Decuple cdclk from state->modeset Ville Syrjala
2025-09-23 17:19 ` [PATCH 17/20] drm/i915: Introduce intel_calc_enabled_pipes() Ville Syrjala
2025-09-23 17:19 ` [PATCH 18/20] drm/i915/cdclk: Use enabled_pipes instead of active_pipes for the glk audio w/a Ville Syrjala
2025-09-23 17:19 ` [PATCH 19/20] drm/i915/cdclk: Hide intel_modeset_calc_cdclk() Ville Syrjala
2025-09-23 17:19 ` [PATCH 20/20] drm/i915/cdclk: Move intel_cdclk_atomic_check() Ville Syrjala
2025-09-23 17:46 ` ✗ CI.checkpatch: warning for drm/i915/cdclk: Decouple CDCLK from state->modeset Patchwork
2025-09-23 17:48 ` ✓ CI.KUnit: success " Patchwork
2025-09-23 18:09 ` ✗ CI.checksparse: warning " Patchwork
2025-09-23 21:23 ` ✓ i915.CI.BAT: success " Patchwork
2025-09-23 21:34 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-24  3:47 ` ✓ Xe.CI.BAT: success " Patchwork
2025-09-24  6:22 ` ✗ CI.checkpatch: warning for drm/i915/cdclk: Decouple CDCLK from state->modeset (rev2) Patchwork
2025-09-24  6:23 ` ✓ CI.KUnit: success " Patchwork
2025-09-24  6:38 ` ✗ CI.checksparse: warning " Patchwork
2025-09-24  6:58 ` ✓ Xe.CI.BAT: success " Patchwork
2025-09-24  7:24 ` ✓ i915.CI.BAT: " Patchwork
2025-09-24  9:34 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-24 12:57 ` ✗ i915.CI.Full: failure for drm/i915/cdclk: Decouple CDCLK from state->modeset Patchwork
2025-09-24 18:08 ` ✗ i915.CI.Full: failure for drm/i915/cdclk: Decouple CDCLK from state->modeset (rev2) Patchwork
2025-09-26  8:46 ` ✗ CI.checkpatch: warning for drm/i915/cdclk: Decouple CDCLK from state->modeset (rev3) Patchwork
2025-09-26  8:47 ` ✓ CI.KUnit: success " Patchwork
2025-09-26  9:03 ` ✗ CI.checksparse: warning " Patchwork
2025-09-26  9:28 ` ✓ Xe.CI.BAT: success " Patchwork
2025-09-26 10:44 ` ✓ i915.CI.BAT: " Patchwork
2025-09-26 13:22 ` ✗ i915.CI.Full: failure " Patchwork
2025-09-26 13:36 ` ✓ Xe.CI.Full: success " Patchwork
2025-10-08  7:15 ` [PATCH 00/20] drm/i915/cdclk: Decouple CDCLK from state->modeset Kahola, Mika

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=30933726eb345cbf6ea9b1dcbfc0ad890d31e0d7@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@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.